ITSC121S2020Lab10

From BU Computer Science
Jump to navigation Jump to search

Tenth Programming Lab, ITSC 121, Spring 2020

Overview

Write the following programs. One define the objects and one tests it

Program Description: Fans (edited problem 9.8)

Design a class names Fan to represent a fan. The class contains:

  • Three constants named SLOW, MEDIUM, and FAST with the values 1, 2, and 3 to denote the fan speed
  • A private int data field named speed that specifies the speed of the fan (the default is SLOW)
  • A private boolean data field named on that specifies whether the fan is on (the default is false)
  • A private double data field name radius that specifies the radius of the fan (the default is 5)
  • A string data field named color that specifies the color of the fan (the default is blue)
  • The accessor and mutator methods for all four data fields.
  • A no-argument constructor that creates a default fan.
  • A method named toString() the returns a string description for the fan. If the fan is on, the method returns the fan speed, color, and radius in one combined string. If the fan is not on, the method returns the fan color and radius along with the string "fan is off" in one combined string.
  • A method named equals that has one Fan as an argument and returns true if two fans are the same (same color and radius) and false otherwise.

Write a test program that creates two FAN objects. Assign maximum speed, radius 10, color yellow, and turn it on to the first object. Assign medium speed, radius 5</5>, color blue, and turn it off to the second object. Display the objects by invoking their toString() method. Also display if they are equal.

Reminders

  1. Include proper comments for all
  2. Use proper formatting, etc.
  3. Test with more than one set of data where it is appropriate
  4. Get the correct data outputted on the program before worrying about formatting

Submissions

  1. Create a software development report that includes the following for the program:
    • A problem summary (the big picture) for each program
    • A list of requirements for each program. (Things that this particular implementation of a solution must do)
    • A list of steps each of your programs do
    • A testing report for each program: What exact input you used and what output you got.
    • How long it took to write it, and how much time was on it each day!
    • Who you got help from (if you got help)
    • Changes (if any) you would make if you had more time and/or skill
    • At least two things you learned while writing the program(s)
  2. Create a zip folder with your software development report(s) and your java file(s) and submit that to canvas.
  3. Due date can be found on canvas