#include using namespace std; int main() { /* int sel; cout << "\t Student Grade Program\n" << "\t\t - Main Menu -\n\n"; cout << "\t1. Enter name\n" << "\t2. Enter test scores\n" << "\t3. Display test scores\n" << "\t9. Exit\n\n"; cout << "Please enter your choice from the list above : "; cin >> sel; switch (sel) { case 1: cout << "\nSelected to enter name.\n"; break; case 2: cout << "\nSelected to enter test scores.\n"; break; case 3: cout << "\nSelected to display test scores.\n"; break; default: cout << "\nExiting Program.\n"; } cout << "\nRedirecting. . .\n"; */ //Set Variables /*float rate; float amount; float interest; int fee; float total; //Get Variables cout << "Enter loan amount: "; cin >> amount; cout << "Enter interest rate: "; cin >> rate; //Validate if (rate <= 0 || rate > 18) { cout << "Not a valid interest rate.\n"; return -1; } if (amount < 100 || amount > 1000) { cout << "Not a valid loan amount.\n"; return -2; } //Calc if (amount <= 500 && amount > 100) fee = 20; else if (amount > 500 && amount <= 1000) fee = 25; else { cout << "Error calculating fee.\n"; return -3; } interest = amount * (rate / 100); total = interest + fee; //print cout << "The loan has an amount of: " << amount << " and an interest rate of " << rate << endl << "The total payment of interest and fees is: " << total << endl;*/ // 7.2 #1 /* // Account Varibles float money; int accounts; // Switch Operator int sel; // Set Varibles cout << "Number of accounts: "; cin >> accounts; cout << "Total money: "; cin >> money; // Calc if (money >= 25000) sel = 1; if (money < 25000 && accounts > 1) sel = 2; if (money < 25000 && accounts == 1) sel = 3; if (money <= 10000) sel = 4; if (money <= 0 || accounts <= 0) sel = 0; cout <<"\n\n"; // Output switch (sel) { case 1: cout << "The membership level is Platinum with $" << money << " dollars and " << accounts; if (accounts = 1) cout << " account\n\n"; else cout << " accounts\n\n"; break; case 2: cout << "The membership level is Gold with $" << money << " dollars and " << accounts; if (accounts = 1) cout << " account\n\n"; else cout << " accounts\n\n"; break; case 3: cout << "The membership level is Silver with $" << money << " dollars and " << accounts; if (accounts = 1) cout << " account\n\n"; else cout << " accounts\n\n"; break; case 4: cout << "The membership level is Copper with $" << money; if (money > 1) cout << " dollars and " << accounts; else if (money < 1) cout << " cents and " << accounts; else cout << " dollar and " << accounts; if (accounts = 1) cout << " account\n\n"; else cout << " accounts\n\n"; break; default: cout << "Something went wrong. Neither the number of accounts or amount of money can be 0 or negative.\n\n"; } */ // 8.2 /* int in; cout << "Enter a number 1-50: "; cin >> in; if (in < 1) { cout << "Number cannot be 0 or negative"; return -1; } if (in > 50) { cout << "Number cannot be greater than 50"; return -2; } for (int c = in; c > 0; c--) { cout << c << ' '; if (c % 10 == 1) cout << endl; }*/ // 8.3 /* int in; cout << "Enter a number 1-50: "; cin >> in; if (in < 1) { cout << "Number cannot be 0 or negative"; return -1; } if (in > 50) { cout << "Number cannot be greater than 50"; return -2; } do { cout << in << ' '; if (in % 10 == 1) cout << endl; in--; } while (in > 0); */ /* int in; cout << "Enter a number size for the right triangle: "; cin >> in; if (in < 1) { cout << "Number cannot be 0 or negative"; return -1; } for (int h = in; h > 0; h--) { for (int w = h; w > 0; w--) cout << "\* "; cout << endl; } */ // 8.10 int num1 = 0, num2 = 1, num3; int max; cout << "What max number of the Fibonacci sequence would you like to display? "; cin >> max; cout << num1; while (num2 < max) { cout << ", " << num2; //Do the calc and shift the numbers over so calc can be done again. num3 = num1 + num2; num1 = num2; num2 = num3; } return 0; }