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
in Java programming Design a program that will ask the user to enter the number of regular working hours, the regular hourly pay
iren2701 [21]

Answer:

In Java:

import java.util.Scanner;

public class Main {

public static void main(String[] args) {

 int regularhour,overtimehour;

 float regularpay,overtimepay;

 Scanner input = new Scanner(System.in);

 

 System.out.print("Regular Hour: ");

 regularhour = input.nextInt();

 

 System.out.print("Overtime Hour: ");

 overtimehour = input.nextInt();

 

 System.out.print("Regular Pay: ");

 regularpay = input.nextFloat();

 

 System.out.print("Overtime Pay: ");

 overtimepay = input.nextFloat();

 

 float regulargross = regularhour * regularpay;

 float overtimegross = overtimehour * overtimepay;

 float totalgross = regulargross + overtimegross;

 

 System.out.println("Regular Gross Pay: "+regulargross);

 System.out.println("Overtime Gross Pay: "+overtimegross);

 System.out.println("Total Gross Pay: "+totalgross);

 

}

}

Explanation:

This line declares regularhour and overtimehour as integer

 int regularhour,overtimehour;

This line declares regularpay and overtimepay as float

 float regularpay,overtimepay;

 Scanner input = new Scanner(System.in);

 

This prompts the user for regular hour

 System.out.print("Regular Hour: ");

This gets the regular hour

 regularhour = input.nextInt();

 

This prompts the user for overtime hour

 System.out.print("Overtime Hour: ");

This gets the overtime hour

 overtimehour = input.nextInt();

 

This prompts the user for regular pay

 System.out.print("Regular Pay: ");

This gets the regular pay

 regularpay = input.nextFloat();

 

This prompts the user for overtime pay

 System.out.print("Overtime Pay: ");

This gets the overtime pay

 overtimepay = input.nextFloat();

 

This calculates the regular gross pay

 float regulargross = regularhour * regularpay;

This calculates the overtime gross pay

 float overtimegross = overtimehour * overtimepay;

This calculates the total gross pay

 float totalgross = regulargross + overtimegross;

 

This prints the regular gross pay

 System.out.println("Regular Gross Pay: "+regulargross);

This prints the overtime gross pay

 System.out.println("Overtime Gross Pay: "+overtimegross);

This prints the total gross pay

 System.out.println("Total Gross Pay: "+totalgross);

8 0
2 years ago
NEED HELP ASAP!!!
Triss [41]

Answer:

Feet & Inches

4). Millimeters

5). Pixels

3 0
2 years ago
What is the name for an object that is what it appears to be?
Gnesinka [82]
That would be a symbol
8 0
2 years ago
Instructions:Select the correct answer.
Dafna1 [17]
It would be a audio file -B.
8 0
3 years ago
A network administrator has been tasked with configuring access to the Internet for about 50 computers. The administrator has be
scoundrel [369]

Answer:

Proxy Server.

Explanation:

An administrator was given the responsibility of customizing Internet connection for around the numbers of computer systems. He stated the admin that those Internet connections need to go through a system connected to the internet because otherwise inbound and outbound traffic can still be examined but only that systems should have a Web address identified.

So, the admin configured Proxy Server because only certain systems have been identified the following address to the internet.

3 0
3 years ago
Other questions:
  • What microsoft operating systems started the process of authenticating using password and username
    14·1 answer
  • The issue with discovering a perfect solution to a problem is that ________.
    10·2 answers
  • What is the Kali Linux's kernel?<br><br> Sorry for english, but help me.
    12·1 answer
  • Answer these two if u can❤️
    5·2 answers
  • A work-study student receives a paycheck from:
    15·2 answers
  • What is human data,
    8·1 answer
  • Use the drop-down menus to match each description with the part of a report where it is located.
    10·1 answer
  • For all programs, you should write a small amount of code and _______
    6·1 answer
  • Assignment 6: Animation
    7·1 answer
  • You have a passage of text that needs to be typed out, but some of the letter keys on your keyboard are broken! You're given an
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!