Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 2 which is Total sales for the day. (ignore the first choice "Enter sales." do only choice 2)

NOTE: please write easy codes to understand + thanks 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 << Error opening input file. ; else { //continue to read in date from file }

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 and then define a variable like this: time_t rawtime; at the top. Then when you want to get the current date & time and print it out, use this code:

time(&rawtime); cout << " TOTAL SALES ON " << ctime(&rawtime) << " ";

Then print out a table that prints out each department and its corresponding running total. It should look like this:

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Optimizing Data Collection In Warzones

Authors: Aaget Aamber

1st Edition

B0CQRRFP5F, 979-8869065902

More Books

Students also viewed these Databases questions

Question

Group Size and Communication

Answered: 1 week ago

Question

Understanding Group Roles

Answered: 1 week ago