CS 405 Assignment 12

Class Review Assignment - Due May 1

The purpose of this assignment is to review objects, text processing, and building user interfaces. The exact mechanics of how this program will be incorporated into your final grade will be detailed on Piazza.

General Functionality

The objective of this program is to track the different items that your company sells, and to print reports about what items have been sold. Data can be entered in two ways. The first is through the user interface. If the user enters numbers into the X, Y, and Z text boxes and a material into the material text box, the program should accept the data.

The price of different items is proportional to the item's size, and the price per volume is determined by the material. The following table shows materials and their prices. Materials not listed in this table are not sold by your company.


After items have been entered, it should be possible to produce a report about what items have been sold.

Your program should reject data that does not make sense. This means rejecting numbers that are not actually numbers and materials that your company does not sell.

The program should also be able to process text files, allowing users to enter many orders all at once. The format is the material, the X dimension, the Y dimension, then the Z dimension, all separated by a single space. One item is to be on each line. Three simple exammple files follow. Note that one file contains simple examples of invalid input.

Your program should also be able to detect and reject invalid input from files that are loaded. Each time your program rejects a line, it should produce a message box indicating that a line was rejected. Each time a line is rejected, one message should box should be created. Note that you should not produce a message box if the line is empty, because empty lines should simply be ignored. It is important to note that invalid entries should not be tracked. On past programs, I have seen students put invalid entries into their data.

Your program should allow users to enter data both through the UI as well as through loading a file.

If the same file is loaded more than one, this means that someone bought the items in the file twice, so they should appear twice in your report of items purchased.

Last, your program should be able to identify the most expensive item sold.

Program Design

You should create a class to represent items that people purchase. This class should have 2 constructors, one that takes a single string as a parameter, and one that takes a single string and three doubles as a parameter. This class should also have a toString function that is able to represent the item as a string. The button that prints out the data should call this function.

Preliminary Testing

Like the last program, before you begin, you should do some basic testing to make sure your classes work correctly.


Submission Instructions

To submit this program, I would like all students to zip their project, and send it to me. I would like you to submit the entire project, which should be named Prog_12_lastname, where lastname is your last name. For me, this is Prog_12_Wilt. Students should email their completed projects to cs405@cs.unh.edu.

Late Policy

The assignment is due prior to midnight on the listed due date. For this assignment, that means you must turn in your solution before to May 2.

Unlike other classes you may have taken in the past, no late work is allowed for this class. This is worth repeating, because it is extremely important: no late work is allowed for this class. We will move quickly, and I do not want students straggling behind trying to catch up on work from previous weeks, which is what generally happens when late work is accepted.