aboutsummaryrefslogtreecommitdiff
path: root/CST116F2021-Lab3/CST116F2021-Lab3_Schroeder.cpp
blob: a1f02d489649ad887973795d889a49710a0aa9fe (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
// CST116F2021-Lab3.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

*/


/*  //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	8.3_1   p179

*/

/*  /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	8.4_1  p184

*/

/*  /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	8.10_3   p192

*/
	

					











	





	




		return 0;
}