aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWiserJ <[email protected]>2021-10-13 16:45:34 -0700
committerWiserJ <[email protected]>2021-10-13 16:45:34 -0700
commitf17e94b71d0efb642960a625f0eff3bef3a32c9c (patch)
treea5c287470d857c4f19ac1a87cba7d057277fc758
parenta (diff)
downloadcst116-lab3-jeffwoit-f17e94b71d0efb642960a625f0eff3bef3a32c9c.tar.xz
cst116-lab3-jeffwoit-f17e94b71d0efb642960a625f0eff3bef3a32c9c.zip
b
-rw-r--r--CST116F2021-Lab3/CST116F2021-Lab3.cpp38
1 files changed, 37 insertions, 1 deletions
diff --git a/CST116F2021-Lab3/CST116F2021-Lab3.cpp b/CST116F2021-Lab3/CST116F2021-Lab3.cpp
index 1743e86..c3309a4 100644
--- a/CST116F2021-Lab3/CST116F2021-Lab3.cpp
+++ b/CST116F2021-Lab3/CST116F2021-Lab3.cpp
@@ -26,9 +26,45 @@ int main()
int fees = 0;
float sum = 0;
- cout <<
+ cout << "Please input the loan amount from 100 to 1,000 dollars: ";
+ cin >> loan;
+ if (loan >= 100 && loan <= 1000)
+ cout << "Please input the percent interest rate: ";
+ else
+ {
+ cout << "\nInvalid response. Ending program.";
+ return 1;
+ }
+
+ cin >> rate;
+
+ if (rate >= 1 && rate <= 18)
+ cout << "\nYour loan is for $" << loan << " at " << rate << "% interest.";
+ else
+ {
+ cout << "\nInvalid response. Ending program.";
+ return 2;
+ }
+
+ if (loan >= 100 && loan <= 500)
+ {
+ cout << "\nThere is a fee of $20 for a loan of this value.\n";
+ fees = 20;
+ }
+ else
+ {
+ cout << "\nThere is a fee of $25 for a loan of this value.\n";
+ fees = 25;
+ }
+
+ interest = loan * (rate/100);
+ sum = interest + fees;
+
+ cout << "\nYou have chosen a loan of $" << loan << " at an interest rate of " << rate << "%.\n";
+ cout << "Your interest and fees come to a total of $" << sum << ".\n";
+ return 0;