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
True [87]
3 years ago
13

// Program prompts a user for name, hours worked,// and hourly pay rate// then computes gross pay and displays the name and gros

s pay// Modify the program to use four methods named// getName(), getHours(), getPayRate(), and computeGross()
Computers and Technology
1 answer:
Elza [17]3 years ago
7 0

Answer:

import java.util.Scanner;

public class num3 {

   public static void main(String[] args) {

       // Calling ComputeGross pay and getName

       System.out.println("Gross pay is for "+getName()+" is "+computGross());

   }

   // The method getName returns a string

   public static String getName(){

       System.out.println("Enter your name");

       Scanner in = new Scanner(System.in);

       String name = in.nextLine();

       return name;

   }

   //method getHours returns an int

   public static int getHours(){

       System.out.println("Enter your hours");

       Scanner in = new Scanner(System.in);

       int hours = in.nextInt();

       return hours;

   }

   //Method getPayRate returns a double

   public static double getPayRate(){

       System.out.println("Enter your pay rate");

       Scanner in = new Scanner(System.in);

       double payRate = in.nextDouble();

       return payRate;

   }

   //Calculates and returns the gross pay by multiplying payrate by hours worked

   public static double computGross(){

       double gross = getHours()*getPayRate();

       return gross;

   }

}

Explanation:

  • This is solved in Java programming language
  • Pay detailed attention to the comments in the solution
  • A main method is created where getName and computGross are called inside the output statement
  • Observe that the method computGross calls getHours and getPayRate within itself
You might be interested in
Which of the following recently developed technologies has NOT greatly increased the speed of information dissemination?
Luba_88 [7]
<span>The option which hasn't greatly increased the speed of information dissemination is C. typewriter. Information can be easily and quickly shared through smartphones that have Internet access, through emails which you can send at any time, and through teleconferencing, which is basically using your camera to talk to people. The only technology which isn't really helpful nowadays is the typewriter - there are better things, such as computers, that do a better job today.</span>
3 0
3 years ago
Read 2 more answers
What should you keep in mind when installing hard drives?
Diano4ka-milaya [45]
Always touch a metal object before installing to prevent short circuiting the hard drive.
5 0
3 years ago
Use an ifstream object named indata to read the first three integers from a file called lottowins and write each number to stand
Gemiola [76]

Answer:

int x;

indata.open("lottowins");

indata >> x;

cout << x << endl;

indata >> x;

cout << x << endl;

indata >> x;

cout << x << endl;

indata.close();

4 0
3 years ago
What is a critical consideration on using cloud-based file sharing and storage applications.
Dmitry [639]

Answer:

Determine if the software or service is authorized

Explanation:

:)

3 0
2 years ago
Folktales have characters with good or bad traits here are some good wise clever kind hardworking I have too add one more good t
s2008m [1.1K]

Answer: good generous bad greedy

Explanation:

5 0
3 years ago
Other questions:
  • What do u call a individual that loves motor bikes and leather and is in a rival group known as mods?
    5·1 answer
  • Suppose you are currently in the /home/hnewman/os/fall/2013 directory and would like to navigate to /home/hnewman/discreteStruct
    9·1 answer
  • Consider a channel that can lose packets but has a maximum delay that is known. Modify Protocol rdt2.1 to include sender timeout
    11·1 answer
  • How are economics<br> and scarcity related?
    14·1 answer
  • 9. Which of the following is the most popular eSport game ever?
    13·1 answer
  • Ian kno da answer tell me
    7·2 answers
  • We canconnect  two or more computer together using cables true or false​
    6·1 answer
  • Design a for loop that gets 6 integer numbers from a user, accumulates the total of them, then displays the accumulated total to
    9·1 answer
  • A client is looking to maximize value from its Cloud investments by baselining, profiling, and prioritizing its human capital ne
    9·1 answer
  • and assuming main memory is initially unloaded, show the page faulting behavior using the following page replacement policies. h
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!