Now follow the UML class diagram and the description below and complete the back-end class called Department. Department - sales: double[][] + Department() + populateArray(): void + calculateAvgSalesPerMonth(double[]): void + calculateAvgSalesPerDepart(double[]): void + determineHighestMonthlySales(int): void + determineHighestDepartSales (int): void Attribute/Method Description sales Data members. The sales is a two-dimensional array that can store for a maximum of 4 departments (not all stores have 4 departments), the sales for each month of the last three months (See Fig. 1). Department () The constructor is used to initialize all data members to default values. populateArray() This method must populate the array with user input. The information can be similar to the one found in Figure 1 calculateAvgSalesPerMonth (double[]) This method must return a one-dimensional array holding the calculated average sales for each of the 6 months for all departments that has sales figures. calculateAvgSalesPerDepart (double[]) This method must return a one-dimensional array holding the calculated average sales for each department that has sales figures, over the six months. determineHighestMonthlySales (int) This method must receive an integer month number (1-3), and will return the department number with the highest sales figure for that month. (Remember that not all departments may have sales figures entered). determineHighestDepartSales (int) This method must calculates and returns the month number of the month with the highest sales in a department, receiving an integer value indicating for which department it must be calculated (1-5).
You are asked to develop a program that will manipulate sales data for the departments for each month of the last three months for a chain of Clothing Stores.
Month: |
1 |
2 |
3 |
Dept: |
|||
1 |
455000 |
325000 |
411000 |
2 |
538000 |
123000 |
645000 |
3 |
378000 |
259000 |
496000 |
4 |
440000 |
612000 |
537000 |
Fig. 1: An EXAMPLE of the Data for the Two-Dimensional Array, where all 4 departments have sales figures entered.
Task 1
Now follow the UML class diagram and the description below and complete the back-end class called Department.
Department |
- sales: double[][] |
+ Department() + populateArray(): void + calculateAvgSalesPerMonth(double[]): void + calculateAvgSalesPerDepart(double[]): void + determineHighestMonthlySales(int): void + determineHighestDepartSales (int): void |
Attribute/Method |
Description |
sales |
Data members. The sales is a two-dimensional array that can store for a maximum of 4 departments (not all stores have 4 departments), the sales for each month of the last three months (See Fig. 1). |
Department () |
The constructor is used to initialize all data members to default values. |
populateArray() |
This method must populate the array with user input. The information can be similar to the one found in Figure 1 |
calculateAvgSalesPerMonth (double[]) |
This method must return a one-dimensional array holding the calculated average sales for each of the 6 months for all departments that has sales figures. |
calculateAvgSalesPerDepart (double[]) |
This method must return a one-dimensional array holding the calculated average sales for each department that has sales figures, over the six months. |
determineHighestMonthlySales (int) |
This method must receive an integer month number (1-3), and will return the department number with the highest sales figure for that month. (Remember that not all departments may have sales figures entered). |
determineHighestDepartSales (int) |
This method must calculates and returns the month number of the month with the highest sales in a department, receiving an integer value indicating for which department it must be calculated (1-5). |
(in java form)
Step by step
Solved in 2 steps