* CENGAGE | MINBTAP Programming Exercise 3-10 D Instructions + JobPricing.java 1 import java.util.Scanner; 2 class JobPricing { Herbert's Home Repair estimates each job cost as the cost of public static void main(String[] args) { String description; double materials; 3 materials plus $35 per hour while on the job, plus $12 per hour for 4 travel time to the job site. /> double hoursonJob; double hoursTraveling; double price; 7 The main() method prompts the user for the name of a job (for 8 example, Smith bathroom remodel), the cost of materials, the 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 j ob 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 + 9 number of hours of work required, and the number of hours travel 10 time. 11 12 Pass the numeric data to a method that computes an estimate for 13 %3D 14 the job and returns the computed value to the main() method 15 %3D which displays the job name and estimated price. 16 17 An example of the program is shown below: 18 19 20 " is $" + price); Enter job descriptpon >> Room 210 Kitchen 21 } 22 Enter cost of materials >> 5,000 public static double computePrice(double materials, double hours, double t // Write your code here } 23 Enter hours on the job work >> 120 24 Enter hours traveling >> 0 25 The price for Room 210 Kitchen is $9200.0 26 } Grading Write your Java code in the area on the right. Use the Run button to compile and run the code. Clicking the Run Checks button will run pre-configured tests against your code to calculate a grade. Once you are happy with your results, click the Submit button to
* CENGAGE | MINBTAP Programming Exercise 3-10 D Instructions + JobPricing.java 1 import java.util.Scanner; 2 class JobPricing { Herbert's Home Repair estimates each job cost as the cost of public static void main(String[] args) { String description; double materials; 3 materials plus $35 per hour while on the job, plus $12 per hour for 4 travel time to the job site. /> double hoursonJob; double hoursTraveling; double price; 7 The main() method prompts the user for the name of a job (for 8 example, Smith bathroom remodel), the cost of materials, the 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 j ob 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 + 9 number of hours of work required, and the number of hours travel 10 time. 11 12 Pass the numeric data to a method that computes an estimate for 13 %3D 14 the job and returns the computed value to the main() method 15 %3D which displays the job name and estimated price. 16 17 An example of the program is shown below: 18 19 20 " is $" + price); Enter job descriptpon >> Room 210 Kitchen 21 } 22 Enter cost of materials >> 5,000 public static double computePrice(double materials, double hours, double t // Write your code here } 23 Enter hours on the job work >> 120 24 Enter hours traveling >> 0 25 The price for Room 210 Kitchen is $9200.0 26 } Grading Write your Java code in the area on the right. Use the Run button to compile and run the code. Clicking the Run Checks button will run pre-configured tests against your code to calculate a grade. Once you are happy with your results, click the Submit button to
Chapter10: Introduction To Inheritance
Section: Chapter Questions
Problem 14RQ
Related questions
Question
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning