1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
antiseptic1488 [7]
3 years ago
11

Design and implement your own simple class to represent any household item of your choice (toaster, fan, hair dryer, piano ...)

Your class should have a constructor, one additional method and at least one member variable (e.g. boolean isOn to turn the item on or off). Be sure you demonstrate your class works properly by constructing an instance of it and calling your method. Hint: check out the week 6 module readings under "additional readings". The guitar example is a good model for thisDesign and implement your own simple class to represent any household item of your choice (toaster, fan, hair dryer, piano ...) Your class should have a constructor, one additional method and at least one member variable (e.g. boolean isOn to turn the item on or off). Be sure you demonstrate your class works properly by constructing an instance of it and calling your method. Hint: check out the week 6 module readings under "additional readings". The guitar example is a good model for this..
Computers and Technology
1 answer:
emmasim [6.3K]3 years ago
8 0

Answer:

class fan{

   private String model;

   private boolean isOn;

   //Constructor goes here

   public fan(String model, boolean isOn) {

       this.model = model;

       this.isOn = isOn;

   }

   // An additional method goes here

   public boolean turnOn(boolean yes){

       if(yes) {

           this.isOn=true;

           System.out.println("Fan is blowing");

           return true;

       }

       else

           this.isOn=false;

           System.out.println("Fan is off");

           return false;

   }

}

Explanation:

Demonstrating the working of the class in a main method. Below is a complete code

public class fanTest {

   public static void main(String[] args) {

fan fan1 = new fan("Binatone", false);

       fan1.turnOn(false);

   }

}

class fan{

   private String model;

   private boolean isOn;

   //Constructor goes here

   public fan(String model, boolean isOn) {

       this.model = model;

       this.isOn = isOn;

   }

   // An additional method goes here

   public boolean turnOn(boolean yes){

       if(yes) {

           this.isOn=true;

           System.out.println("Fan is blowing");

           return true;

       }

       else

           this.isOn=false;

           System.out.println("Fan is off");

           return false;

   }

}

You might be interested in
Por favor definir que es un pseudocódigo y que es un diagrama de flujo.
marusya05 [52]

Answer:

que

Explanation:

8 0
3 years ago
Read 2 more answers
Which type of software has no restrictions from the copyright holder regarding modifications of the softwares internal instructi
gizmo_the_mogwai [7]
The software that has no restrictions from copyright holder regarding modification of the software's internal and its redistribution is called an Open source software. They are being provided for use and redistribution for free, with no cost. They can be easily downloaded on the Internet.
4 0
3 years ago
A computer game that can be purchased online and played right away has good _____ utility.
ratelena [41]
D. Time

It’s easy to access any time even after it was just purchased.

I hope this helped
6 0
3 years ago
In what way can a costume be deleted ?
alex41 [277]

Answer:

Clicking the "X" button towards the upper-right of each costume's icon in the Costume Pane will delete

Explanation:

5 0
2 years ago
What does the poster exemplify?
zloy xaker [14]

Answer:

try D

Explanation:

8 0
3 years ago
Read 2 more answers
Other questions:
  • Which operating system became obsolete with the arrival of a more advanced graphical user interfaces
    6·1 answer
  • In order to be accredited by the Better Business Bureau, a business is required to publish a privacy notice on its website that
    9·1 answer
  • The document asks about dependents because the number can
    12·2 answers
  • The shell that is used by default in linux is the _____ shell.
    12·1 answer
  • Write a method called rotate that moves the value at the front of a list of integers to the end of the list. For example, if a v
    6·1 answer
  • Find different between manocots and dicots clarify with example​
    14·1 answer
  • Npesta kenos reaction
    13·2 answers
  • The profile picture that you plan to use to market your professional brand on social media networks should feature you only.
    12·1 answer
  • Complete the procedure for pasting content from a Word document in a message by selecting the correct term from
    7·2 answers
  • Innovation made from establishment of abucas to the present 5th
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!