[SOLVED] C++ compiler graph CS 1160 C/C++ Programming

$25

File Name: C++_compiler_graph_CS_1160_C/C++_Programming.zip
File Size: 414.48 KB

5/5 - (1 vote)

CS 1160 C/C++ Programming
Instructor: Dr. Jin Zhu
Sales Bar Chart
C/C++ Programming Homework #3
Write a program that askes the user to enter todays sales for multiple stores and display a bar graph comparing each stores sales and save the date and sales data into a .txt file. Create each bar in the bar graph by displaying a row of asterisks. Each asterisk should represent $100 of sales.
Here is an example of the output display:
Enter the total number of stores that
Enter todays sales for store 1: 1000
Enter todays sales for store 2: 1200
Enter todays sales for store 3: 1800
Enter todays sales for store 4: 890
Enter todays sales for store 5: 1920
SALES BAR CHART
(Each * = $100)
Store 1: **********
Store 2: ************
Store 3: ******************
Store 4: *********
Store 5: *******************
you need to input sales data: 5
The tasks include:
1. Ask the user to enter the total number of stores that he/she need to input sales data.
2. Ask the user to enter todays sales for each store.
3. The program should display a bar graph comparing each stores sales by displaying a row
of asterisks. Each asterisk should represent $100 of sales (rounded to the closest 100 if
the entered number is not exactly in $100).
4. Ask the user to enter todays date (in the format of mmddyyyy) and a file name (such as
saleschart.txt file), and then save the date and sales bar chart in the named file.
Hints:
Youll want to round the sales to the nearest 100. The following example shows how to round to the nearest 10. An easy way to round to the nearest ten is to add 5 before dividing by 10. Consider the following table:
Original valuerounded value
After adding 5
After dividing (/) by 10
1034 1030
1039
1039 / 10 is 103
1035 1040
1040
1040 / 10 is 104
1039 1040
1044
1044 / 10 is 104
1040 1040
1045
1045 / 10 is 104

CS 1160 C/C++ Programming Instructor: Dr. Jin Zhu
1041 1040
1046
1046 / 10 is 104
When write the program, be sure you:
Use meaningful variable names with good style (i.e., useCamelCase)
Provide proper comments. Use comments (// single-line or /* Multi-line Comment */) at
the start of the program, to label tricky blocks of code, and to explain the contents of
variables
Use global constants where appropriate with good style
ALL_CAPS_AND_UNDERSCORES (Put your global constants after your #include compiler-directives and before your main function definition so they can be found and changed easily in future versions of your program.)
Format the user interaction nicely. Provide clear instructions to the user.
Submission requirements:
Submit the following files in the e-Learning homework assignment link by the given deadline: 1. source file salesBar.cpp (your C++ source code)
2. A screenshot of your program running with 6 stores sales data inputs: 1005, 524, 779,
1215, 659, 740.
3. Saved sales data file.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] C++ compiler graph CS 1160 C/C++ Programming
$25