Absolute Java (6th Edition)
6th Edition
ISBN: 9780134041674
Author: Walter Savitch, Kenrick Mock
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Textbook Question
Chapter 1, Problem 10PP
Scientists estimate that roughly 10 grams of caffeine consumed at one time is a lethal overdose. Write a
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
A parking garage charges a $2.00 minimum fee to park for up to three hours. The garage charges an additional $0.50 per hour for each hour or part thereof in excess of three hours. The maximum charge for any given 24-hour period is $10.00. Assume that no car parks for longer than 24 hours at a time. Write a program that calculates and prints the parking charges for each of three customers who parked their cars in this garage yesterday. You should enter the hours parked for each customer. Your program should print the results in a neat tabular format and should calculate and print the total of yesterday’s receipts. The program should use the function calculateCharges to determine the charge for each customer. Your outputs should appear in the following format Sample output Enter the hours parked for 3 cars: 1.5 4.0 24.0 Car Hours Charge 1 1.5 2.00 2 4.0 2.50 3 24.0 10.00 TOTAL 29.5 14.50
A parking garage charges a $20.00 minimum fee to park for up to three hours. The garage charges an additional $5.00 per hour for each hour or part thereof in excess of three hours. The maximum charge for any given 24- hour period is $50.00. Assume that no car parks for longer than 24 hours at a time. Write a program that calculates and printsthe parking charges for each of three customers who parked their cars in this garage yesterday. You should enter the hours parked for each customer. Your program should print the results in a neat tabular format and should calculate and print the total of yesterday’s receipts. The program should use the function calculateCharges to determine the charge for each customer. Your outputs should appear in the following format: Car Hours Charge1 1.5 20.002 4.0…
Airline companies apply baggage restrictions for their passengers. An
airline company has decided to apply a 10kg limitation for
passengers' hand luggage and 20kg for their normal baggage. When
passengers arrive, they enter their hand and normal luggage weight
from the keyboard. If passengers exceed their normal baggage
allowance of 10 dollars per gram, they pay 12 dollars per kg.
Accordingly, write the program that calculates the baggage price of
the airline they will go to according to the baggage values entered by
the arriving passenger and keeps this from closing the program for
each passenger. Note: If hand and normal baggage allowances are
stretched below the maximum value, the payment amount will be
considered not negative. An example printout is given on the right.
Geri bildirim gönder
Chapter 1 Solutions
Absolute Java (6th Edition)
Ch. 1 - If the following statement were used in a Java...Ch. 1 - Give a statement or statements that can be used in...Ch. 1 - Write a complete Java program that uses to output...Ch. 1 - What is a compiler?Ch. 1 - What is a source program?Ch. 1 - What is an object program?Ch. 1 - What do you call a program that runs Java...Ch. 1 - Suppose you define a class named NiceClass in a...Ch. 1 - Prob. 9STECh. 1 - Prob. 10STE
Ch. 1 - Can a Java program have two different variables...Ch. 1 - Give the declaration for two variables called feet...Ch. 1 - Give the declaration for two variables called...Ch. 1 - Prob. 14STECh. 1 - Prob. 15STECh. 1 - Prob. 16STECh. 1 - Convert each of the following mathematical...Ch. 1 - What is the output of the following program...Ch. 1 - What is the output produced by the following lines...Ch. 1 - Prob. 20STECh. 1 - Given the following fragment that purports to...Ch. 1 - What is the output produced by the following lines...Ch. 1 - What is the output produced by the following lines...Ch. 1 - What is the output produced by the following?
Ch. 1 - What is the output produced by the following?...Ch. 1 - What is the output produced by the following?...Ch. 1 - What is the output produced by the following?
Ch. 1 - Prob. 28STECh. 1 - Prob. 29STECh. 1 - What is the output of the following two lines of...Ch. 1 - Suppose sam is an object of a class named Person...Ch. 1 - The following code is supposed to output the...Ch. 1 - Prob. 33STECh. 1 - What is the output produced by the following Java...Ch. 1 - What is the normal spelling convention for named...Ch. 1 - Write a line of Java code that will give the name...Ch. 1 - Body Mass Index (BMI) helps in specifying the...Ch. 1 - The video game machines at your local arcade...Ch. 1 - Write a program that starts with the string...Ch. 1 - A government research lab has concluded that an...Ch. 1 - Write a program that starts with a line of text...Ch. 1 - Write a program for calculating the simple...Ch. 1 - Write a program that outputs the number of hours,...Ch. 1 - The following program will compile and run, but it...Ch. 1 - A simple rule to estimate your ideal body weight...Ch. 1 - Scientists estimate that roughly 10 grams of...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
Determine the force in each member of the Pratt truss, and state if the members are in tension or compression. ...
INTERNATIONAL EDITION---Engineering Mechanics: Statics, 14th edition (SI unit)
The solid steel shaft AC has a diameter of 25 mm and is supported by smooth bearings at D and E. It is coupled ...
Mechanics of Materials (10th Edition)
Line Numbers Write a program that asks the user for the name of a file. The program should display the contents...
Starting Out with Python (4th Edition)
This optional Google account security feature sends you a message with a code that you must enter, in addition ...
SURVEY OF OPERATING SYSTEMS
Explain the different aspects of the cost of a programming language.
Concepts Of Programming Languages
What is the difference between an array and an aggregate type?
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
Knowledge Booster
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
- Write a program that asks the user for the number of adult and the number of child movie tickets they are purchasing. (Store these values in variables using meaningful names.) Print the percentage of adult tickets followed by a space and the percentage of child tickets. Example: Suppose they are purchasing are 8 adult tickets and 12 child tickets. There are 20 total tickets being purchased. The percentage of adult tickets can be calculated as 100*(8 / 20). For example: Input Result 8 12 40.0 60.0arrow_forwardf. A laborant in a laboratory does a number of antigen tests in one day. Write a program that simulates the number of antigen tests done in a day in a laboratory, displays the number of positives and negatives, and calculates the % of positives in one day. Your program needs to first generate a random number that will show the number of tests done in a day. One laboratory in a day cannot do more than 100 tests and less than 1 (they do at least one). Then for each of the tests, your program needs to generate a random number to show whether they are positive or negative. In order to write this program, you need to have the following three functions used by the main function: test result (void): This function generates a test result. It should randomly return either one or zero. 1 means positive test result and 0 means negative test result. float positive percentage (int,int) : This function takes the total number of positives and the total number of tests and returns the % of positives.…arrow_forwardwrite a program to calculate electricity bill charged to a consumer.Ask him to enter the unit consumed.for all units less than or epual to 200,each unit is to be charged at RS.2.if unit is greater than 200 and less than or equal to 400, first 200 units is to be charged at RS. 2 and other units is charged at Rs. 4. Each unit more than 400 will be charged at RS. 5.arrow_forward
- Write a program to calculate the net pay of an employee. Input the basic pay and calculate the net pay as follows: House rent is 45% of basic pay. Medical allowance is 2% of basic pay if basic pay is greater than Rs. 5000/-. It is 5% of basic pay if the basic pay is less than Rs. 5000/-. Conveyance allowance is Rs. 96/- if basic pay is less than Rs. 5000/-. It is Rs. 193/- if the basic pay is more than Rs. 5000/- Net pay is calculated by adding basic pay, medical allowance, conveyance allowance and house rant. using ooparrow_forwardWrite a program that calculates the potential energy of 3 charges q1 = 1, q2 = 2, q3 = 3 located at points (1,2, 3), (3, –4, –5), and (-4, 2, –6) respectively. The units are coulombs for charge and meters for coordinates. The energy is given by the expression 9293 9193 9142 + T12 U = k r23 T13 where is the distance between the charges q; and q;, and k = 9 × 10º in SI units. Tij Your program should print the result on the screen.arrow_forwardWrite a program that computes the amount of calories burned when you run. Your program should ask for the duration of the run in minutes the speed of the run in mph and your weight in pounds. Compute the amount of calories burned and print it. The calories burned is computed using the expression below: \n", "\n", "$$ calories/minute = (MET*weight*1.6)/200 $$\n", "\n", "MET is a value given below:\n", " - if speed is 5mph or less - MET = 8\n", "- if speed is greater than 5 and less or equal 8 mph - MET = 11.5 \n", "- if speed is greater than 8 and less or equal 10 mph - MET = 14 \n", "- if speed is greater than 10 mph - MET = 20\n", "\n", "Remeber to multiply this result by the time running to show the total amount of calories burned.\n"arrow_forward
- Write a program that helps a company manage salaries of its employees. Your program should ask for the number of hours worked and the hourly rate of an employee than, display the salary. This program should allow the user to enter the information of many employees until enters -1. Sample Run: Enter the number of hours worked (-1 to end): 32 Enter hourly rate of the worker: 100 Balary is 03200 Enter the number of hours Worked (-1 to end) : 40 Enter hourly rate of the worker: 5 Balary is 3200 Enter the number of hours worked (-1 to end): 42 Enter hourly rate of the worker: 10 Salary is 0420 Enter the number of hours worked (-1 to end) : -1arrow_forwardWrite a program that helps a company manage salaries of its employees. Your program should ask for the number of hours worked and the hourly rate of an employee than, display the salary. This program still asks the user to enter the information of many employees until enters a zero value. Sample Run: Enter the number of hours worked (negative nbr to end): 32 Enter hourly rate of the worker: 100 Your salary is $3200 Enter the number of hours worked (negative nbr to end): 40 Enter hourly rate of the worker: 5 Your salary is $200 Enter the number of hours worked (negative nbr to end): 42 Enter hourly rate of the worker: 10 Your salary is 5420 Enter the number of hours worked (negative nbr to end): 0arrow_forwardAn oil slick occurs when an underwater refinery pipe ruptures, pumping oil into the water. The spilled oil sits on top of the water and causes a natural disaster. For simplicity, suppose that the oil sits on top of the water in the form of a circle. Write a program that prompts the user to enter the rate at which the ruptured pipe pumps oil (in gallons) per minute, the thickness of the oil on top of the water, and the number of days for which the area is covered by the spilled oil. The program outputs the spilled area (in kilometer) and the volume of oil (in gallons) on top of the water after each day.arrow_forward
- An oil slick occurs when an underwater refinery pipe ruptures, pumping oil into the water. The spilled oil sits on top of the water and causes a natural disaster. For simplicity, suppose that the oil sits on top of the water in the form of a circle. Write a program that prompts the user to enter the rate at which the ruptured pipe pumps oil (in gallons) per minute, the thickness of the oil on top of the water, and the number of days for which the area is covered by the spilled oil. The program outputs the spilled area (in kilometers) and the volume of oil (in gallons) on top of the water after each day.arrow_forwardWrite a program that reads the employee's name and base salary and then calculates the tax and net amount Salary where: Net salary = Basic salary If the basic salary is less than 500 (no tax) Net salary = basic salary - tax value So that the tax amount is 5% of the basic salary Then it prints the employee's name and net salary %3D 2:40 PM /arrow_forwardGiven the sample code above in generating a random number. Create a program that lets the user play the game of Rock, Paper, Scissors against the computer. The program should work as follows. 1. When the program begins, a random number in the range of 1 through 3 is generated. If the number is 1, then the computer has chosen rock. If the number is 2, then the computer has chosen paper. If the number is 3, then the computer has chosen scissors. (Don't display the computer's choice yet.) 2. The user enters his or her choice of "rock", "paper", or "scissors" at the keyboard. (You can use a menu if you prefer.) 13. The computer's choice is displayed. 4. A winner is selected according to the following rules: a. If one player chooses rock and the other player chooses scissors, then rock wins. (The rock smashes the scissors.) b. If one player chooses scissors and the other player chooses paper, then scissor wins. (Scissors cuts paper.) c. If one player chooses paper and the other player…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Constants, Variables, Data types, Keywords in C Programming Language Tutorial; Author: LearningLad;https://www.youtube.com/watch?v=d7tdL-ZEWdE;License: Standard YouTube License, CC-BY