-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
64 lines (53 loc) · 2.57 KB
/
main.cpp
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
/* --------------------------------- Wheaton College MA - Spring 2024 ---------------------------------*\
* Comp 318, programming project 3
* Sam Hammami '25
* ***************************************************
* Thank you for the great semester, Prof. Tony!
* I learned a lot and enjoyed the class.(Safe travel)
* ***************************************************
*/
#include "changeMaker.h"
#include <iostream>
using namespace std;
/*------------------------------Main Function------------------------------*/
int main() {
// Welcome message
cout << endl << endl << "*** Welcome to the IR$ of Banana Republic! ***" << endl << endl;
// string name = "Poor Patrick"; //For testing purposes: Houssem.H, Poor Patrick, Rich Richard
string name;
cout << "Please enter your name below! " << endl;
cout << "My Name is";
getline(cin, name);
// int taxAmount = 96003; // Test case: 96003, 35000, 296003
int taxAmount;
cout << endl << "What is your tax $$$ due? " << endl;
cout << "My Tax Amount Due = $";
cin >> taxAmount;
// Array of bill denominations
const array<int, 6> denominations = {95000, 32001, 5001, 701, 101, 1};
// Display the greedy and dynamic approaches
cout << endl << "---------------------------------------------------------------" << endl;
displayGreedyApproach(taxAmount, denominations);
cout << "* -------------------------- ***** ------------------------ *" << endl;
displayDynamicApproach(taxAmount, denominations);
cout << "---------------------------------------------------------------" << endl;
// Select Payment Plan
int planChoice = 0;
while (planChoice != 1 && planChoice != 2) { // Validate user input
cout << "Which payment plan do you want to choose (1 or 2)? " << endl;
cout << "Plan: ";
cin >> planChoice;
if (!(!cin.fail() && !(planChoice != 1 && planChoice != 2))) {
cout << "Invalid choice. Please enter 1 or 2." << endl;
planChoice = 0; // Reset choice to force re-entry
}
}
cout << endl << "---------------------------------------------------------------" << endl;
cout << "Dear " << name << "," << endl << endl;
cout << "Thank you for paying your tax ON TIME, you have chosen Plan " << planChoice << "!"<< endl;
cout << "Remember that IR$ of Banana Republic is always here for you." << endl << endl;
cout << "Best Regards, " << endl;
cout << "IR$ Support Team" << endl;
cout << "---------------------------------------------------------------" << endl;
return 0;
}