Lab 3 Writing an OO Java Program

All work to be added, committed and pushed to the remote by 11:59PM on Sunday.
IMPORTANT: While you are in the lab, login in to a lab desktop, bring up chrome and visit this attendance app This will register your attendance in the lab. Make sure you have, at some point during the lab, logged in directly on a lab system (using the lab keyboard, monitor and mouse, no ssh!!).

Overview

This week, you are going to implement two Java classes (see the javadoc), test them, and play with them. You will complete the classes SodaCan.java and Person.java so that when TestSodaCan.java is executed, you get exactly TestSodaCanOut.txt, when TestPerson.java is executed, you get exactly TestPersonOut.txt. Finally, implement class Scenario.java. All of this is in your repo!!

Notes

  • SUBMISSION: Remember to "Commit and Push" your project at the end of your lab so we can see the most updated version of your lab work.
  • 1. Class SodaCan

    Implement the class SodaCan using instance variables and methods to capture the following... Once you are done implementing this class, write a main method which creates a few SodaCans and then takes sips and gulps from them.

    2. Class Person

    Implement the class Person using instance variables and methods to capture the following:

    3. Testing your Classes

    I have included test classes, which exercises your classes. Please make sure your output exactly matches mine. You may not change the TestXXXXXX.java in any way. Your output should match mine exactly.

    4. Playing with both classes

    Marking Scheme

    --------------------------------------------- 0/1 mark: all files submitted (SodaCan.java, Person.java, Scenario.java) 0/1 mark: has appropriate instance fields 0/2 mark: output for Person.java is identical to TestPersonOut.txt 0/2 mark: output for SodaCan.java is identical to TestSodaCanOut.txt 0/2 mark: output for Scenario.java is identical to ScenarioOut.txt ---------------------------------------------- TOTAL: 0/8 You can verify that the outputs match by, for example, ... javac Scenario java Scenario > MyScenarioOut.txt diff ScenarioOut.txt MyScenarioOut.txt # Above should return nothing if your output exactly matches mine