Question
c++ the program should print out a list that says: Please chose from the the list: 1. Enter sales. 2. Total sales for the day.
c++
the program should print out a list that says:
Please chose from the the list: 1. Enter sales. 2. Total sales for the day.
Your program should get the users input, and then check to see if it is a valid choice. You may assume that the user enters in a numerical value. You may not assume the number is valid. If it is not, force the user to enter the choice again. Do this repeatedly until the user selects a valid choice.
USER SELECTS CHOICE 1 If the user selects to enter sales (CHOICE 1), then you first need to print out a message to the screen that confirms that they chose to enter sales. Then you need to open the output file in append mode like this:
filename.open(sales.txt, ios::app)
Then you display another menu that says:
Choose the department from the following menu: 1. Comics 2. Collectibles 3. Games
Get the users choice and again validate the choice like you did in the main menu. If the user selected Comics, output Comics to sales.txt. If the user selected Collectibles, output Collectibles to sales.txt. If the user selected Games, output Games to sales.txt.
Then, no matter what they chose, ask the user for the price of the item and how many of the item they purchased. Multiply the cost of the item times the quantity to get the total cost. Then add in tax. You should define TAX as a constant in your program as 6% (.06). Then output the total cost with tax to sales.txt Make sure that after you output the total cost with tax to put a at the end. Also, this value should only have two numbers after the decimal point.
Then, ask the user if they want to enter more sales. If they do, then repeat the department menu and the steps necessary to enter another sale.
Once the user is done entering sales, display the main menu again.
This is an example of what the sales.txt could look like:
USER SELECTS CHOICE 2 If the user selects to total (tally) sales for the day (CHOICE 2), then you first need to print out a message to the screen that confirms that they chose to total sales. Then you need to open the input file (sales.txt). Make sure you check the file for errors before trying to read from the file like this:
if(filename.fail()) cout
If the file opens properly, read in a c-string from the file. Check to see if the c-string is the word Comics, Collectibles, or Games. If it is Comics, then input the amount on the next line and then add to the running total for comics sales. If it is Collectibles, then input the amount on the next line and then add to the running total for costume sales. If it is Games, then input the amount on the next line and then add to the running total for decoration sales.
Then, get the current time & date. You will have to include the file
time(&rawtime); cout
Then print out a table that prints out each department and its corresponding running total. It should look like this:
Then show the main menu again.
thank you
Sales Tulepou File Edit Format View Comics Help 5.25 Collectibles 10.60 Games 127.20 Comics 10.60 TOTAL SALES ON Mon Feb 10 15:58:18 2020 - - - - - - - - - - - - - - COMICS: COLLECTIBLES: GAMES: 15.85 10.60 127.20
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started