Question
Minnie and Mickey are getting ready to send out Holiday bonuses to their hard working employees in Retail District #5. The bonuses are calculated based
Minnie and Mickey are getting ready to send out Holiday bonuses to their hard working employees in Retail District #5. The bonuses are calculated based on how much each retail store sold in each category. The retail store with the highest amount sold in a category will receive $5,000. The retail store with the lowest amount sold in a category will receive $1,000. All other retail stores in district #5 will receive $2,000. If a retail store didnt sale anything in a category, or they have a negative sales amount, they are not eligible for a bonus in that category. If only one retail store sold items in a category, they are eligible to receive only the bonus of $5000 for that category.
Assignment Description |
Create a utility class that manipulates a two-dimensional ragged array of doubles. This utility class will be used to create a Sales Report for Retail District #5. It will accommodate positive and negative numbers. Follow the Javadoc provided.
Create a utility class that will calculate holiday bonuses given a ragged array of doubles which represent the sales for each store in each category. It will also take in bonus amount for the store with the highest sales in a category, the bonus amount for the store with the lowest sales in a category and the bonus amount for all other stores.
These utility classes will be used with an existing GUI class to create a sales report and display holiday bonuses.
Testing of these utility classes will be done with the JUnit tests and the GUI class provided for you.
Concepts tested by this assignment |
Creating classes based on Javadoc
Two Dimensional Ragged Arrays
Passing arrays to and from methods
Creating a Utility class (static methods)
JUnit testing
Reading from a file
Writing to a file
Using methods of the utility class within an existing GUI driver class
Must follow Javadoc to implement correctly
Classes |
Utility class - TwoDimRaggedArrayUtility
The class TwoDimRaggedArrayUtility will follow the provided Javadoc and will contain the following methods:
Method readFile pass in a file and return a two-dimensional ragged array of doubles
Method writeToFile pass in a two-dimensional ragged array of doubles and a file, and writes the ragged array into the file. Each row is on a separate line and each double is separated by a space.
Method getTotal pass in a two-dimensional ragged array of doubles and returns the total of the elements in the array.
Method getAverage pass in a two-dimensional ragged array of doubles and returns the average of the elements in the array (total/num of elements).
Method getRowTotal pass in a two-dimensional ragged array of doubles and a row index and returns the total of that row. Row index 0 is the first row in the array.
Method getColumnTotal - pass in a two-dimensional ragged array of doubles and a column index and returns the total of that column. Column index 0 is the first column in the array. If a row doesnt contain that column, it is not an error, that row will not participate in this method.
Method getHighestInRow - pass in a two-dimensional ragged array of doubles and a row index and returns the largest element in that row. Row index 0 is the first row in the array.
Method getHighestInRowIndex - pass in a two-dimensional ragged array of doubles and a row index and returns the index of the largest element in that row. Row index 0 is the first row in the array.
Method getLowestInRow - a two-dimensional ragged array of doubles and a row index and returns the smallest element in that row. Row index 0 is the first row in the array.
Method getLowestInRowIndex - a two-dimensional ragged array of doubles and a row index and returns the index of the smallest element in that row. Row index 0 is the first row in the array.
Method getHighestInColumn - pass in a two-dimensional ragged array of doubles and a column index and returns the largest element in that column. Column index 0 is the first column in the array. If a row doesnt contain that column, it is not an error, that row will not participate in this method.
Method getHighestInColumnIndex - pass in a two-dimensional ragged array of doubles and a column index and returns the index of the largest element in that column. Column index 0 is the first column in the array. If a row doesnt contain that column, it is not an error, that row will not participate in this method.
Method getLowestInColumn - pass in a two-dimensional ragged array of doubles and a column index and returns the smallest element in that column. Column index 0 is the first column in the array. If a row doesnt contain that column, it is not an error, that row will not participate in this method.
Method getLowestInColumnIndex - pass in a two-dimensional ragged array of doubles and a column index and returns the index of the smallest element in that column. Column index 0 is the first column in the array. If a row doesnt contain that column, it is not an error, that row will not participate in this method.
Method getHighestInArray - pass in a two-dimensional ragged array of doubles and returns the largest element in the array.
Method getLowestInArray - pass in a two-dimensional ragged array of doubles and returns the smallest element in the array.
Utility class HolidayBonus
The class HolidayBonus will follow the provided Javadoc and will contain the following methods:
Method calculateHolidayBonus pass in a two-dimensional ragged array of doubles, and the bonus amount for the store with the highest sales in a category, the bonus amount for the store with the lowest sales in a category and bonus amount for all other stores. It will return an array of doubles which represents the holiday bonuses for each of the stores in the district. The first entry in the returned array [0] will represent the holiday bonus for the store at [0] in the two-dimensional ragged array of doubles. You will be using methods from the TwoDimRaggedArrayUtility when needed.
Method calculateTotalHolidayBonus pass in a two-dimensional ragged array of doubles, and the bonus amount for the store with the highest sales in a category, the bonus amount for the store with the lowest sales in a category and bonus amount for all other stores. It will return a double which represents the total of all Holiday Bonuses for the District. You will be using methods from the TwoDimRaggedArrayUtility when needed.
GUI Application provided for you
Uses methods of TwoDimRaggedArrayUtility and HolidayBonus
When the Load Sales Data button is selected the sales data is read from a file and displayed on the screen with the sales data as well as the totals for each store and the totals for each category. The largest sales for each category is highlighted in green. The smallest sales for each category is highlighted in red. The holiday bonus for each store is displayed as well as the total of holiday bonuses.
The file contains a row for each store and each double in the row is separated by a space
Student must provide two additional input files and a screenshot of the results of each. Each file will have at least 4 rows and up to 6 numbers on each row. They must represent ragged arrays.
JUnit Test
Student will implement TwoDimRaggesArrayUtilityTestSTUDENT
Student will implement HolidayBonusTestSTUDENT
Assignment Details |
When GUI application starts (provided), user is shown display of Store Names and Item Names
User selects Load Sales Data to select the file containing the sales data. The application then displays the sales for each store and each item as well as the totals for the store and the totals for the item. The store with the highest sales for each item will be highlighted.
Exit will exit the application.
Deliverables / Submissions:
Design: UML class diagram with algorithm (pseudo-code) for methods
Implementation: Submit a compressed file containing the follow (see below): The Java application (it must compile and run correctly); Javadoc files in a directory; a write-up as specified below. Be sure to review the provided project rubric to understand project expectations. The write-up will include:
Test Cases (These are the ones you will use in your STUDENT test methods in the JUnit test)
Prepare a test table with a list of test cases (expected versus actual results) that you are testing the application with
UML diagram
Any assumptions that you are making for this project
In three or more paragraphs, highlights of your learning experience
Deliverable format: The above deliverables will be packaged as follows. Two compressed files in the following formats:
LastNameFirstName_Assignment5_Complete.zip, a compressed file in the zip format, with the following:
Write up (Word document) - reflection paragraphs
UML Diagram - latest version (Word or jpg document)
doc (directory) - Javadoc
File1.html (example)
File2.html (example)
src (directory)
File1.java (example)
File2.java (example)
Filetest.java (example)
File1.java (example)
File2.java (example)
Filetest.java (example)
This folder should contain Java source files only
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