Code:
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
void choice(string game, string edition);
double math(string game, string edition, int Standard, int Deluxe, int Legacy, int Collectors, int Super);
int main() {
string game;
string edition;
int Standard = 0;
int Deluxe = 0;
int Legacy = 0;
int Collectors = 0;
int Super = 0;
char Buy = 'Y';
while (Buy == 'Y') {
cout << "Would you like to buy a game? " << endl;
cin >> Buy;
if (Buy == 'Y')
choice(game, edition);
if (edition == "Standard Edition") {
Standard++;
cout << "You have chosen Standard Edition." << endl;
}
else if (edition == "Deluxe Edition") {
Deluxe++;
cout << "You have chosen Deluxe Edition." << endl;
}
else if (edition == "Legacy Edition") {
Legacy++;
cout << "You have chosen Legacy Edition" << endl << endl;
}
else if (edition == "Collector's Edition") {
Collectors++;
cout << "You have chosen Collector's Edition" << endl;
}
else if (edition == "Super Duper Awesome Edition") {
Super++;
cout << "You have chosen Super Duper Awesome Edition." << endl;
}
else if (Buy == 'N')
cout << "Your total is: " << math(game, edition, Standard, Deluxe, Legacy, Collectors, Super) << endl;
cout << "Have a nice day!" << endl;
cout << Standard << endl;
}
system("pause");
return 0;
}
void choice(string game, string edition)
{
cout << "Your choices are as Follows: " << endl;
cout << "Call of Duty: Alamo in Space: " << endl;
cout << "Halo 6: " << endl;
cout << "Battlefront 3: Ewok Adbentures: " << endl;
cout << "Batman The Killing Joke: " << endl;
cout << "Mario vs. Luigi Civil War: " << endl;
cin.ignore();
getline(cin, game);
if (game == "Call of Duty: Alamo in Space")
{
cout << "Which edition would you like to buy: " << endl;
cout << "Standard Edition" << endl;
cout << "Deluxe Edition" << endl;
cout << "Legacy Edition" << endl;
cout << "Collector's Edition" << endl;
cout << "Super Duper Awesome Edition" << endl;
}
else if (game == "Halo 6")
{
cout << "Which edition would you like to buy: " << endl;
cout << "Standard Edition" << endl;
cout << "Deluxe Edition" << endl;
cout << "Legacy Edition" << endl;
cout << "Collector's Edition" << endl;
cout << "Super Duper Awesome Edition" << endl;
}
else if (game == "Battlefront 3: Ewok Adbentures")
{
cout << "Which edition would you like to buy: " << endl;
cout << "Standard Edition" << endl;
cout << "Deluxe Edition" << endl;
cout << "Legacy Edition" << endl;
cout << "Collector's Edition" << endl;
cout << "Super Duper Awesome Edition" << endl;
}
else if (game == "Batman The Killing Joke")
{
cout << "Which edition would you like to buy: " << endl;
cout << "Standard Edition" << endl;
cout << "Deluxe Edition" << endl;
cout << "Legacy Edition" << endl;
cout << "Collector's Edition" << endl;
}
else if (game == "Mario vs. Luigi Civil War")
{
cout << "Which edition would you like to buy: " << endl;
cout << "Standard Edition" << endl;
cout << "Deluxe Edition" << endl;
cout << "Legacy Edition" << endl;
cout << "Collector's Edition" << endl;
}
getline(cin, edition);
}
double math(string game, string edition, int Standard, int Deluxe, int Legacy, int Collectors, int Super) {
double TpriceofStandard = Standard * 59.99;
double TpriceofDeluxe = Deluxe * 69.99;
double TpriceofLegacy = Legacy * 79.99;
double TpriceofCollectors = Collectors * 99.99;
double TpriceofSuper = Super * 120;
double subtotal;
double total;
subtotal = (TpriceofStandard + TpriceofDeluxe + TpriceofLegacy + TpriceofCollectors + TpriceofSuper);
total = subtotal * .06;
return total;
}