diff options
| author | Joseph Ten Eyck <[email protected]> | 2021-10-19 21:15:42 -0700 |
|---|---|---|
| committer | Joseph Ten Eyck <[email protected]> | 2021-10-19 21:15:42 -0700 |
| commit | de730bdaa56390e27feaa0a1d53aaa63ae1f7db1 (patch) | |
| tree | 7707a2efc7effda6163f44980c57bac0b611f522 /CST116F2021-Lab3/Joseph Ten Eyck-Lab3.cpp | |
| parent | Add online IDE url (diff) | |
| download | cst116-lab3-josephteneyck-master.tar.xz cst116-lab3-josephteneyck-master.zip | |
Lab 3 Homework. Some problems are in the .doc file. Most code is in the .cpp file. Successful runs are in the .txt file.HEADmaster
Diffstat (limited to 'CST116F2021-Lab3/Joseph Ten Eyck-Lab3.cpp')
| -rw-r--r-- | CST116F2021-Lab3/Joseph Ten Eyck-Lab3.cpp | 312 |
1 files changed, 312 insertions, 0 deletions
diff --git a/CST116F2021-Lab3/Joseph Ten Eyck-Lab3.cpp b/CST116F2021-Lab3/Joseph Ten Eyck-Lab3.cpp new file mode 100644 index 0000000..3830faf --- /dev/null +++ b/CST116F2021-Lab3/Joseph Ten Eyck-Lab3.cpp @@ -0,0 +1,312 @@ +//====================================================== +//= CODE FOR PROBLEM #1 ON PAGE 161 IS BELOW = +//====================================================== +// +//#include <iostream> <iomanip> +// +//using std::cout; +//using std::cin; +//using std::endl; +// +//int main() +//{ +// short choice; +// +// cout << "\t\t\tStudent Grade Program"; +// cout << "\n\t\t\t - Main Menu -"; +// cout << "\n\n\t\t1. Enter Name"; +// cout << "\n\t\t2. Enter test scores"; +// cout << "\n\t\t3. Display test scores"; +// cout << "\n\t\t9. Exit"; +// cout << "\n\n\tPlease enter your choice from the list above: "; +// +// cin >> choice; +// +// switch (choice) +// { +// case 1: +// cout << "\n\tYou chose: Enter name" << endl; +// break; +// case 2: +// cout << "\n\tYou chose: Enter test scores" << endl; +// break; +// case 3: +// cout << "\n\tYou chose: Display test scores" << endl; +// break; +// case 9: +// cout << "\n\tYou chose: Exit" << endl; +// break; +// default: +// cout << "\n\tMenu choice does not exist" << endl; +// +// } +// +// return 0; +//} + + +//====================================================== +//= CODE FOR PROBLEM #2 ON PAGE 168 IS BELOW = +//====================================================== + +//#include <iostream> +// +//using std::cout; +//using std::cin; +//using std::endl; +// +//int main() +//{ +// +// float rate, +// loan_amount, +// interest_amount, +// interest_and_fees, +// total_cost; +// +// short fee = 0; +// +// +// cout << "\t\t =========================\n"; +// cout << "\t\t\t= Loan Calculator ="; +// cout << "\n\t\t =========================\n"; +// +// cout << "\n\n\t\tEnter loan amount: "; +// cin >> loan_amount; +// +// cout << "\n\t\tEnter loan rate percent: "; +// cin >> rate; +// +// +// if (rate < 1 || rate > 18) +// { +// cout << "\n\n\tERROR: Interest rate is not between 1% and 18%" << endl; +// } +// +// else if (loan_amount < 100 || loan_amount > 1000) +// { +// cout << "\n\n\tERROR: Loan amount is not between $100 and $1,000" << endl; +// } +// +// else +// { +// +// if (loan_amount <= 500) +// fee = 20; +// +// else +// fee = 25; +// +// +// interest_amount = loan_amount * rate * 0.01; +// +// interest_and_fees = interest_amount + fee; +// +// total_cost = loan_amount + interest_and_fees; +// +// +// cout << "\n\n\tRequested loan amount: $" << loan_amount; +// cout << "\n\tInterest rate: " << rate << "%"; +// cout << "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"; +// cout << "\n\tInterest amount: $" << interest_amount; +// cout << "\n\tFee: $" << fee; +// cout << "\n\n\tSum of interst and fees: $" << interest_and_fees; +// cout << "\n\n================================================================"; +// cout << "\n\tTotal Cost: $" << total_cost << "\n\n"; +// } +// +// +// return 0; +//} + + +//====================================================== +//= CODE FOR PROBLEM #1 ON PAGE 177 IS BELOW = +//====================================================== + +//#include <iostream> +// +//using std::cout; +//using std::cin; +//using std::endl; +// +//int main() +//{ +// +// int number = 0; +// +// cout << "\n\tEnter an integer between 1 and 50: "; +// cin >> number; +// +// cout << "\n"; +// +// if (number < 1 || number > 50) +// cout << "\nERROR: Number must be between 1 and 50\n\n"; +// +// else +// { +// cout << number << " "; +// +// while (number > 0) +// { +// --number; +// +// if (number % 2 == 0) +// cout << number << " "; +// +// else +// cout << " "; +// +// } +// cout << "\n\n" << endl; +// } +// +// return 0; +//} + + +//====================================================== +//= CODE FOR PROBLEM #1 ON PAGE 179 IS BELOW = +//====================================================== + +//#include <iostream> +// +//using std::cout; +//using std::cin; +//using std::endl; +// +//int main() +//{ +// int number = 0; +// +// cout << "\n\tEnter an integer between 1 and 50: "; +// cin >> number; +// +// cout << "\n"; +// +// +// do +// if (number < 1 || number > 50) +// { +// cout << "\n\nERROR: Number must be between 1 and 50\n"; +// +// cout << "\n\tEnter an integer betwen 1 and 50: "; +// cin >> number; +// +// cout << "\n"; +// } +// else +// cout << "\n\n"; +// while (number < 1 || number > 50); +// +// +// cout << number << " "; +// +// while (number > 0) +// { +// --number; +// +// if (number % 2 == 0) +// cout << number << " "; +// +// else +// cout << " "; +// +// } +// cout << "\n\n" << endl; +// +// return 0; +//} + + +//====================================================== +//= CODE FOR PROBLEM #1 ON PAGE 184 IS BELOW = +//====================================================== + +//#include <iostream> +// +//using std::cout; +//using std::cin; +//using std::endl; +// +//int main() +//{ +// +// int assignments = 0; +// int assignments_initial = 0; +// int sum = 0; +// +// cout << "\n\t\tEnter number of assignments: "; +// cin >> assignments; +// +// assignments_initial = assignments; +// +// cout << "\n\n"; +// +// for (assignments; assignments > 0; assignments--) +// { +// int score = 0; +// +// cout << "\tEnter assignment " << assignments << " score: "; +// cin >> score; +// +// cout << "\n"; +// +// sum += score; +// } +// +// float avg = (float)sum / (float)assignments_initial; +// +// cout << "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"; +// cout << "\n\t\tAverage assignment score: " << avg; +// cout << "\n\n" << endl; +// +// return 0; +//} + + +//====================================================== +//= CODE FOR PROBLEM #3 ON PAGE 192 IS BELOW = +//====================================================== + +//#include <iostream> +// +//using std::cout; +//using std::cin; +//using std::endl; +// +//int main() +//{ +// int ending_number = 0; +// int current_number = 1; +// int previous_number = 0; +// int hold = 0; +// +// cout << "\n\t\t=================================="; +// cout << "\n\t\t== Fibonacci sequence generator =="; +// cout << "\n\t\t=================================="; +// cout << "\n\n\t"; +// +// cout << "Enter ending number: "; +// cin >> ending_number; +// +// cout << "\n\n"; +// +// if (ending_number < 1) +// cout << "ERROR: Ending number must be 1 or greater"; +// +// else +// +// while (current_number <= ending_number) +// { +// cout << current_number << " "; +// +// hold = current_number; +// current_number += previous_number; +// previous_number = hold; +// } +// +// cout << endl; +// +// return 0; +//}
\ No newline at end of file |