Question: Programming Assignment #9-CarSales Write a Carsales class (Carsales java file) that: has 2 attributes: o sales. (private) which is an amay ofintegers. Each element in
Programming Assignment #9-CarSales Write a Carsales class (Carsales java file) that: has 2 attributes: o sales. (private) which is an amay ofintegers. Each element in the array represents the number of sales in a given month of the year. Jan index 0. Dec index 11 year, (public or private) which is the year of the monthly sales. has a Carsales constructor that takes 2 inputs and initializes the instance variables: o the year o an array of integers as input and initializing the sales instance array variable. has a calculateTotalCarsales method with no input to calculate and return the total number of cars sold in year. has a calculateMonthMostSales method with no input to calculate and return the month with most cars sold. has a calculateMonth LeastSales method with no input to calculate and return the month with fewest cars sold. has a calculateAveragesales method with no input to calculate and retum the average cars sold for year. has a getsalesForMonth method with month as in to put return the number of cars sold for month. month is input, output is the number ofcars sold for the specified month. Create a demo program, CarsalesDemo, will Call CarSales constructor to create saleAgentl object for 2016. Pass in the year, 2016, and the agentisales array This will initialize the agentisales object with the year and array of sales for the year. Call CarSales constructor to create saleAgent2 object for 2016. Pass in the year, 2016, and the agentisales array. This will initialize the agent2Sales object with the year and array of sales for the year. Here are the sales for each agent: Year Jan Feb Mar Apr May Jun Jul Aug Sep oet Nov Dec 2016 24 68 Print the month with the most cars sold for salesAgent1 and sales Agent2. Print the month with the fewest cars sold for salesAgentl and salesAgent2 Print the total number of cars sold for the year for sales Agent1 and salesAgent2
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
