diff options
Diffstat (limited to 'CST116F2021-Lab3/CST116F2021-Lab3.cpp')
| -rw-r--r-- | CST116F2021-Lab3/CST116F2021-Lab3.cpp | 151 |
1 files changed, 120 insertions, 31 deletions
diff --git a/CST116F2021-Lab3/CST116F2021-Lab3.cpp b/CST116F2021-Lab3/CST116F2021-Lab3.cpp index 98f3d27..530d182 100644 --- a/CST116F2021-Lab3/CST116F2021-Lab3.cpp +++ b/CST116F2021-Lab3/CST116F2021-Lab3.cpp @@ -6,7 +6,7 @@ using namespace std; int main() -{ +{ // p126 6.4 // int a = 0; @@ -64,43 +64,132 @@ int main() ?Exit Display �E�*/ + /*int numAccounts; + float Amount; + double plat; + double gold; + double copp; + double silv; + + cout << "\t\tBank Membership Staus\n"; + cout << "How many accounts does the member have? (1 or 2): "; + cin >> numAccounts; + cout << "\nEnter total amount the member has in all accounts: "; + cin >> Amount; + + if ()*/ + + + + + + //// p161 7.4 #1 case statement + // short choice; + + // cout << "\t Student Grade Program\n"; + // cout << "\t\t -Main Menu-\n\n"; + // cout << "\t1. Enter name\n"; + // cout << "\t2. Enter test scores\n"; + // cout << "\t3. Display test scores\n"; + // cout << "\t4. Exit\n\n"; + // cout << "Please enter your choice from the list above: "; + // cin >> choice; + + // switch (choice) + // { + // case 1: + // cout << "Enter name"<< endl; + // break; + // case 2: + // cout << "Enter test scores" << endl; + // break; + // case 3: + // cout << "Display test scores" << endl; + // break; + // case 4: + // cout << "Exit" << endl; + // break; + // default: + // cout << "Invalid Choice" << endl; + + + // return 0; + + + + + + + // p168 7.10 #2 problem solving steps + /* 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 + Psuedo code: + 1) get loan amount + 2) check to see if the loan amount falls between $100 and $1000 + if so use this loan Amount if not, ask for a valid loan amount + 3) get interest rate + 4) check to see if interest rate is between 1 and 18% + if so, use interest rate if not, ask for a valid interest rate + + 5) Sort out fees and interest + if loan between 100 to 500 -> fees = 20, interest = interest + if loan greater than 500 -> fees = 25, interest = interest + 6) Calculate the paid on loan + intpaid = loan*interest + 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>"; + + + - // p161 7.4 #1 case statement - short choice; - cout << "\t Student Grade Program\n"; - cout << "\t\t -Main Menu-\n\n"; - cout << "\t1. Enter name\n"; - cout << "\t2. Enter test scores\n"; - cout << "\t3. Display test scores\n"; - cout << "\t4. Exit\n\n"; - cout << "Please enter your choice from the list above: "; - cin >> choice; - switch (choice) - { - case 1: - cout << "Enter name"<< endl; - break; - case 2: - cout << "Enter test scores" << endl; - break; - case 3: - cout << "Display test scores" << endl; - break; - case 4: - cout << "Exit" << endl; - break; - default: - cout << "Invalid Choice" << endl; - - - return 0; - } + + + + + + |