EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
9th Edition
ISBN: 9781337671385
Author: FARRELL
Publisher: CENGAGE LEARNING - CONSIGNMENT
bartleby

Concept explainers

bartleby

Videos

Expert Solution & Answer
Book Icon
Chapter 3, Problem 10PE

Explanation of Solution

Program code:

JobPricing.java

//import the packages

import java.util.Scanner;

//define class JobPricing

class JobPricing

{

//define main() method

public static void main(String[] args)

{

//variable to store name of the job

String description;

//variable to store cost of materials

double materials;

//variable to store working hours

double hoursOnJob;

//variable to store traveling hours

double hoursOnTraveling;

//variable to store total cost for the job

double price;

//create an object of Scanner

Scanner input = new Scanner(System.in);

//prompt for job name

System.out.print("Enter job description >> ");

//reading job name

description = input.nextLine();

//prompt for cost of materials

System.out.print("Enter cost of materials >> ");

//reading cost of materials

materials = input.nextDouble();

//prompt for working hours

System.out.print("Enter hours on the job work >> ");

//reading working hours

hoursOnJob = input.nextDouble();

//prompt for traveling hours

System.out.print("Enter hours traveling >> ");

//reading traveling hours

hoursOnTraveling = input.nextDouble();

//calling method computePrice to calculate total cost

price = computePrice(materials, hoursOnJob, hoursOnTraveling);

//printing output

System.out...

Blurred answer
Students have asked these similar questions
Create a class named Purchase. Each Purchase contains an invoice number (private int), amount of sale (private double), and amount of sales tax (private double). Include set methods for the invoice number and sale amount. Within the set() method for the sale amount, calculate the sales tax as 5% of the sale amount. Also include a display method that displays a purchase’s details (i.e invoice, sale amount and tax). Save the file as Purchase.java.   2. Create an application (with main ()) that declares a Purchase object (using class defined in previous question) and prompts the user if he/she wants to enter an invoice number (1-yes, 0 – no). If user enters 1 then the program will prompt for an invoice number, do not let the user proceed until a number between 1,000 and 8,000 has been entered. Next, the program prompts for a sale amount, do not proceed until the user has entered a nonnegative value. Using the values entered by the user create a Purchase object, display the object’s…
Instructions This assignment must follow directions exactly. Create a class Lab02 with a main method, and put all of the following code into the main method: Print the prompt shown below and ask the user for the number of exemptions. The number of exemptions is an integer. Print the prompt shown below and ask the user for their gross salary. The gross salary represents dollars, which can be entered with or without decimal points. Print the prompt shown below and ask the user for their interest income. The interest income represents dollars, which can be entered with or without decimal points. Print the prompt shown below and ask the user for their capital gains income. The capital gains represents dollars, which can be entered with or without decimal points. Print the prompt shown below and ask the user for the amount of charitable contributions. The charitable contributions represents dollars, which can be entered with or without decimal points. Perform the calculation of…
Create an Automobile class for a dealership. Include fields for an ID number, make, model, color, year, and miles per gallon. Include get and set methods for each field. Do not allow the ID to be negative or more than 9999; if it is, set the ID to 0. Do not allow the year to be earlier than 2005 or later than 2019; if it is, set the year to 0. Do not allow the miles per gallon to be less than 10 or more than 60; if it is, set the miles per gallon to 0. Include a constructor that accepts arguments for each field value and uses the set methods to assign the values.
Knowledge Booster
Background pattern image
Computer Science
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.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Introduction to Classes and Objects - Part 1 (Data Structures & Algorithms #3); Author: CS Dojo;https://www.youtube.com/watch?v=8yjkWGRlUmY;License: Standard YouTube License, CC-BY