diff options
| author | BensProgramma <[email protected]> | 2021-10-19 19:11:30 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-10-19 19:11:30 -0700 |
| commit | 4cbde5dd1cdff2a05a2515e2c450596659d7f43d (patch) | |
| tree | 190f12a314386d9fc41d60c06ccb919952775c32 | |
| parent | Delete Runs From Lab3.txt (diff) | |
| download | cst116-lab3-bensprogramma-4cbde5dd1cdff2a05a2515e2c450596659d7f43d.tar.xz cst116-lab3-bensprogramma-4cbde5dd1cdff2a05a2515e2c450596659d7f43d.zip | |
Add files via upload
These are my final drafts for the Lab3 submission.:
CST116_Lab3_Schroeder.cpp
Runs From Lab3.txt
I will delete the other copies, as they got corrupted or something.
| -rw-r--r-- | CST116F2021-Lab3/CST116_Lab3_Schroeder.cpp | 313 | ||||
| -rw-r--r-- | CST116F2021-Lab3/Runs From Lab3.txt | 233 |
2 files changed, 546 insertions, 0 deletions
diff --git a/CST116F2021-Lab3/CST116_Lab3_Schroeder.cpp b/CST116F2021-Lab3/CST116_Lab3_Schroeder.cpp new file mode 100644 index 0000000..761c6eb --- /dev/null +++ b/CST116F2021-Lab3/CST116_Lab3_Schroeder.cpp @@ -0,0 +1,313 @@ +// CST116_Lab3_Shcroeder.cpp : This file contains the 'main' function. Program execution begins and ends there.
+//
+
+#include <iostream>
+using namespace std;
+
+
+int main()
+{
+///* ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// 6.4 p126 */
+//
+//
+// int a = 0;
+// cout << a++ << endl;
+// cout << ++a << endl;
+// cout << a + 1 << endl;
+// cout << a << endl;
+// cout << --a << endl;
+//
+//
+//
+//
+//
+///* /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// p148 7.1 1 thru 6 */
+//
+// int int_exp1 = 0;
+// int int_exp2 = 1;
+// char char_exp = 'B';
+//
+// int_exp1 >= int_exp2; // put great than sign before = to correct it
+// int_exp1 == int_exp2; // made it a == sign
+// int_exp1 != int_exp2; // explamation should be before =
+// char_exp == 'A'; // should have single quote for char
+// int_exp1 > char_exp; // trying to compare an int to a char
+// int_exp1 < 2 && int_exp1 > -10 // needs to nhave the variable in the second comparison
+//
+//
+///* ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// p155 7.2 bank level of membership program */
+//
+// 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 (dollars): ";
+// cin >> Amount;
+//
+// if (Amount >= 25000)
+// {
+// cout << "\nPlatinum Member\n\n";
+// }
+// else if (Amount > 10000 && Amount <=25000 && numAccounts == 2)
+// {
+// cout << "\nGold Member\n\n";
+// }
+// else if (Amount > 10000 && numAccounts == 1)
+// {
+// cout << "\nSilver Member\n\n";
+// }
+// else
+// cout << "\nCopper Member\n\n";
+//
+//
+//
+//
+//
+//
+//
+//
+///* ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// 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;
+//
+//
+//
+//
+//
+//
+///* /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// 7.10 #2 p168 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 pertinent 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
+// */
+//
+/////// Actual Code: ///////////////////////////////////////////////
+//
+// 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>";
+//
+//
+///* ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// 6.5 (1 thru 5) p126 */
+//
+// int a = 10;
+// int b = 20;
+// int c = 30;
+// ` //(Converted expressions)
+// a += 25;
+// b *= (a*2)
+// b += 1
+// c %= 5
+// b /= a
+//
+//
+//
+//
+///* /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// 8.2_1 p177 count down by even integers using for loop */
+//
+//
+// int opt;
+// cout << "give me a integer between 0 nd 50: ";
+// cin >> opt;
+// if (opt%2==1)
+// {
+// opt = opt-1;
+// }
+// else
+// opt = opt;
+//
+// for (int i=opt; i >= 0; i--)
+// {
+// cout << i << endl;
+// i--;
+//
+// }
+//
+//
+//
+///* //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// 8.3_1 p179 count down by even integers using do-while loop */
+// int opt;
+// do
+// {
+// do
+// {
+// cout << "give me a integer between 0 nd 50: ";
+// cin >> opt;
+// } while (opt > 50);
+// } while (opt < 0);
+//
+// if (opt%2==1) // check to see if the number given is odd or even
+// {
+// opt = opt-1;
+// }
+//
+// for (int i=opt; i >= 0; i--)
+// {
+// cout << i << endl;
+// i--;
+//
+// }
+//
+//
+//
+//
+//
+///* /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// 8.4_1 AND/OR 8.4_2 p184 I DID 8.4_2 The Star Triangle */
+//
+///* //IN CLASS EXAMPLE 8.4_1 (Prof. Chamberlin did this one in class)
+//
+// int totalLabs = 0, totalScores = 0;
+/
+// cout << "Enter the number of labs: ";
+// cin >> totalLabs;
+//
+// if (totalLabs <= 0)
+// {
+// cout << "No labs recorded.\n";
+// return 0;
+// }
+//
+// for (int i= 1;i <= totalLabs; i++)
+// {
+// int scoreIn = 0;
+// cout << "Enter the score for labs " << i << " :";
+// cin >> scoreIn;
+// totalScores += scoreIn;
+// }
+// float averageLabs = float(totalScores) / float(totalLabs);
+// cout << "The average of the " << totalLabs << " labs entered is: " << averageLabs;
+// */
+///* //////////////////////////////////////////////////////////////////////////////////////////////
+// 8.4_2 p184 Star Triangle */
+// int num = 0;
+// cout<< "Enter an integer for the number of stars in the base of the triangle: ";
+// cin >> num;
+//
+// for (int row = 0;row < num;row++)
+// {
+// for (int col = row; col < num; col++)
+// cout << "* ";
+// cout << endl;
+//
+// }
+//
+//
+//
+///* /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// 8.10_3 p192 Fibonacci Sequence */
+//
+// int x1 = 0, x2 = 1, now = 0, num;
+//
+// cout << "Enter the number you wish the fibonacci sequence to go to (positive integer): ";
+// cin >> num;
+//
+// // displays the first two terms which is always 0 and 1
+// cout << "\nFibonacci Series (no greater than "<<num<< "): \n\t" << x1 << " \n\t" << x2 << " \n\t";
+//
+// now = x1 + x2;
+//
+// while (now <= num)
+// {
+// cout << now << "\n\t";
+// x1 = x2;
+// x2 = now;
+// now = x1 + x2;
+// }
+//
+//
+//
+//
+
+ return 0;
+}
+
diff --git a/CST116F2021-Lab3/Runs From Lab3.txt b/CST116F2021-Lab3/Runs From Lab3.txt new file mode 100644 index 0000000..06152f5 --- /dev/null +++ b/CST116F2021-Lab3/Runs From Lab3.txt @@ -0,0 +1,233 @@ +These are the text outputs from the Lab3 Exercises Author: Benjamin Schroeder
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+Output from 6.4 p126
+
+0
+2
+3
+2
+1
+
+C:\Users\Lenovo\Source\Repos\cst116-lab3-BensProgramma\x64\Debug\CST116F2021-Lab3.exe (process 17068) exited with code 0.
+To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops.
+Press any key to close this window . . .
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+Corrections from 7.1 1 thru 6 p148
+//
+// int int_exp1 = 0;
+// int int_exp2 = 1;
+// char char_exp = 'B';
+//
+// int_exp1 >= int_exp2; // put great than sign before = to correct it
+// int_exp1 == int_exp2; // made it a == sign
+// int_exp1 != int_exp2; // explamation should be before =
+// char_exp == 'A'; // should have single quote for char
+// int_exp1 > char_exp; // trying to compare an int to a char
+// int_exp1 < 2 && int_exp1 > -10 // needs to nhave the variable in the second comparison
+//
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+Run from 7.2_1 p155 (several runs)
+
+(run 1)
+ Bank Membership Staus
+How many accounts does the member have? (1 or 2): 2
+
+Enter total amount the member has in all accounts (dollars): 9000
+
+Copper Member
+
+
+C:\Users\Lenovo\Source\Repos\cst116-lab3-BensProgramma\x64\Debug\CST116F2021-Lab3.exe (process 9592) exited with code 0.
+To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops.
+Press any key to close this window . . .
+
+
+(run 2)
+ Bank Membership Staus
+How many accounts does the member have? (1 or 2): 1
+
+Enter total amount the member has in all accounts (dollars): 45000
+
+Platinum Member
+
+
+C:\Users\Lenovo\Source\Repos\cst116-lab3-BensProgramma\x64\Debug\CST116F2021-Lab3.exe (process 11708) exited with code 0.
+To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops.
+Press any key to close this window . . .
+
+
+(run3)
+ Bank Membership Staus
+How many accounts does the member have? (1 or 2): 2
+
+Enter total amount the member has in all accounts (dollars): 12000
+
+Gold Member
+
+
+C:\Users\Lenovo\Source\Repos\cst116-lab3-BensProgramma\x64\Debug\CST116F2021-Lab3.exe (process 4268) exited with code 0.
+To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops.
+Press any key to close this window . . .
+
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+Run from 7.4_1 p161
+
+ Student Grade Program
+ -Main Menu-
+
+ 1. Enter name
+ 2. Enter test scores
+ 3. Display test scores
+ 4. Exit
+
+Please enter your choice from the list above: 2
+Enter test scores
+
+C:\Users\Lenovo\Source\Repos\cst116-lab3-BensProgramma\x64\Debug\CST116F2021-Lab3.exe (process 2840) exited with code 0.
+To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops.
+Press any key to close this window . . .
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+Run from 7.10_2 p168
+
+
+Enter amount of loan requested (between $100 and $1000): 250
+Enter interest Rate between 1 and 18 %: 2.5
+
+Loan requested: $250
+Interest Rate: 2.5%
+Interest and fees: $26.25
+
+C:\Users\Lenovo\Source\Repos\cst116-lab3-BensProgramma\x64\Debug\CST116F2021-Lab3.exe (process 5524) exited with code 0.
+To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops.
+Press any key to close this window . . .
+
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+Run from 8.2_1 p177 Count down even integer from user input integer
+
+give me a integer between 0 nd 50: 49
+48
+46
+44
+42
+40
+38
+36
+34
+32
+30
+28
+26
+24
+22
+20
+18
+16
+14
+12
+10
+8
+6
+4
+2
+0
+
+C:\Users\Lenovo\source\repos\CST116_Lab3_Schroeder\Debug\CST116_Lab3_Schroeder.exe (process 20668) exited with code 0.
+To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops.
+Press any key to close this window . . .
+
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+Run from 8.3_1 p179 Count down by even integers w/ do-while loop to varify valid input
+
+give me a integer between 0 nd 50: 55
+give me a integer between 0 nd 50: 49
+48
+46
+44
+42
+40
+38
+36
+34
+32
+30
+28
+26
+24
+22
+20
+18
+16
+14
+12
+10
+8
+6
+4
+2
+0
+
+C:\Users\Lenovo\source\repos\CST116_Lab3_Schroeder\Debug\CST116_Lab3_Schroeder.exe (process 11492) exited with code 0.
+To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops.
+Press any key to close this window . . .
+
+
+
+
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+Run from 8.4_2 p184
+
+Enter an integer for the number of stars in the base of the triangle: 11
+* * * * * * * * * * *
+* * * * * * * * * *
+* * * * * * * * *
+* * * * * * * *
+* * * * * * *
+* * * * * *
+* * * * *
+* * * *
+* * *
+* *
+*
+
+C:\Users\Lenovo\source\repos\CST116_Lab3_Schroeder\Debug\CST116_Lab3_Schroeder.exe (process 10272) exited with code 0.
+To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops.
+Press any key to close this window . . .
+
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+Run from 8.10_3 p192
+
+Enter the number you wish the fibonacci sequence to go to (positive integer): 615
+
+Fibonacci Series (no greater than 615):
+ 0
+ 1
+ 1
+ 2
+ 3
+ 5
+ 8
+ 13
+ 21
+ 34
+ 55
+ 89
+ 144
+ 233
+ 377
+ 610
+
+C:\Users\Lenovo\source\repos\CST116_Lab3_Schroeder\Debug\CST116_Lab3_Schroeder.exe (process 19152) exited with code 0.
+To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops.
+Press any key to close this window . . .
|