A2 ◦ Classes and Instances

  1. Log onto cs.bridgewater.edu.
  2. Create a new directory named Assignments in your repository.
  3. Change directory to your Assignments directory.
  4. Create a new directory named A2 inside Assignments.
  5. Change directory to your A2 directory.
  6. Create a java class named Item according to the following specifications.
    1. The class has 2 fields that hold the description of the item (String) and cost (double).
    2. The class has one constructor that sets the description and cost.
    3. The class has setters and getters for the fields.
  7. Create a driver class named Test according to the following specifications.
  8. When the program starts, the program creates two instances of the Item.  The first instance has the description “Pencil” with a cost of $0.99, and the second instance has the description “Notebook” with a cost of $2.49.
  9. The program prints to the screen the sum of the costs for the items using the getter methods.
  10. When finished writing, testing, and debugging your code, push your files to GitHub.

© 2018 – 2019, Eric. All rights reserved.