Java: An Introduction to Problem Solving and Programming (7th Edition)
7th Edition
ISBN: 9780133766264
Author: Walter Savitch
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
Chapter 3, Problem 7P
Program Plan Intro
Estimate of Blood Alcohol Content (BAC)
Program plan:
- • Include necessary header files.
- • Declare the class “BAC”.
- • Define the “main()” function.
- ○ Declare and initialize the necessary variables.
- ○ Create object for the method “Scanner()” to get the input.
- ○ Get the inputs from the user.
- ○ Use formula to calculate the blood alcohol content of a person.
- ○ The “if” statement check the condition.
- ■ If the condition is true then, print a message “Legally intoxicated”.
- ○ Otherwise, print a message “Not legally intoxicated”.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
obs
vaccinated
1
1
2
1
3
1
4
1
5
1
6
1
7
1
8
1
9
1
10
1
11
1
12
1
13
1
14
1
15
1
16
0
17
0
18
0
19
0
20
0
21
0
22
0
23
0
24
0
25
0
26
0
27
0
28
0
29
0
30
0
Run the excel formula =average(A:A).
Summary
During winter when it is very cold, typically, everyone would like to know the windchill factor, especially, before going out. Meteorologists use the following formula to compute the windchill factor, W:
W = 35.74 + 0.6215 × T - 35.75 × V0.16 + 0.4275 × T × V0.16
where V is the wind speed in miles per hour and T is the temperature in degrees Fahrenheit.
Instructions
Write a program that prompts the user to input the wind speed in miles per hour, and the temperature in degrees Fahrenheit. The program then outputs the current temperature and the windchill factor. Your program must contain at least two functions: one to get the user input and the other to determine the windchill factor.
Please complete the exercise! Thank you, i am trying to check my work
Chapter 3 Solutions
Java: An Introduction to Problem Solving and Programming (7th Edition)
Ch. 3.1 - Suppose goals is a variable of type int. Write an...Ch. 3.1 - Suppose goals and errors are variables of type...Ch. 3.1 - Suppose salary and deductions are variables of...Ch. 3.1 - Suppose speed and visibility are variables of type...Ch. 3.1 - Suppose salary and bonus are variables of type...Ch. 3.1 - Assume that nextWord is a string variable that has...Ch. 3.1 - Prob. 7STQCh. 3.1 - What output is produced by the following code? int...Ch. 3.1 - Suppose you change the code in the previous...Ch. 3.1 - What output is produced by the following code? int...
Ch. 3.2 - Suppose number is a variable of type int that has...Ch. 3.2 - What output is produced by the following...Ch. 3.2 - What output is produced by the following...Ch. 3.2 - What output is produced by the following...Ch. 3.3 - What output is produced by the following code?Ch. 3.3 - Suppose you change the code in the previous...Ch. 3.3 - What output is produced by the following code?Ch. 3.3 - What output is produced by the following code?Ch. 3.3 - Suppose you change the first line of the code in...Ch. 3.3 - Prob. 20STQCh. 3.4 - Prob. 21STQCh. 3.4 - Prob. 22STQCh. 3.4 - Write code for a JOptionPane dialog that will ask...Ch. 3 - Write a fragment of code that will test whether an...Ch. 3 - Write a fragment of code that will change the...Ch. 3 - Suppose you are writing a program that asks the...Ch. 3 - Prob. 4ECh. 3 - Consider the following fragment of code: What is...Ch. 3 - We would like to assess a service charge for...Ch. 3 - What is the value of each of the following boolean...Ch. 3 - The following code fragment will not compile. Why?...Ch. 3 - Prob. 9ECh. 3 - Consider the boolean expression (2 5) (x 100))....Ch. 3 - Write a switch statement to convert a letter grade...Ch. 3 - Consider the previous question, but include + or ...Ch. 3 - Imagine a program that displays a menu of five...Ch. 3 - Repeat the previous exercise, but define an...Ch. 3 - Repeat Exercise 13, but use a multibranch if-else...Ch. 3 - Given that the int variable temp contains a...Ch. 3 - Write Java statements that create a yes-or-no...Ch. 3 - A number x is divisible by y if the remainder...Ch. 3 - Write a program to read in three nonnegative...Ch. 3 - Write a program that reads three strings from the...Ch. 3 - Write a program that reads a one-line sentence as...Ch. 3 - Write a program that allows the user to convert a...Ch. 3 - Write a program that inputs an integer. If the...Ch. 3 - Prob. 7PCh. 3 - Repeat Programming Project 5 of Chapter 2, but...Ch. 3 - Repeat any of the previous Practice Programs using...Ch. 3 - Suppose that we are working for an online service...Ch. 3 - Write a program that reads a string from the...Ch. 3 - Repeat the calorie-counting program described in...Ch. 3 - Repeat Programming Project 5 but in addition ask...Ch. 3 - Repeat Programming Project 11 in Chapter 2, but if...Ch. 3 - Write a program to play the rock-paper-scissor...Ch. 3 - Prob. 9PPCh. 3 - Repeat Programming Project 8 in Chapter 1, but add...
Knowledge Booster
Similar questions
- One way to determine how healthy a person is by measuring the body fat of the person. The formulas to determine the body fat for female and male are as follows: Body fat formula for women: A1 = (body weight x 0.732) + 8.987 A2 = wrist measurement (at fullest point)/3.140 A3 = waist measurement (at navel) x 0.157 A4 = hip measurement (at fullest point) x 0.249 A6 = forearm measurement (at fullest point) x 0.434 B = A1 + A2 A3 A4 + A5 Body fat = body weight - B Body fat percentage = body fat x 100/body weight Body fat formula for men: A1 = (Body weight x 1.082) + 94.42 A2 = wrist measurement x 4.15 B = A1 A2 Body fat = body weight B Body fat percentage = body fat x 100/body weight Write a program to calculate the body fat of a person.arrow_forwardassuming a variable y has been assigned the value 6, what is the value of!(y<7)arrow_forwardwhen expressed as a percentage, what is the range of values for multiple R2? A) -100% to +100% inclusive B) -100% to 0% inclusive C) 0% to +100 inclusive D. Unlimited range (Don't hand writing solution)arrow_forward
- An ISBN-10 (International Standard Book Number) consists of 10 digits: The last digit, is a checksum, which is calculated from the other nine digits using the following formula: (d1 x 1 + d2 x 2 + d3 x 3 + d4 x 4 + d5 x 5 + d6 x 6 + d7 x 7 + d8 x 8 + d9 x 9) % 11) If the checksum is 10, the last digit is denoted as X, according to the ISBN convention. Write a program that prompts the user to enter the first 9 digits as a string and displays the 10-digit ISBN (including leading zeros). Your program should read the input as a string.arrow_forwardWrite your monthly allowance (computed by daily allowance x number of days in a month) compute the total.arrow_forwardAn ISBN (International Standard Book Number) is a 10 digit number that is used to identify a book. The first nine digits of the ISBN number are used to represent the Title, Publisher and Group of the book and the last digit is used for checking whether ISBN is correct or not. To uniquely identify a book a 10-digit ISBN number is used. The rightmost digit is checksum digit. This digit is determined from the other 9 digits using condition that 10d, + 9dz + 8dg + + d4o must be a multiple of 11 (where d, denotes the i" digit from the right). The checksum digit d; can be any value from 0 to 10: the ISBN convention is to use the value X to denote 10. Write a C program using pointers that receives a 10- digit ISBN, and computes the checksum, and reports whether the ISBN number is correct or not. Example: 007462542X = 10°0 + 9*0 + 8*7 + 74 + 6*6 + 5*2 + 4*5 + 3"4 + 2*2 + 110 = 176 Since 176 leaves no remainder when divided by 11, hence it is a valid ISBN. Note: When the check digit turns out…arrow_forward
- Part 1 of 4 Compute the least-squares regression line for predicting the diastolic pressure from the systolic pressure. Round the sope and y-intercept to at least four decimal places. Regression line equation: y =arrow_forwardAn ISBN-10 (International Standard Book Number) consists of 10 digits: d1d2d3d4d5d6d7d8d9d10. The last digit, d10, is a checksum, which is calculated from the other nine digits using the following formula: (d1 * 1 + d2 * 2 + d3 * 3 + d4 * 4 + d5 * 5 + d6 * 6 + d7 * 7 + d8 * 8 + d9 * 9) % 11 If the checksum is 10, the last digit is denoted as X according to the ISBN-10 convention. Write a program that prompts the user to enter the first 9 digits and displays the 10-digit ISBN (including leading zeros). Sample Run 1 Enter the first 9 digits of an ISBN as a string: 3601267 Incorrect input. It must have exact 9 digits Sample Run 2 Enter the first 9 digits of an ISBN as a string: 013601267 The ISBN-10 number is 0136012671 Sample Run 3 Enter the first 9 digits of an ISBN as a string: 013031997 The ISBN-10 number is 013031997X **PYTHON***arrow_forwardCalculate two's compliment of 15. Calculate two's compliment of 16.arrow_forward
- Please right solution only please fast u will like itarrow_forwardEntered Answer Preview Result Message correct (923,998) (923,998) (2398,2171) (2398, 2171) correct (2,808) (2,808) Your answer isn't a number incorrect (it looks like a list of numbers) At least one of the answers above is NOT correct. (1 point) Consider the elliptic curve group based on the equation y² = x + ax + b x3 mod p where a = 2440, b = 295, and p = 3391. We will use these values as the parameters for a session of Elliptic Curve Diffie-Hellman Key Exchange. We will use P = (2, 808) as a subgroup generator. You may want to use mathematical software to help with the computations, such as the Sage Cell Server (SCS). On the SCS you can construct this group as: G=Elliptic Curve (GF(3391), [2440,295]) Here is a working example. (Note that the output on SCS is in the form of homogeneous coordinates. If you do not care about the details simply ignore the 3rd coordinate of output.) Alice selects the private key 18 and Bob selects the private key 15. What is A, the public key of Alice?…arrow_forward1) Given the percentages below; [e: 13%, a: 8%, o: 7%, i: 7%, u: 3%] a) Give the value of Pr(x is a vowel) b) Give the value of Pr(x = ‘e’ |x is a vowel) c) Give the value of Pr(x is a vowel |x is not ‘a’)arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningNp Ms Office 365/Excel 2016 I NtermedComputer ScienceISBN:9781337508841Author:CareyPublisher:Cengage
- COMPREHENSIVE MICROSOFT OFFICE 365 EXCEComputer ScienceISBN:9780357392676Author:FREUND, StevenPublisher:CENGAGE LProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:9781337508841
Author:Carey
Publisher:Cengage
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:9780357392676
Author:FREUND, Steven
Publisher:CENGAGE L
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage