Answered step by step
Verified Expert Solution
Question
1 Approved Answer
please follow the instruction of 4a to 4b and write this in java thank you 13) (20 points) Complete the following Sale and SaleDemo classes.
please follow the instruction of 4a to 4b and write this in java thank you 13) (20 points) Complete the following Sale and SaleDemo classes. 4.a) Sales class. It has a field, 10 -element array that holds the sales for 10 stores. The program has three methods: a) a constructor that accepts an array parameter. b) a method that returns the maximum sales for the stores. c) a method that returns the total sales for the stores. // Sales Program public class Sales 1 4.1) (3 points) declare a private 10 -element array named sales that holds the sales for 10 stores. } (*4.2) (3 points) define a constructor that accepts an array parameter and use it to initialize the field sales. / 144.3) (3 points) write a method named maxSales. It has no parameters, and returns the maximum sales among the 10 stores. *4.4) (3 points) write a method named totalSales. It has no parameters, and returns the total sales among the 10 stores. % 4.b) Complete the following main program which demonstrates how to use the class. II SalesDeme Program \{ public static void main(String] args) \{ IDefine any variables you need * 4.4) (2 points) define a 10-element array which contains the sales for 10 stores, and initialize them to be {16500,21234,17000,35100,26231,36098,39784, II 26300,29500,43100};/ object*)(4.5)(3noints) create an object of Sales, storeSales, and pass the above array to the /44.6) ( 3 points) call the method maxSales to get the maximum sales and print out the result */ J//end of main method
please follow the instruction of 4a to 4b and write this in java thank you
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