Herbert’s Home Repair estimates each job cost as the cost of materials plus $35 per hour while on the job, plus $12 per hour for travel time to the job site. The main() method prompts the user for the name of a job (for example, Smith bathroom remodel), the cost of materials, the number of hours of work required, and the number of hours travel time. Pass the numeric data to a method that computes an estimate for the job and returns the computed value to the main() method which displays the job name and estimated price.

Question

Herbert’s Home Repair estimates each job cost as the cost of materials plus $35 per hour while on the job, plus $12 per hour for travel time to the job site.

The main() method prompts the user for the name of a job (for example, Smith bathroom remodel), the cost of materials, the number of hours of work required, and the number of hours travel time.

Pass the numeric data to a method that computes an estimate for the job and returns the computed value to the main() method which displays the job name and estimated price.

 

 

 

 

import java.util.Scanner;
class JobPricing {
    public static void main(String[] args) {
        String description;
        double materials;
        double hoursOnJob;
        double hoursTraveling;
        double price;
        Scanner input = new Scanner(System.in);
        System.out.print("Enter job description >> ");
        description = input.nextLine();
        System.out.print("Enter cost of materials >> ");
        materials = input.nextDouble();
        System.out.print("Enter hours on the job work >> ");
        hoursOnJob = input.nextDouble();
        System.out.print("Enter hours traveling >> ");
        hoursTraveling = input.nextDouble();
        price = computePrice(materials, hoursOnJob, hoursTraveling);
        System.out.println("The price for " + description +
                           " is $" + price);
    }

    public static double computePrice(double materials, double hours, double travel) {
        // Write your code here
    }
}

Expert Answer

Want to see the step-by-step answer?

Check out a sample Q&A here.

Want to see this answer and more?

Experts are waiting 24/7 to provide step-by-step solutions in as fast as 30 minutes!*

*Response times may vary by subject and question complexity. Median response time is 34 minutes for paid subscribers and may be longer for promotional offers.
Tagged in
Engineering
Computer Science

Java

Related Computer Science Q&A

Find answers to questions asked by students like you.

Q: Under what circumstances is file downloading through P2P much faster than through a centralized clie...

A: Peer to peer networking is an appropriated application design that allots applications between peers...

Q: Which of the following will lead to a compile-time error? Mark all that apply. if (a > b) c = 0 else...

A: In most of the programming language, the compiler time error occurs due to the incorrect syntax. The...

Q: What is the process ID of the first process that starts in RedHat Enterprise Linux system?

A: Explanation: PID refers to the Process ID that holds the process identifier in the process control ...

Q: Create a class called fun. Add to the class a static integer variable called count. Add a constructo...

A: Program approach: The Program is written as per the instruction given in the question The program c...

Q: Write a program that declares a constant named QUARTS_IN_GALLON which holds the number of quarts in ...

A: #include<iostream> using namespace std; int main(){     //initializing constant with 4    cons...

Q: what is the semantic similarity? what is measurement support semantic similarity? and explain each o...

A: SEMANTIC SIMILARITY: Semantic similarity is basically the matrix that is defined for any set of inp...

Q: Write a C++ program that reads data from an input file, takes the data and computes student grades f...

A: PROGRAM: //Adding the header files #include <iostream> #include <fstream> #include <i...

Q: I have no idea how to start this problem. This is the question - Write a program that declares two L...

A: PROGRAM: //Importing time header file to access the functions import java.time.*;   //Defining the c...

Q: We are going to move from fixed data already in the program which is printed directly to the screen ...

A: Program description: The java program is to prompt users to get the data values for the name of the ...