JAVA PROGRAM(LL)+MINDTAP (1 TERM) V2.0
JAVA PROGRAM(LL)+MINDTAP (1 TERM) V2.0
9th Edition
ISBN: 9780357616673
Author: FARRELL
Publisher: CENGAGE L
bartleby

Videos

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

Explanation of Solution

Program:

PaintCalculator.java

//import the required packages

import java.util.Scanner;

//define the class PaintCalculator

public class PaintCalculator

{

//declare the require constants

private static int AREA_PER_GALLON = 350;

private static double PRICE_PER_GALLON = 32;

//method that calculate the area, gallons of required paint and the total price

public static double calculate(double length, double height, double width)

{

//calculate the area

double area = length * height * 2 + width * height * 2;

//call the method calculateGallons()

double gallonsRequired = calculateGallons(area);

//print the gallonsRequired

System.out.println("Require Gallons of paint: " + gallonsRequired);

//calculate the price

double price = gallonsRequired * PRICE_PER_GALLON;

//return price

return price;

    }

//define the method calculateGallons()

public static double calculateGallons(double area)

{

//returns the number of gallons for the given area

return area/AREA_PER_GALLON;

}

//define the main method

public static void main(String[] args)

    {

//declare the required variables

int length, height, width;

//create the object for Scanner class

Scanner inputScanner = new Scanner(System.in);

//prompt the user to enter length of room

System.out.print("Enter Length of the room: ");

//read the length from the user

length = inputScanner.nextInt();

//prompt the user to enter width of room

System.out.print("Enter Width of the room: ");

//read the width from the user

width = inputScanner.nextInt();

//prompt the user to ente Height of room

System...

Blurred answer
Students have asked these similar questions
Given a 16-bit word of 1011011001101001 read from memory, and assuming the original check bits were 10101, apply the Hamming error correction code to: a)Find the new check b)Calculate the syndrome c)Determine whether there is an error in the received word, and if so, correct it to find the original word stored in memory
This is a question that I have and would like someone who has experiences with scene graphs and entity component systems to answer.For context, I am currently implementing a game engine and currently I am debating on our current design.Our current design is we have a singular game component class that every component inherits from. Where we have components like SpriteRendererComponent, Mehs Component, etc. They inherit from this GameComponent class. The point of this is being able to have O(1) access to the scene to being able to modify components to attach more components with the idea of accessing those components to specific scene objects in a scene.Now, my question is what kinds of caveauts can this cause in terms of cache coherence? I am well aware that yes its O(1) and that is great but cache coherence is going to be really bad, but would like to know more explicit details and real-life examples such as write in RAM examples on how this is bad. A follow-up question that is part…
Q4: Consider the following MAILORDER relational schema describing the data for a mail order company. (Choose five only). PARTS(Pno, Pname, Qoh, Price, Olevel) CUSTOMERS(Cno, Cname, Street, Zip, Phone) EMPLOYEES(Eno, Ename, Zip, Hdate) ZIP CODES(Zip, City) ORDERS(Ono, Cno, Eno, Received, Shipped) ODETAILS(Ono, Pno, Qty) (10 Marks) I want a detailed explanation to understand the mechanism how it is Qoh stands for quantity on hand: the other attribute names are self-explanatory. Specify and execute the following queries using the RA interpreter on the MAILORDER database schema. a. Retrieve the names of parts that cost less than $20.00. b. Retrieve the names and cities of employees who have taken orders for parts costing more than $50.00. c. Retrieve the pairs of customer number values of customers who live in the same ZIP Code. d. Retrieve the names of customers who have ordered parts from employees living in Wichita. e. Retrieve the names of customers who have ordered parts costing less…
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
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
CPP Function Parameters | Returning Values from Functions | C++ Video Tutorial; Author: LearningLad;https://www.youtube.com/watch?v=WqukJuBnLQU;License: Standard YouTube License, CC-BY