Due by the end of Tuesday, October 31
Note that today you are going to be creating your first non-program class. I will give you a program that you need to run, but you shouldn't make any changes to it (except for deleting the lines I tell you delete when I tell you to delete them). You are going to create a brand new class (called Item), and all the code you write is going to be in that class.
Create a new project (L08) for the program ItemTest.java. Download the program. You can run it, but it doesn't do anything.
To begin, create the class Item in your l08 package. (Remember, it's a Java Class, not a Java Main Class. There shouldn't be a main method in the Item class.)
Add four instance variables to the Item class:
Add the constructor for the class. It allows any String for the name, but only non-negative values for the other fields. For invalid values, have it print a warning message and use zero. (Do not throw an exception! ItemTest is not ready to handle that!)
In ItemTest, delete the line saying DELETE THIS LINE FOR ACTIVITY 1. Run the project, and you should see output like this:
Note: The "Illegal ..." messages are not mistakes! They're what we expect to see.If you don't see them, then there's a mistake in your Item.java file.
In ItemTest, delete the three lines saying DELETE THIS LINE FOR ACTIVITY 2. (One of them is in main; the other two are around the method testGetters.) Run the program. You should see this output:
Remember that the name of a setter starts with set and ends with the name of the field (except capitalized in the first letter).
In ItemTest, delete the two lines saying DELETE THIS LINE FOR ACTIVITY 3. Run the program. You should see this output:
If there are any messages like
Submit this/these files:
You will be graded on the following: