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
What are five types of applications you can create in Visual Basic 2017?
vampirchik [111]

Answer:

1) Windows Desktop applications

2) Windows Store apps

3) Web/Cloud applications

4) Office/SharePoint applications

5) Database applications.

6 0
3 years ago
Read 2 more answers
What common variation of the Server Message Block (SMB) sharing protocol is considered to be a dialect of SMB?
ser-zykov [4K]

Answer:

Common Internet File System

Explanation:

Given that the Server Message Block (SMB) has various types or variations. The most common variation of this Server Message Block sharing protocol that is considered to be a dialect of SMB is known as "Common Internet File System." This is known to serve as a form of a communication protocol for giving shared access to different outlets between nodes on a network.

Hence, in this case, the correct answer is "Common Internet File System"

8 0
3 years ago
What does Data storage enable a browser to do
eimsori [14]

Answer: Data storage enable a browser to have the Web Storage capabilities to easily enable the default with the IT administrator disabled such features and also clear quite exciting features.

Explanation: guessed

8 0
3 years ago
Por favor alguem poderia me falar qual PC e melhor: Computador Gamer Fox PC FPS Intel Core i5 8GB (GeForce GTX 1050Ti 4GB GDDR5)
Ivanshal [37]

Eu acredito no primeiro como ele tem uma GTX 1050ti, i5 e 2tb.

3 0
3 years ago
On a rheostat the first terminal is connected to a
Morgarella [4.7K]
On a rheostat the first terminal is connected to a
A ground return path
fined contact
Ceramic heat sink
Bbbbncnennanxkcndkfnrnenwn77819’cjchopeithlps they
5 0
3 years ago
Other questions:
  • Explain briefly why every person in the world is not connected to the Internet.
    9·1 answer
  • John has subscribed to a cloud-based service to synchronize data between his smartphone, tablet, and PC. Before allowing the dat
    10·1 answer
  • Experienced students may serve as mentors if they are at least age 21 and have at least 3 years of post-secondary education. In
    5·1 answer
  • Compute their Cartesian product, AxB of two lists. Each list has no more than 10 numbers.
    5·1 answer
  • Identify a stressor in your life. Conduct an internet search to locate at least two reliable sources of information on effective
    6·1 answer
  • Pls tell me the answer pls i need the answer
    6·2 answers
  • Which item is used for formatting in responsive web design?
    14·2 answers
  • What would give Lucy, an entry-level candidate, an edge over others while she seeks a programmer’s position? Lucy, an entry-leve
    11·1 answer
  • What keyword is used in Java to create a parent/child relationship between two classes?
    14·1 answer
  • Which window would show you bindings for local area connection 2?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!