Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Perodua is a car manufacturer, offers a broad range of vehicles. Among the best perodua models are Myvi, Bezza, Aruz, Ativa and Axia. The
Perodua is a car manufacturer, offers a broad range of vehicles. Among the best perodua models are Myvi, Bezza, Aruz, Ativa and Axia. The company records each of the model sales in a quarterly basis. As a programmer, you are required to design a Sales class that has fields model's name, an integer array that stores sales for first, second, third, and fourth quarter. The Sales class also contain: A constructor that accepts model name and an array sales. A method that calculate the total sales of all quarters. The method returns the total sales. A method that display model's name, sales of all quarters, and its total sales. For DemoSales class, you should : Ask the user to enter number of models he/she wants to input. Ask the user to enter car model name, read as modelName. Create an integer array name quarters with 4 number of elements that will hold values when the user enter the sales value for each quarter. Use ArrayList to insert Sales objects. Below is an example of inserting a sales object to ArrayList: sales.add(new Sales (modelName, quarters)); Output example: Please enter number of models :3 1) Please enter model name 1 :Bezza Please enter sales for quarter 1:10000 Please enter sales for quarter 2:10500 Please enter sales for quarter 3:11000 Please enter sales for quarter 4:9500 2) Please enter model name 2 : Myvi Please enter sales for quarter 1:12000 Please enter sales for quarter 2:13000 Please enter sales for quarter 3:11000 Please enter sales for quarter 4:10000 3) Please enter model name 3 :Axia Please enter sales for quarter 1:9000 Please enter sales for quarter 2:8000 Please enter sales for quarter 3:8500 Please enter sales for quarter 4:7500 Model: Bezza Quarter 1: 10000 Quarter 2: 10500 Quarter 3: 11000 Quarter 4: 9500 Total sales: 41000 Model: Myvi Quarter 1: 12000 Quarter 2: 13000 Quarter 3: 11000 Quarter 4: 10000 Total sales: 46000 Model: Axia Quarter 1: 9000 Quarter 2: 8000 Quarter 3: 8500 Quarter 4: 7500 Total sales: 33000
Step by Step Solution
★★★★★
3.26 Rating (170 Votes )
There are 3 Steps involved in it
Step: 1
java public class Sales private String modelName private int quarters public SalesString modelName int quarters thismodelName modelName thisquarters q...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