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
If your laptop is not able to connect to your wireless network, which of the
krok68 [10]
The answer is A! Hope this is helpful!
8 0
2 years ago
Read 2 more answers
What is the difference between PowerPoint and Outlook?
Svetllana [295]

Answer:

PowerPoint is a presentation program; Outlook is a personal information management application.

Explanation:

Powerpoint is the program used in presentations where slides designed and then shown to the audience.

Outlook is used to display various types of personal information like calendar appointments and emails.

6 0
3 years ago
Who is the intended audience of a pseudocode document?
cluponka [151]

Answer and Example:

Pseudocode is an artificial and informal language that helps programmers develop algorithms.

Pseudocode is a "text-based" detail (algorithmic) design tool. The rules of Pseudocode are reasonably straightforward. All statements showing "dependency" are to be indented.

Pseudocode is understood by the programmers of all types. it enables the programmer to concentrate only on the algorithm part of the code development.

Java would use this.

3 0
3 years ago
Why is body language an important factor in a business meeting
slava [35]

The importance of the body language in business. Body language is a language without spoken words, it is called non verbal communication. We use it all the time in our social life and business life so it is all about gestures movements and expressions made by people to deliver a specific message to other people. Business meetings are all about making a good impression.

5 0
3 years ago
A function named function1 is defined in a module named module1. Suppose function1 has no parameter. Which of the following Pyth
Oduvanchick [21]

Answer:

Option C i.e., both A and B is the correct option to the following question.

Explanation:

Because in the following statement which is for the Python Programming Language, they can define the function i.e., "function1" without any argument and they can call that function with the help of another module then, they can call that function by using both methods. So that's why the following option is correct.

7 0
3 years ago
Other questions:
  • How can a user choose settings that will customize a presentation so that it is best to be played automatically at a kiosk rathe
    11·2 answers
  • What is the purpose of a Program Epic?
    7·2 answers
  • What is call by reference in function of c​
    13·1 answer
  • Given a String variable named line1, write a sequence of statements that use a Scanner to read the first line of a file named "p
    7·1 answer
  • What is the best yellow thing you can think of? (I need this for a presentation to turn it black and white.) Please no lemons.
    14·1 answer
  • Major characteristics of the bus in computer architecture​
    8·1 answer
  • Level Access Test - Please Ignore
    14·1 answer
  • Firestick optimizing system storage and applications
    14·1 answer
  • What hand-held gaming system did Nintendo release in 1989?
    9·1 answer
  • In java language I want the code
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!