Site Navigation

Site Search

CS 110: Program 3

Student Learning Objectives

Program 3 Assignment

Write a class named Item that holds data about an item in a retail store.

Write a separate class called Inventory with a main method that creates three Item objects and then produces a neatly formatted table of the store's inventory displaying the three items, their current inventory value, and the total inventory value for the store.

Sample Output

sample output

Duplicate the format of the output exactly. Test your output with different items in inventory.

Hint: the tab character (\t) is used for alignment in the table.

File Header Comment

Include a file header comment at the top of both source code files. Include the assignment number, your cs110 account number, your name, completion time, and the honor code.

Remember, program assignments are to be done on your own. If you receive help understanding or debugging the assignment, you must acknowledge the person who helped. You must do the coding on your own.

// Assignment: Program 3
// Account: (Enter your cs110 account number here)
// Author: (Enter your full name here)
// Completion time: (Enter the total number of hours you
//                   spent on the total assignment)
// Honor Code: I pledge that this program represents my own
//   program code. I received help from (enter the names of
//   others that helped with the assignment, write no one if
//   you received no help) in understanding and debugging my program.

Add inline comments for every three to five lines of code. Skip a blank line before every inline comment.

Optional Extra Credit

In addition to the jGRASP console output produced above, add the code to also display a JOptionPane with the inventory.

joptionpane (8K)

Duplicate the format of the JOptionPane exactly. Test your output with different items in inventory

Note: For extra credit, your program should produce both sets of output, the neatly formatted table produced with System.out.println statements and the window output produced by the JOptionPane.

What to turn in at the start of the next lab

Grading Criteria

20 points possible plus 2 points extra credit
CS 110 Program 3 Grading Sheet (PDF)