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
|
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
//void treasury(long int &M);
//void game(string &PN, string &CN, long int &M, long int &HC, double &TXR);
//void save(string &PN, string &CN, long int &M, long int &HC, double &TXR);
//void NatManager(long int &M, long int &HC, double &TXR);
//void MnthDeduct(long int &M, long int &HC, double &TXR);
class SetUp
{
private:
long int money;
string Pname;
string Cname;
long int hCare;
double taxRate;
public:
SetUp(long int M, string PN, string CN, long int HC, double TXR):
money(M), Pname(PN), Cname(CN), hCare(HC), taxRate(TXR){}
};
void treasury();
void game();
void save();
void NatManager();
void MnthDeduct();
int main()
{
int choice;
//long int money = 1000000000;
//string Pname;
//string Cname;
//long int hCare = 24;
//double taxRate = 35;
SetUp SO;
cout << "1) New" << endl;
cout << "2) Load" << endl;
cin >> choice;
switch(choice)
{
case 1:
{
cin.sync();
cout << "Welcome please enter your name" << endl;
getline(cin, Pname);
cout << "\n";
cin.sync();
cout << "Thank you " << Pname << " now please enter your countries name." << endl;
getline(cin, Cname);
cout << "Welcome " << Pname << " to " << Cname << endl;
cout << "Press ENTER to continue\n" << endl;
cin.get();
save(Pname, Cname, money, hCare, taxRate);
}
break;
case 2:
{
ifstream file("President.txt");
getline(file, Pname);
getline(file, Cname);
file >> money;
file >> hCare;
file >> taxRate;
game(Pname,Cname,money,hCare,taxRate);
}
break;
default:
cout << "Error" << endl;
}
}
void game()
{
int choice;
cout << "What will you do?\n" << endl;
cout << "1) Go to Treasury" << endl;
cout << "2) Go to Nation Manager" << endl;
cout << "3) View monthly deductions and earnings" << endl;
cout << "4) Save" << endl;
cin >> choice;
switch(choice)
{
case 1:
treasury();
break;
case 2:
NatManager();
break;
case 3:
MnthDeduct();
break;
case 4:
save();
break;
}
}
void treasury()
{
cout << "NATIONAL TREASURY\n" << endl;
cout << "Current money in treasury: " << M << endl;
}
void save()
{
ofstream file;
file.open("President.txt");
file << PN << endl;
file << CN << endl;
file << M << endl;
file << HC << endl;
file << TXR << endl;
file.close();
return game();
}
void NatManager()
{
int choice;
long int healC = 0;
double taxR = 0;
cout << "What do you want to do here?\n" << endl;
cout << "1) Modify Healthcare" << endl;
cout << "2) Modify Taxes" << endl;
cout << "3) Pass/veto bills" << endl;
cin >> choice;
cout << "\n";
switch(choice)
{
case 1:
cout << "MODIFY HEALTHCARE\n" << endl;
cout << "Current Healthcare budget: $" << HC << endl;
cout << "What would you like to change the budget to?" << endl;
cout << "Current Government Budget: $" << M << endl;
cin >> healC;
if(healC < M)
{
HC = healC;
cout << "\n";
cout << "Ok current Healthcare budget is set to: $" << HC << endl;
cout << "Current National budget: $" << M - healC << endl;
}
else if(healC > M)
{
cout << "Thats more money than you have!" << endl;
}
break;
case 2:
cout << "MODIFY TAXES\n" << endl;
cout << "Current Tax Rate: %" << TXR << endl;
cout << "What would you like to change the Tax Rate to?" << endl;
cin >> taxR;
cout << "\n";
TXR = taxR;
cout << "Ok the current tax rate is now: %" << TXR << endl;
break;
case 3:
cout << "PASS/VETO BILLS\n" << endl;
cout << "CURRENT BILL LIST\n" << endl;
cout << "" << endl;
}
}
void MnthDeduct()
{
cout << "MONTHLY DEDUCTIONS AND EARNINGS\n" << endl;
cout << "DEDUCTIONS\n" << endl;
cout << "Current Money: $" << M << endl;
cout << "Current Taxes: %" << TXR << endl;
cout << "Current Health Care Budget: $" << HC << endl;
}
|