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

Videos

Expert Solution & Answer
Book Icon
Chapter 2, Problem 2CP

Explanation of Solution

Program code:

SammsRentalPrice.java

//import the required header files

import java.util.Scanner;

//create a class

public class SammsRentalPrice

{

//define the main() method

public static void main(String[] args)

{

//create an object of Scannr class

Scanner scan = new Scanner(System.in);

//prompt the user to enter the number of minutes

System.out.println("Enter the number of minutes: ");

//scan fo the inpout

int minutes = scan.nextInt();

//calculate the number of hours

int hours = minutes/60;

//set the value of minutes

minutes = minutes%60;

//calculate total cost

int totalCost = hours*40 + minutes;

//print the values

System.out...

Blurred answer
Students have asked these similar questions
Hi, I need help with the following assignment. Implement a program that reads in a year and outputs the approximate value of a Ferrari 250 GTO in that year. Use the following table that describes the estimated value of a GTO at different times since 1962.   Year Value 1962-1964 $18,500 1965-1968 $6,000 1969-1971 $12,000 1972-1975 $48,000 1976-1980 $200,000 1981-1985 $650,000 1986-2012 $35,000,000 2013-2014 $52,000,000
In your favorite open world adventure video game, currency conversion is as given below:     1 Gold coin 23 Bolts 1 Gem 13 Gold coins Write a program that takes a number of Bolts as user input (as an integer) and converts it to the number of whole Gems, Gold coins, and Bolts as shown below. The conversion information between these measurement metrics is provided in the table above. The number of Bolts should be converted in such a way that maximizes the whole number of Gems and Gold coins. Expected output 1 (bold is user input) Enter the number of Bolts: 32 0 Gems(s) 1 Gold coin(s) 9 Bolt(s) Expected output 2 (bold is user input) Enter the number of Bolts: 3000 10 Gem(s) 0 Gold coin(s) 10 Bolt(s) The file should be named as convertCurrency.cpp. Don’t forget to head over to Coderunner on Canvas and paste your solution in the answer box!
You are working for a lumber company, and your employer would like a program that calculates the cost of lumber for an order. The company sells pine, fir, cedar, maple, and oak lumber. Lumber is priced by board feet. One board foot equals one square foot that is one inch thick. Theprice per board foot is given in the following table: Pine 0.89Fir 1.09Cedar 2.26Maple 4.50Oak 3.10 The lumber is sold in different dimensions (specified in inches of width and height, and feet of length) that need to be converted to board feet. For example, a 2 x 4 x 8 piece is 2 inches wide, 4 inches high, and 8 feet long, and is equivalent to 5.333 board feet (2 * 4 * 8 = 64, which when divided by 12 = 5.333 board feet). An entry from the user will be in the form of a letter and four integer numbers. The integers are the number of pieces, width, height, and length. The letter will be one of P, F, C, M, O (corresponding to the five kinds of wood) or T, meaning total. When the letter is T, there are no…
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
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Java random numbers; Author: Bro code;https://www.youtube.com/watch?v=VMZLPl16P5c;License: Standard YouTube License, CC-BY