CS1010 -- Lab 3: Class Implementation

Winter 2005-2006
Outcomes Addressed
Details

You will create a Robot class and supporting driver class with a main method that will create a number of robots and have them perform a set of specific tasks.

Robot class

You should implement the class shown in the following UML class diagram:

Robot
- robotName: String
- energyLevel: long
- energyForDishes: long
- energyForRoomCleaning: long
- energyForLaundry: long
+ Robot()
+ Robot(name: String)
+ setEngergyLevels(dish: long, room: long, laundry: long): void
+ setRobotName(name: String): void
+ getEnergyLevel(): long
+ chargeNow(energy: long): void
+ washTheDishes(): void
+ cleanTheRoom(): void
+ doTheLaundry(): void

Be sure to note the following:

Driver class

You should also write a driver program that creates three robots: Emily, Jacob, and Emma. Emily should wash the dishes twice and clean the room once. Jacob should wash the dishes once, clean the room once, and do the laundry once. Emma should clean the room once, get a boost of 50 energy units and then do the laundry five times. After all of the tasks have been performed, the current energy level for each robot should be displayed on the console.

The program should set the energy required for washing the dishes to 10 units; the energy required for clean the room to 40 units; and the energy required for do the laundry to 20 units.

Lab report (due 11:00pm, the day prior to week 6 lab)

Each student should indicate how much time you spend on this assignment in the FAST system. You are encouraged to log your activity as you work on the project. At a minimum, you should log all of the time spent on this assignment before the due date given above. All time spent on this assignment should be entered into the week 5 column (even if you worked on it in week 6).

Dr. Taylor's students should use this XML template as a starting point for their reports.

Each student should submit a lab report. Your report should include:

As with any report you submit, correct spelling and grammar are required. In addition, your report should be submitted electronically following the Electronic submission guidelines. (You may wish to consult the sample report before submitting your report.) Be sure to keep copies of all your files, in case something gets lost.

If you have any questions, consult your instructor.

Acknowledgment

This laboratory assignment was developed by Dr. Chris Taylor and is based on a similar assignment by Dr. Mark Hornick.

Last Updated: Thursday, 01-Jan-2015 13:28:57 CST