Question: I need help wrighting this code also there is the code that combos with this assiment but its broken. Chapter 3 Input and Output Required
I need help wrighting this code also there is the code that combos with this assiment but its broken.
Chapter 3 Input and Output Required Programming Project
Using the any store code you wrote in Chapter 2 and the input/output formatting manipulators that you have learned in Chapter 3, enhance your any store program to create a sales ticket that reflects the purchases the customer made. You will need to add some input prompts to capture new information not required in Chapter 2. Your output needs to look very similar to this format. Use the output manipulators we learned in class (left, right, setw, setprecision, etc) and flex based on what the customer is purchasing (not hard-coded). Since we are dealing with money, ensure that your totals only display in dollars and cents (xxxxx.xx), with a maximum of two digits to the right of the decimal point.
The items in italics should flex. The non-italics items are required as shown below. ------------------------------------------------------------------------------------------------------------------------------------------ NAME OF YOUR STORE HERE SALES TICKET CUSTOMER NAME: Last Name DATE: xx/xx/xxxx
_____________________________________________________________________________________ __QUANTITY | _____________ITEM DESCRIPTION | PRICE EACH | TOTAL___ x Description of Your First Item $ xx.xx $ xx.xx
x Description of Your Second Item $ xx.xx $ xx.xx
x Description of Your Third Item $ xx.xx $ xx.xx
x Description of Your Fourth Item $ xx.xx $ xx.xx
x Description of Your Fifth Item $ xx.xx $ xx.xx TOTAL PURCHASE $ xx.xx GOOD STUDENT DISCOUNT (IF APPLICABLE) - x.xx TAX ______x.xx GRAND TOTAL $ xx.xx
THANK FOR YOU SHOPPING AT NAME OF YOUR STORE HERE Please Come Again Soon!
-------------------------------------------------------------------------------------------------
#include
#include
#include
#include
using namespace std;
int main() {
double discount, tax, gs5, gs6, gs7, gs8, gs9;
int quantity1, quantity2, quantity3, quantity4, quantity5, totalitems, total1, total2, total3, total4, total5, items, gpa, item, lasttotal, endtotal;
discount = .002;
tax = .0825;
gs5 = 100.00;
gs6 = 200.00;
gs7 = 300.00;
gs8 = 400.00;
gs9 = 500.00;
ofstream outfile;
ifstream infile;
infile.open("TOCinput.txt");
outfile.open("TOC.txt");
std::cout << "**********************************************************" << std::endl;
std::cout << "* Hello and welcome to You buy We Sell *" << std::endl;
std::cout << "* Here is the list of what we have available and Prices *" << std::endl;
std::cout << "* GS5 is the 5th gen galaxy smart phone *" << std::endl;
std::cout << "* GS6 is the 6th gen galaxy smart phone with better cammera *" << std::endl;
std::cout << "* GS7 the 7th gen featureing a new body style and faster speed *" << std::endl;
std::cout << "* GS8 is $400.00 *" << std::endl;
std::cout << "* GS9 is $500.00 *" << std::endl;
std::cout << "* Good Students get a 2% discount *" << std::endl;
std::cout << "**********************************************************" << std::endl;
std::cout << " How many items will you be purchasing today? " << std::endl;
std::cin >> items;
cout << "What item would you like to buy?" << endl;
cout << "1. GS5 is $100.00" << endl;
cout << "2. GS6 is $200.00" << endl;
cout << "3. GS7 is $300.00" << endl;
cout << "4. GS8 is $400.00" << endl;
cout << "5. GS9 is $500.00" << endl;
cout << endl;
cout << "How many GS5's would you like to buy?" << endl;
cin >> quantity1;
cout << endl;
cout << "How many GS6's would you like to buy?" << endl;
cin >> quantity2;
cout << endl;
cout << "How many GS7's would you like to buy?" << endl;
cin >> quantity3;
cout << endl;
cout << "How many GS8's would you like to buy?" << endl;
cin >> quantity4;
cout << endl;
cout << "How many GS9's would you like to buy?" << endl;
cin >> quantity5;
total1 = gs5 * quantity1;
total2 = gs6 * quantity2;
total3 = gs7 * quantity3;
total4 = gs8 * quantity4;
total5 = gs9 * quantity5;
lasttotal = (total1 + total2 + total3 + total4 + total5) * tax;
cout << "Raw Total before discounts" << endl;
cout << lasttotal << "$" << endl;
cout << endl;
std::cout << "For your good student discount your GPA must be 3.5 and up please enter here" << std::endl;
std::cin >> gpa;
if (gpa > 3.4)
{
endtotal = lasttotal / discount;
cout << "Your finall total today will be" << lasttotal << endl;
}
cout << "################################################## " << endl;
cout << "################################################## " << endl;
cout << "## Well that it I guess Goodbye. ## " << endl;
cout << "## Bye Joshua Meyer ## " << endl;
cout << "################################################## " << endl;
cout << "################################################## " << endl;
infile.close();
outfile.close();
system("pause");
return 0;
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
