Java Programming, Loose-leaf Version
Java Programming, Loose-leaf Version
8th Edition
ISBN: 9781337685917
Author: Joyce Farrell
Publisher: Cengage Learning
bartleby

Concept explainers

bartleby

Videos

Question
Book Icon
Chapter 3, Problem 10PE
Program Plan Intro

Craft Pricing

Program Plan:

Define the class “CraftPricing”.

  • Define the main method.
    • Declare the required variables.
    • Get the values from the user using the scanner class.
    • Get the product name from the user.
    • Get the number of materials from the user.
    • Get the hours worked from the user.
    • Call the method “computePrice()”.
    • Print the result.
  • Definition of method “computePrice ()”.
    • Declare the variable.
    • Calculate the price.
    • Return the value of price.

Blurred answer
Students have asked these similar questions
I would like you to create a program that keeps track of the inventory (by make - e.g., Toyota) of cars on a used car lot. you will have to create two classes. The first is a simple Car class that consists of an inventory, make, and model. The second class you need to create for this challenge is the Lot. A Lot can contain many cars.   Part 1  Write the Car constructor, get methods, and toString method. Part 2 Write the Car's increase and decrease inventory methods. Part 3 Edit the Car so it implements Comparable and compares Car instances based on their inventory in descending order. Part 4  Write the getCars and getCarsSorted methods of the Lot class. Part 5  Write the getInventory method of the Lot class. Part 6  Use a try/catch block in the Car's constructor so that it sets the inventory to 0 if the inventory passed to the constructor is not a valid integer. this is the output that should be produced by main: Make: [Toyota Camry (10), Toyota Prius (4), Toyota Rav4 (16)] [Hyundai…
create a class named checkup with fields that you read a patient number, blood pressure figures (systolic or diastolic), and two cholesterol figures (ldl and hdl). include a method named computeratio() that divides ldl cholesterol by hdl cholesterol and displays the result. include an additional method named explainratio() that explains that hdl is knowns as “good cholesterol” and that a ratio of 3.5 or lower is considered optimum pseudo code
Create a class named Checkup with fields that hold a patient number, two blood pressure figures (systolic and diastolic), and two cholesterol figures (LDL and HDL). Include methods to get and set each of the fields. Include a method named computeRatio() that divides LDL cholesterol by HDL cholesterol and displays the result. Include an additional method named explainRatio() that explains that HDL is known as “good cholesterol” and that a ratio of 3.5 or lower is considered optimum. Save the class as CheckupType.cpp. Create a tester program named TestCheckup whose main() method declares four Checkup objects. Call a getData() method four times. Within the method, prompt a user for values for each field for a Checkup, and return a Checkup object to the main() method where it is assigned to one of main()’s Checkup objects. Then, in main(), pass each Checkup object in turn to a showValues()method that displays the data. Blood pressure values are usually displayed with a slash between the…
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:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
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