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 three-key sequence will bring up the task manager or allow a user to log off or restart the computer?.
Kobotan [32]

Answer:

Ctrl + Alt + Del

Explanation:

4 0
2 years ago
Name the part of the computer that stores all information and software.
Paladinen [302]

Answer:

Hard Drive

Explanation:

8 0
3 years ago
Read 2 more answers
What is one disadvantage of transmitting personal data using digital signals?
a_sh-v [17]

Answer: The answer to your question is B i hope this helps

the reason for this is because useing digital signals can be hac,ked or accessed by another person so there for you maybe have to use another way.

Explanation:

i hope this helps if it does have a brilliant day and have a smile

6 0
3 years ago
Read 2 more answers
1. Write programming code in C++ for school-based grading system. The program should accept the Subject and the number of studen
satela [25.4K]

In this program, I am using the school-based grading system and the program should accept the subject and the number of students.

Program approach:-

  • Using the necessary header file.
  • Using the standard I/O namespace function.
  • Define the main function.
  • Declare the variable.
  • Display enter obtain marks in 5 subjects.
  • Return the value.

Program:-

//header file

#include<iostream>

//using namespace

using namespace std;

//main method

int main()

{

//declare variable

  int j;

  float mark, sum=0, a;

//display enter obtain marks in 5 subjects

  cout<<"Enter Marks obtained in 5 Subjects: ";

  for(j=0; j<5; j++)

  {

      cin>>mark;

      sum = sum+mark;

  }

  a = sum/5;

//display grade

  cout<<"\nGrade = ";

  if(a>=91 && a<=100)

//display a1

      cout<<"a1";

  else if(a>=81 && a<91)

//display a2

      cout<<"a2";

  else if(a>=71 && a<81)

      cout<<"b1";

  else if(a>=61 && a<71)

      cout<<"b2";

  else if(a>=51 && a<61)

//display c1

      cout<<"c1";

  else if(a>=41 && a<51)

//display c2

      cout<<"c2";

  else if(a>=33 && a<41)

//display d

      cout<<"d";

  else if(a>=21 && a<33)

//display e1

      cout<<"e1";

  else if(a>=0 && a<21)

//display e2

      cout<<"e2";

  else

//display invalid

      cout<<"Invalid!";

  cout<<endl;

//return the value

  return 0;

}

Learn more grading system

brainly.com/question/24298916

7 0
3 years ago
To use a resource from a module, you write the name of the module as a qualifier, using which symbol before the name of the reso
Sladkaya [172]

Answer:

d. .

Explanation:

Dot (.) symbol is used to access the resource from the module. It is used to establish the connection between resource and module.

While on the other hand "=" is an assignment operator that is used to assign a value to the variable. "*" is use for the purpose of multiplication of two values in variables. Double Inverted commas ("") used to print the statement written between them.

7 0
3 years ago
Other questions:
  • Which other capabilities do many wireless access points have? Choose two answers.
    9·1 answer
  • Give two reasons why cloud computing could be harmful to an organization.<br> (No choices!)
    15·1 answer
  • Nearly all states allow citizens who are not able to go to the polls due to business travel to vote using this method: Internet
    9·2 answers
  • Based on the type of document you want to create, you must first select the page
    15·2 answers
  • A function ________ contains the statements that make up the function.
    5·1 answer
  • I need help ASAP Asap asap!!!
    11·1 answer
  • Both the original location and destination must be visible in file explorer when you
    11·1 answer
  • My PC won't output any data does anyone have any ideas​
    9·1 answer
  • Uploading Your Work
    14·1 answer
  • Mary and Billy are moving away to college and both know in their hearts that they need to end their relationship. They move away
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!