Question: Use IntelliJ to write a java program named CarSalesFinal that follows the instructions below. When your program is complete, export yourproject to zip and upload

Use IntelliJ to write a java program named CarSalesFinal that follows the instructions below. When your program is complete, export yourproject to zip and upload the file to the CANVAS Final Exam dropbox. As a programming assignment, remember to follow typical instructionsand include your name, accessID, and date. Also please follow good programming style practices and include comments along with yourcode for full credit!
Problem Description:
Assume you manage a car sales department. You need a simple application that tracks the number of cars sold by agiven employee. Follow the instructions below to code the CarSalesFinal program.
Main Method:
Call the getNumOfMonths method.
Call the generateSalesData method.
Call the writeSalesDatamethod.
Call the readSalesData method.
Call the printHistogram method.
Other Methods:
getNumOfMonths() method. This method does not receive any parameters. It prompts the user: Enter the number ofmonths to evaluate sales data (1-12 inclusive):"
The method loops until the user enters a valid integer between 1 and 12 inclusive. It returns the number of months asnumOfMonths.
generateSalesData() method. This method receives numOfMonths. It generates sales data and stores it in an integerarray.
Specifically, it uses the random number equation to generate sales data between 1 and 12. So, for example, ifnumOfMonths is 3, then this method creates an integer array with a size of 3, generates 3 integers between 1 and 12, and stores each number in the array. It returns the array as monthlySales.
writeSalesData() method. This method receives the monthlySales array. It writes the data to a file called sales.txt. Itreturns nothing. It writes each number from the array to its own line in a file named "sales.txt". Use a try/catch block tocatch a FileNotFoundException and output the file not found exception message.
readSalesData() method. This method receives the name of the file to read. It reads the sales.txt file. It creates aninteger ArrayList called salesData that contains the contents of the sales.txt file. It calls the calcAvgSales method.
It returns the salesData ArrayList. Use a try/catch block to catch a FileNotFoundException. Output the file not foundexception message if it occurs.
calcAvgSales() method. This method receives the salesData ArrayList. It calculates the average number of cars soldand prints this information to the console. For example, if if salesData is [4,2,6,5], then it outputs:
The average number of cars sold per month is 4.25.
printHistogram() method. This method receives salesData and numOfMonths. It returns nothing. It prints a histogramthat depicts the number of cars sold each month.
For example, if salesData is [4,2,6,5]
The output should be:
Cars Sold Month 1****
Cars Sold Month 2**
Cars Sold Month 3******
Cars Sold Month 4****

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!