Description
CMSC203 Fall 2026 Assignment #5 focuses on developing a Store Sales Data Processor in Java using ragged two-dimensional arrays, static utility methods, and file input/output operations. Students process departmental sales data, calculate totals and averages, identify minimum and maximum values, generate summary reports, and validate functionality through JUnit testing and JavaFX integration.
Assignment Description
Write a Java program that processes sales data for multiple departments over multiple days. The sales data is a ragged 2D array (each row may have a different number of columns) of double values. You will:
- Read sales data from a text file into a 2D ragged array.
- Use a set of static utility methods to compute row/column totals, highest/lowest values, and overall totals.
- Write summary results to an output file.
- Test your utility methods using JUnit.
- Use a JavaFX GUI to select an input file, process it, and display results.
This assignment emphasizes arrays-of-arrays (ragged 2D arrays), static methods, file input/output, and unit testing, consistent with mid-course Java topics.
Data Format
Input files represent store sales for several departments. Each line contains a department’s daily sales totals as space-separated double values. Lines may have different lengths (ragged):
Example salesdata.txt:
100.50 200.75 150.00
80.00 90.00
220.10 130.50 300.00 50.25
Row 0 → Department 0: 3 days of data.
Row 1 → Department 1: 2 days.
Row 2 → Department 2: 4 days.
- A driver and utilities classes
- Ragged 2D array
- Methods
- Read from an input file
- Write to an output file
- Testing methods with Junit Test
- Use a JavaFX GUI to select an input file, process it, and display results.
|
Implement at least the following classes:
- SalesDataUtility (static utility class)
- SalesFileIO (file input/output helper)
- SalesAppDriver (console driver with main)
- SalesAppFX (JavaFX GUI driver – provided)
- JUnit test class(es), e.g., SalesDataUtilityJUnitStudentTest
Required Features
- Ragged 2D Array
Use double[][] where each double[] row may have a different length.
- Static Utility Methods (SalesDataUtility)
At minimum, implement:
- public static double getTotal(double[][] data)
- public static double getAverage(double[][] data)
- public static double getRowTotal(double[][] data, int row)
- public static double getColumnTotal(double[][] data, int col)
- public static double getHighestInRow(double[][] data, int row)
- public static double getLowestInRow(double[][] data, int row)
- public static double getHighestInArray(double[][] data)
- public static double getLowestInArray(double[][] data)
All methods iterate using nested loops; when accessing a column, skip rows that do not have that column index.
- File I/O (SalesFileIO)
- public static double[][] readSalesData(String filename)
Reads each line, splits on spaces, converts tokens to double, and builds a ragged array. - public static void writeSummary(String filename, double[][] data)
Writes totals, averages, highest/lowest values to an output file.
- Console Driver (SalesAppDriver)
- Asks user for input and output file names.
- Uses SalesFileIO to read data and write summary.
- Uses SalesDataUtility to compute results.
- JavaFX GUI (SalesAppFX)- provided
- Simple UI with:
- Text field for input file.
- Text area to display computed totals and statistics.
- Buttons:
- “Load & Process” (reads file, processes, updates UI).
- “Save Summary” (writes summary to an output file, e.g., txt).
- Internally uses SalesFileIO and SalesDataUtility.
- JUnit Tests
- Test each static utility method with known ragged arrays.
- Confirm totals, averages, and min/max values.
Screenshots for CMSC203 Assignment 5
Fill out input file and output file fields.
Click Load & Process:
(The program reads data from the input file and displays it on the screen)
Click Save Summary button:
The program writes data to the output file. Go to the output file’s location and verify that the file is populated.
Contents of populated output file:
Total sales: 1322.10
Average sale: 146.90
Row 0 total: 451.25
Row 1 total: 170.00
Row 2 total: 700.85
Column 0 total: 400.60
Column 1 total: 421.25
Test your program with at least 3 test cases. Make sure your tests cover all the possible scenarios. Refer to the Test Plan Guideline on how to write a Test Plan.
| Test Case # | Input | Expected Output
|
Actual Output
|
Did the test pass?
|
|
| 1 |
|
||||
| 2 | |||||
| 3 | |||||
|
|
Create a UML diagram for Assignment 5 based on the Assignment 5 Description given to you for each class. Be sure to show the relationship between classes
Deliverables / Submissions and Deliverable format:
- The Java application must compile and run correctly; the project grade will be zero.
- The detailed grading rubric is provided in the assignment rubric Excel file.
- Your source code should contain proper indentation and documentation.
- Documentation within the source code should include:
-
- additional Comments to clarify the code, if needed
- “Paragraph” comments at the beginning of each method.
- class description comments at the top of each program containing the course name, the project number, your name, the date, and the platform/compiler that you used to develop the project, for example:
/*
* Class: CMSC203
* Instructor:
* Description: (Give a brief description for each Class)
* Due: MM/DD/YYYY
* Platform/compiler:
* I pledge that I have completed the programming
* assignment independently. I have not copied the code
* from a student or any source. I have not given my code
* to any student.
Print your Name here: __________
*/
The deliverables will be packaged as follows. Two compressed files in the following formats:
- zip, a compressed file in the zip format, with the following:
- src folder:
- includes only .java files that you have modified or created.
- Word document that includes (use provided template):
- Screenshots:
- One screenshot of the application running from the command prompt.
- One screenshot of the application running in your IDE.
- Screenshot of Java file (Assignment5.java) in your GitHub
- Screenshots:
- src folder:
- Test Plan
- UML diagram
- Lessons Learned:
Respond to each prompt below in complete sentences (minimum 2–3 sentences per item):
- Describe your overall learning experience working on this project.
- What new concepts or techniques did you learn?
- What aspects of this assignment were the most challenging, and how did you address them?
- What would you do differently on your next project?
- Which parts of the assignment were you most successful with, and which (if any) were you not successful with?
- FirstInitialLastNamezip, a compressed file containing one or more Java files (This folder SHOULD NOT contain any folders and it should contain Java source files only):
.java files that you have modified or created.
Solution Overview
The solution addresses SalesDataUtility, SalesFileIO, and SalesAppDriver implementations, including ragged array processing, row and column totals, average sales calculations, minimum and maximum values, and file-based summary generation. It also covers JavaFX integration, JUnit testing, UML class design, and test planning.




