diff options
Diffstat (limited to 'CST116F2021-Lab3/CST116F2021-Lab3.cpp')
| -rw-r--r-- | CST116F2021-Lab3/CST116F2021-Lab3.cpp | 172 |
1 files changed, 108 insertions, 64 deletions
diff --git a/CST116F2021-Lab3/CST116F2021-Lab3.cpp b/CST116F2021-Lab3/CST116F2021-Lab3.cpp index a0e6e03..a1f02d4 100644 --- a/CST116F2021-Lab3/CST116F2021-Lab3.cpp +++ b/CST116F2021-Lab3/CST116F2021-Lab3.cpp @@ -7,37 +7,40 @@ using namespace std; int main() { - ////6.4 p126 +/* //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + 6.4 p126 - // int a = 0; - // cout << a++ << endl; - // cout << ++a << endl; - // cout << a + 1 << endl; - // cout << a << endl; - // cout << --a << endl; + + int a = 0; + cout << a++ << endl; + cout << ++a << endl; + cout << a + 1 << endl; + cout << a << endl; + cout << --a << endl; +*/ -//// p148 7.1 1 thru 6 -// -// int int_exp1 = 0; -// int int_exp2 = 1; -// char char_exp = 'B'; -// -// int_exp1 >= int_exp2; // put great than sign before = to correct it -// int_exp1 == int_exp2; // made it a == sign -// int_exp1 != int_exp2; // explamation should be before = -// char_exp == 'A'; // should have single quote for char -// int_exp1 > char_exp; // trying to compare an int to a char -// int_exp1 < 2 && int_exp1 > -10 // needs to nhave the variable in the second comparison -// +/* ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + p148 7.1 1 thru 6 -// p155 7.2 bank level of membership program + int int_exp1 = 0; + int int_exp2 = 1; + char char_exp = 'B'; + int_exp1 >= int_exp2; // put great than sign before = to correct it + int_exp1 == int_exp2; // made it a == sign + int_exp1 != int_exp2; // explamation should be before = + char_exp == 'A'; // should have single quote for char + int_exp1 > char_exp; // trying to compare an int to a char + int_exp1 < 2 && int_exp1 > -10 // needs to nhave the variable in the second comparison +*/ +/* /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + p155 7.2 bank level of membership program - /*int numAccounts; + int numAccounts; float Amount; double plat; double gold; @@ -63,8 +66,8 @@ int main() cout << "\nSilver Member\n\n"; } else - - cout << "\nCopper Member\n\n";*/ + cout << "\nCopper Member\n\n"; +*/ @@ -72,8 +75,9 @@ int main() - //// p161 7.4 #1 case statement - short choice; +/* /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + p161 7.4 #1 case statement + /*short choice; cout << "\t Student Grade Program\n"; cout << "\t\t -Main Menu-\n\n"; @@ -103,18 +107,20 @@ int main() } return 0; +*/ +/* ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + 7.10 #2 p168 problem solving steps - // p168 7.10 #2 problem solving steps - /* Problem: Legitimize loans + Problem: Legitimize loans Understand Problem: Firstly the loan request and interest need to be validated Secondly the appropriate fees need to be assigned - thirdly display the pertenent info about the loan + thirdly display the pertinent info about the loan Psuedo code: 1) get loan amount 2) check to see if the loan amount falls between $100 and $1000 @@ -131,55 +137,87 @@ int main() 7) Display output disp amount disp interest - disp intpaid+fees */ - - //float amount; - //float intRate; - //int fees; - //float intPaid; - - //cout << "Enter amount of loan requested (between $100 and $1000): "; - //cin >> amount; - //if (amount >= 100 && amount <= 1000) - //{ - // cout << "Enter interest Rate between 1 and 18 %: "; - // cin >> intRate; - // if (intRate >= 1 && intRate <= 18) - // { - // if (amount <= 500) - // { - // fees = 20; - // } - // else - // fees = 25; - - - // intPaid = amount * intRate/100; - // cout << "\nLoan requested: $" << amount; - // cout << "\nInterest Rate: " << intRate << "%"; - // cout << "\nInterest and fees: $" << fees+intPaid<<"\n"; - // } - // else cout << "<You have entered an invalid interest rate>"; - //} - // - //else cout << "<You have entered an invaled loan amount>"; - // - // + disp intpaid+fees */ +/* // Actual Code: + + float amount; + float intRate; + int fees; + float intPaid; + + cout << "Enter amount of loan requested (between $100 and $1000): "; + cin >> amount; + if (amount >= 100 && amount <= 1000) + { + cout << "Enter interest Rate between 1 and 18 %: "; + cin >> intRate; + if (intRate >= 1 && intRate <= 18) + { + if (amount <= 500) + { + fees = 20; + } + else + fees = 25; - + intPaid = amount * intRate/100; + cout << "\nLoan requested: $" << amount; + cout << "\nInterest Rate: " << intRate << "%"; + cout << "\nInterest and fees: $" << fees+intPaid<<"\n"; + } + else cout << "<You have entered an invalid interest rate>"; + } + + else cout << "<You have entered an invaled loan amount>"; +*/ + +/* //////////////////////////////////////////////////////////////////////////////////////////////////////////////// + 6.5 (1 thru 5) p126 + + int a = 10; + int b = 20; + int c = 30; + ` //(Converted expressions) + a += 25; + b *= (a*2) + b += 1 + c %= 5 + b /= a + +*/ +/* ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + 8.2_1 p177 +*/ +/* ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + 8.3_1 p179 +*/ +/* ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + 8.4_1 p184 +*/ +/* ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + 8.10_3 p192 +*/ + + + + + + + + @@ -190,5 +228,11 @@ int main() + + + + + + return 0; } |