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
vodomira [7]
3 years ago
6

In this exercise, you will write a class that represents how you spend your time during the week The class should have four doub

le instance variables . . sleep fun School sports These variables will track the number of hours you spend doing each of these activites in a single day, respectively The class should also have the following methods • A constructor that has no parameters public void setsleept double hours Sleep) public vold setFun(double hourstun public void set School(double hours School) public void set Sports (double hours Sports) mbate vota print Total) The constructor should initialize all of the instanco variables to 0 The methods that begin with "set" set the values of the corresponding instance variables to the value of the parameter The last method should print the total number of hours per week you spend doing each of these activities Note you will have to calculate the weekly hours by using the daily hours stored in the instance variables. It should also print the . . . . public void set School Buble hours School) Dublic void set Sports (double hours Sports) Dublic vota print Total The constructor should initialize all of the instance valables to o The methods that begin with "set" set the values of the corresponding instance variables to the value of the parameter The last method should point the total number of hours per week you spend doing each of these activities Note you will have to calculate the weekly hours by using the daily hours stored in the instance variables it should also print the total number of hours in the week accounted for and how many hours are left over Here is an example of the output of print Totate 3, chool - 8 = 2 and sports = 3 Weekly Totais STED School Dort Funt Ora Tot turto 0
Computers and Technology
1 answer:
Nuetrik [128]3 years ago
4 0

Answer:

Answered below

Explanation:

# Program is written in Java

class WeekHours{

double school;

double fun;

double sleep;

double sports;

WeekHours( ){

school = 0.0;

fun = 0.0;

sleep = 0.0;

sports = 0.0;

}

public void setSchool ( double x){

school = x;

}

public void setFun( double y){

fun = y;

}

public void setSleep( double w){

sleep = w;

}

public void setSports( double z){

sports = z;

}

public void totalHours(){

double tHours = school + fun + sleep + sports;

System.out.print(tHours);

}

}

You might be interested in
Define computer memory and write its type <br>​
Helga [31]

Answer:

Computer memory is a generic term for all of the different types of data storage technology that a computer may use, including RAM, ROM, and flash memory. ... Another way that computer memory can vary is that some types are non-volatile, which means they can store data on a long term basis even when there is no power

4 0
3 years ago
Read 2 more answers
Safety Data Sheet gives information about
Elina [12.6K]
Safety Data sheet gives information about the product imported in a form of a document. Importers and manifacturers make these Safety Data sheet to detail the product of its physical and chemical properties which are hazardous and harmful. This is a safety protocol on every company.
8 0
3 years ago
Read 2 more answers
You want to view a list of users on a linux system. what command should you use?
vredina [299]
Answer is A: cat /use/passwd
7 0
2 years ago
In Oracle, _____ make(s) it possible to merge SQL and traditional programming constructs, such as variables, conditional process
ExtremeBDS [4]

Answer:

Procedural SQL

Explanation:

3 0
3 years ago
Describe a situation when you would use a conditional statement in a program. Describe the action that would occur when the cond
kramer

Answer:  Conditional statements are just true false statements

Explanation:

Let's say there's a kpop band burglarizing my house and I have a super AI that detects if a kpop band is my house through cameras. What it would do is change a variable "kpopBandInHouse = False" to True. I would then have an if statement next with a custom function:

if kpopBandInHouse == True:

   nukeHouse()

So if the conditional statement is true, it nukes my house. It is false, it does not nuke my house.

7 0
3 years ago
Other questions:
  • In addition to talking to other doctors remotely, telegraphy technology?
    5·1 answer
  • Write an application that displays appropriate prompts to the user and reads a person
    11·1 answer
  • 40 points to answer ALL
    9·2 answers
  • Ano ang maikling kwento??
    9·1 answer
  • When the code that follows is executed, a message is displayed if the value the user entersvar userEntry = (prompt("Enter cost:"
    11·1 answer
  • How do I insert a row above the selected row in between row and row 2 revenue xls
    5·1 answer
  • The set of three integer values for the lengths of the sides of a right triangle is called a Pythagorean triple. These three sid
    8·1 answer
  • Which of the following is NOT true about a flow chart?
    8·1 answer
  • What report provides data on how specific sections of a website performed?
    6·1 answer
  • An additional factor in how an element is rendered is that properties are passed from a parent element to its children in a proc
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!