The file SalesData.txt (below) contains the dollar amount of sales that a retail
ID: 3622053 • Letter: T
Question
The file SalesData.txt (below) contains the dollar amount of sales that a retail store made each day for a numberof weeks. Each line in the file contains seven numbers, which are the sales numbers for one week.The numbers are comma delimited. The following line is an example from the file:
2513.45,1963.22,1568.35,1966.35,1893.25,1025.36,1128.36
Write a program using mainly methods within or outside a class definition to open the SalesData.txt file
and process its contents. The program should display the following on screen in the form of pop-ups.
The same results should be duplicated in an output file that you will call SalesAnalysys.txt. Include SalesAnalysis.txt as part of your submission.
• The total sales for each week
• The average daily sales for each week
• The total sales for all the weeks
• The average weekly sales
• The week number that had the highest amount of sales
• The week number that had the lowest amount of sales
Data
1867.24,3124.20,1301.09,1489.27,1822.45,2111.89,1425.56
1245.67,1490.07,1679.87,2371.46,1783.92,1461.99,2059.77
2541.36,2965.88,1965.32,1845.23,7021.11,9652.74,1469.36
2513.45,1963.22,1568.35,1966.35,1893.25,1025.36,1128.36
1867.24,3124.20,1301.09,1489.27,1822.45,2111.89,1425.56
3296.54,9147.88,1801.45,0866.77,2001.21,0096.24,1156.83
2513.45,1963.22,1568.35,1966.35,1893.25,1025.36,1128.36
1234.67,0123.28,1342.01,1255.22,2611.91,3811.49,0089.68
1867.24,3124.20,1301.09,1489.27,1822.45,2111.89,1425.56
2513.45,1963.22,1568.35,1966.35,1893.25,1025.36,1128.36
1245.67,1490.07,1679.87,2371.46,1783.92,1461.99,2059.77
Am a little bit stuck thanks.....
Explanation / Answer
Dear.... import javax.swing.JOptionPane; import java.text.DecimalFormat; public class Sales { public static void main(String[] args) { final int double[ ] sales = new double[ONE_WEEK]; getValues(sales); SalesData week = new SalesData(sales); DecimalFormat dollar = new DecimalFormat("#,##0.00"); JOptionPane.showMessageDialog(null, "The total sales were $" + dollar.format(week.getTotal()) + " The average sales were $" + dollar.format(week.getAverage()) + " The highest sales were $" + dollar.format(week.getHighest()) + " The lowest sales were $" + dollar.format(week.getLowest())); System.exit(0); } private double[] sales; public SalesData(double[] s) { sales = new double[s.length]; for (int index = 0; indexRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.