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
Which branch of science helps avoid or minimize stress-related injuries at workplace?
worty [1.4K]
Psychology, because psychology is the study of how the mind works, and therefor what causes stress.
3 0
3 years ago
Read 2 more answers
Make The PYTHON Code<br><br> print first 3 character of a string - given "Seattle" expected "Sea"
vlada-n [284]

This program uses a conditional to determine if seafood is safe to consume.

IF (seafood = "mollusk" OR daysFrozen ≥ 7) { rating ← "safe" } ELSE { rating ← "unsafe" }

In which situations will rating be "safe"?

️Note that there may be multiple answers to this question.

Choose all answers that apply:Choose all answers that apply:

1. When sea food is mollusk and day frozen is 1

2.When sea food is mollusk and day froze is 9

3. When see food salmon and day frozen is 7

<em>Did that help?</em>

6 0
2 years ago
A company has an Aruba solution. The company wants to host a guest login portal with this solution, and the login portal must gi
mariarad [96]

Answer: D. Choose ClearPass or the other external captive portal option for the guest WLAN.

Explanation:

The Aruba Instant On mobile app allows the configuration and monitoring of a network from anywhere. It provides an affordable solution to small businesses and they're reliable and secure.

Based on the criteria given in the question, the network administrator can meet the criteria by choosing a ClearPass or the other external captive portal option for the guest WLAN.

8 0
3 years ago
Which are benefits of modeling a solution? Choose all that apply. allows you to be sure the problem and solution are understood
labwork [276]

Answer:

A,B,D

A. Allows you to be sure the problem and solution are understood

B. Presents the solution in a manner that is easy to share

C. Is a starting point for all other activities

4 0
3 years ago
Read 2 more answers
Who was the creator of the game Fnaf?
Lisa [10]
"Scott Cawthon" did that.........
8 0
3 years ago
Read 2 more answers
Other questions:
  • Where is the insert function button found in microsoft excel?
    11·1 answer
  • Read the spreadsheet formula below, then answer the question.
    14·2 answers
  • "under the control panel, what console contains print management, computer management, and event viewer?"
    11·1 answer
  • How do switches and bridges learn where devices are located on a network?
    5·1 answer
  • Please help me please
    6·1 answer
  • Which of these personal protective equipment items prevents injury from falling objects ?
    15·1 answer
  • Write a class called Person that has two data members - the person's name and age. It should have an init method that takes two
    12·1 answer
  • Why is simplicity important in navigation design?
    13·1 answer
  • If you wanted to divide an integer variable by 2, which of the following lines of code would you use? total = int + 2 total = in
    6·1 answer
  • A network of computers that provides access to information on the web.
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!