Question
A store has recorded ten years' worth of sales data in the file sales.txt (attached). Each row has twelve columns for the twelve months, and
A store has recorded ten years' worth of sales data in the file sales.txt (attached). Each row has twelve columns for the twelve months, and there are ten rows for ten years. Write a program that reads the file and reports the data with totals for the years and for the ten year total. Format the output in a neat table. You don't have to use the $ sign, and you can make the columns as wide or narrow as you like as longs as they are properly aligned.
Only use things we learned in this course. Code that uses things we did not learn will not be graded. Make sure to use the four step process. Use all the header information specified in the Announcements section. Use appropriate data types. Use good spacing. Validate the data file name. All numbers have two decimals. Annual total shows in the last column on each line, ten year total is on a line at the bottom. This is what the program should look like to the user.
This program shows sales data for ten years. What is the name of the file to use? sale.txt There is no file by that name. Please enter a valid file name; sales.txt Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec year 9161.27 1409.26 3738.05 3798.10 8885.90 4917.66 3916.04 3518.75 4889.36 3206.39 8441.91 7176.89 63059.58 9985.29 7746.24 9345.61 1978.98 5356.79 2423.76 1883.35 1632.24 4144.76 1704.18 8989.09 3670.97 58861.26 2958.48 8323.86 2381.97 5031.41 9230.18 8227.20 1520.13 2032.45 1566.24 2013.22 6849.68 1088.23 51223.05 7964.12 9411.05 6951.61 1510.66 1860.97 4519.61 8961.06 5867.56 5150.20 9645.90 1872.69 1805.38 65520.81 7621.05 4612.01 7482.99 4919.17 5912.68 6920.06 8907.39 4769.35 4622.09 9365.16 1122.71 7536.62 73791.28 7465.49 5007.85 5875.82 1912.75 1282.27 1036.97 7486.38 1655.07 3591.70 6347.93 5863.49 7012.18 54537.90 6565.09 8024.52 5710.14 2427.15 1100.53 4490.66 5102.49 4936.38 2372.92 1720.97 8243.03 3318.50 54012.38 1772.76 3267.78 2261.08 2273.65 8166.53 8524.09 6617.22 1168.16 6959.40 5461.21 5976.80 3411.84 55860.52 2438.37 5305.20 6553.26 8911.48 3252.15 1524.23 8502.34 4741.52 3318.94 4896.70 3825.58 1449.32 54719.09 6181.43 1465.63 5399.65 1615.43 3036.33 9193.84 9473.89 6993.11 8462.02 8176.75 1832.47 4607.86 66438.41 total sales for ten years: 598024.28
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