aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraustinsworld15 <[email protected]>2021-10-19 17:26:20 -0700
committerGitHub <[email protected]>2021-10-19 17:26:20 -0700
commit457926c8dab8d213103f47aebf71646aac8c0b3a (patch)
treea259dabd9beca7f1549f3eff1addfdf6596e09d4
parentAdd files via upload (diff)
downloadcst116-lab3-austinsworld15-457926c8dab8d213103f47aebf71646aac8c0b3a.tar.xz
cst116-lab3-austinsworld15-457926c8dab8d213103f47aebf71646aac8c0b3a.zip
Update CST116F2021-Lab3-Guertin.cpp
-rw-r--r--CST116F2021-Lab3/CST116F2021-Lab3-Guertin.cpp145
1 files changed, 145 insertions, 0 deletions
diff --git a/CST116F2021-Lab3/CST116F2021-Lab3-Guertin.cpp b/CST116F2021-Lab3/CST116F2021-Lab3-Guertin.cpp
index 77b28a7..510dc33 100644
--- a/CST116F2021-Lab3/CST116F2021-Lab3-Guertin.cpp
+++ b/CST116F2021-Lab3/CST116F2021-Lab3-Guertin.cpp
@@ -109,3 +109,148 @@ int main()
}
}
+
+5c 7.10 pg 168 #2
+
+#include <iostream>
+#include<iomanip>
+#include <stdlib.h>
+#include <thread>
+#include <string>
+
+using std::cout;
+using std::endl;
+using std::string;
+int main()
+{
+
+ int loan;
+ float interest{};
+ float percent_interest;
+ float sum_of_interest_and_fees;
+ int fee;
+ string response;
+ string agreement;
+
+ //agreement for margin of acceptance
+
+ cout << "Just to let you know before we start, \nthe parameters for a loan is between $100 and $1000, \nand the parameters for interest rate is between 1% and 18%, \n\nis that okay?\ntype 'y' for yes and 'n' for no\n\n";
+
+ std::cin >> agreement;
+
+ if (agreement == "y")
+ {
+ cout << "\n\nWe will proceed with the questions, then...\n\n";
+ }
+ else if (agreement == "n")
+ {
+ cout << "\n\nThat is unfortunate, I cannot continue this transaction, sorry\n\n";
+ return (0);
+ }
+ else
+ {
+ cout << "Invalid character, try this transaction again\n\n";
+ return (0);
+ }
+
+ //enter the loan amount
+
+ cout << "Enter the loan amount:\n\n";
+ std::cin >> loan;
+
+ if (loan >= 100 && loan <= 1000)
+ {
+ cout << "\nAccepted";
+ }
+ else if (loan <= 100 || loan >= 1000)
+ {
+ cout << "\n\nYou are not elegible for this loan, sorry.\n" << endl;
+ return (0);
+ }
+
+
+
+
+ //enter the interest amount
+ cout << "\n\nEnter the interest amount:\n\n";
+ std::cin >> interest;
+
+ if (interest >= 1 && interest <= 18)
+ {
+ cout << "\nAccepted";
+ }
+ else if (interest <= 1 || interest >= 18)
+ {
+ cout << "\n\nYou are not elegible for this loan, sorry.\n" << endl;
+ return (0);
+ }
+
+
+
+ cout << "\n\nWe will now calculate your interest and fees";
+
+
+
+ cout << "\n\n...";
+
+ percent_interest = interest / 100;
+
+ if (loan >= 100 && loan <= 500)
+ {
+ fee = 20;
+ }
+ else if (loan > 500)
+ {
+ fee = 25;
+ }
+
+
+ //calculate interest and fees
+
+ sum_of_interest_and_fees = loan + (loan * percent_interest) + fee;
+
+ cout << "\n\nHere is a summary of the calculations and data you have given us:";
+
+ cout << "\n\nYou are asking for a loan of $" <<loan<< ",";
+
+ cout << "\n\nYou have an interest rate of %" << interest << ",";
+
+ cout << "\n\nSince you are borrowing $" << loan << ", there is a fee of $" << fee<< " added on";
+
+ cout << "\n\nSo the sum of the interest and fees will bill you $" << sum_of_interest_and_fees;
+
+ cout << "\n\nDoes this seem right?? Type 'y' for yes, and 'n' for no\n\n";
+
+ std::cin >> response;
+
+ if (response == "y")
+ {
+ cout << "\n\nThank you for your business.\n\n";
+ return (0);
+ }
+ else if (response == "n")
+ {
+ cout << "\n\nWell that kind of sucks, I don't know what to tell you.\n\n";
+ return (0);
+ }
+ else
+ {
+ cout << "\n\nInvalid character, try this transaction again\n\n";
+ return (0);
+ }
+}
+
+6a 6.5 pg 126-127 #1-5
+
+1. a += 25;
+2. b *= a * 2;
+3. b += 1;
+4. c %= 5
+5. b /= a
+
+8.2 pg 177 #1
+
+1.
+
+
+