Java Programming
Java Programming
8th Edition
ISBN: 9781305981829
Author: Joyce Farrell
Publisher: Cengage Limited
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
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 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…
An artist's discography includes several albums. Each album includes several songs. We want to model the Discography, Album and Song classes as follows • a discography has a single artist attribute and a total_time method that returns the total minutes corresponding to the artist's entire discography • an album has a single name attribute and a total_time method that returns the total minutes for the songs on the album a song has two attributes: title and duration and a duration method that returns the duration in minutes of the song • we want to take advantage of the composite pattern so that the duration method delivers the total number of minutes of a song, album or the entire discography of the artist depending on the object in question a) Draw a UML class diagram showing the solution b) Write the Ruby code that implements it
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
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
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