Java Programming, Loose-Leaf Version
9th Edition
ISBN: 9781337685900
Author: FARRELL, Joyce
Publisher: Cengage Learning
expand_more
expand_more
format_list_bulleted
Expert Solution & Answer
Chapter 2, Problem 8RQ
Program Description Answer
The value 137.68 can be held by the variable types “float and double”.
Hence, the correct answer is option “D”.
Expert Solution & Answer
Trending nowThis is a popular solution!
Students have asked these similar questions
#01.
A particular talent competition has 5 judges, each of whom awards a score between 0 and 10 to each performer. Fractional scores, such as 8.3, are allowed. A performer’s final score is determined by dropping the highest and lowest score received, then averaging the 3 remaining scores. Write a program that uses these rules to calculate and display a contestant’s score. It should include the following functions:
• void getJudgeData() should ask the user for a judge’s score, store it in a reference parameter variable, and validate it. This function should be called by main once for each of the 5 judges. • double calcScore() should calculate and return the average of the 3 scores that remain after dropping the highest and lowest scores the performer received. This function should be called just once by main and should be passed the 5 scores.Two additional functions, described below, should be called by calcScore, which uses the returned information to determine which of the scores to drop.•…
Write a program that computes and displays the charges for a patient's hospital
stay. First, the program should ask if the patient was admitted as an inpatient or
an outpatient. If the patient was an inpatient, the following data should be
entered:
• The number of days spent in the hospital
• The daily rate
Hospital medication charges
• Charges for hospital services (lab tests, etc.)
The program should ask for the following data if the patient was an outpatient:
• Charges for hospital services (lab tests, etc.)
• Hospital medication charges
The program should use two overloaded functions to calculate the total charges.
One of the functions should accept arguments for the inpatient data, while the
other function accepts arguments for outpatient information. Both functions
should return the total charges and display it for the user.
After the total charges have been calculated and displayed, write the result to a
file, PatientReport.txt. You can use the techniques you learned in Chapter…
Chapter 2 Solutions
Java Programming, Loose-Leaf Version
Ch. 2 - Prob. 1RQCh. 2 - Prob. 2RQCh. 2 - Prob. 3RQCh. 2 - Prob. 4RQCh. 2 - Prob. 5RQCh. 2 - Prob. 6RQCh. 2 - Prob. 7RQCh. 2 - Prob. 8RQCh. 2 - Prob. 9RQCh. 2 - Prob. 10RQ
Ch. 2 - Prob. 11RQCh. 2 - Prob. 12RQCh. 2 - Prob. 13RQCh. 2 - Prob. 14RQCh. 2 - Prob. 15RQCh. 2 - Prob. 16RQCh. 2 - Prob. 17RQCh. 2 - Prob. 18RQCh. 2 - Prob. 19RQCh. 2 - Prob. 20RQCh. 2 - Prob. 1PECh. 2 - Prob. 2PECh. 2 - Prob. 4PECh. 2 - Prob. 5PECh. 2 - Prob. 6PECh. 2 - Prob. 7PECh. 2 - Prob. 8PECh. 2 - Prob. 9PECh. 2 - Prob. 10PECh. 2 - Prob. 11PECh. 2 - Prob. 12PECh. 2 - Prob. 13PECh. 2 - Prob. 14PECh. 2 - Prob. 15PECh. 2 - Prob. 16PECh. 2 - Prob. 1GZCh. 2 - Prob. 3GZCh. 2 - Prob. 1CPCh. 2 - Prob. 2CP
Knowledge Booster
Similar questions
- Choose the best data type for each of the following, so that no memory storage is wasted. Give an example of a typical value that would be held by the variable, and explain why you chose the type you did. the number of years of school you have completed your final grade in this class the population of China the number of passengers on an airline flight one players score in a Scrabble game the number of Electoral College votes received by a U.S. presidential candidate the number of days with below freezing temperatures in a winter in Miami, Florida one teams score in a Major League Baseball gamearrow_forwardDesign and implement an application that plays the High-Low guessing game with numbers. The program should pick a random number between 1 and 100 (inclusive) then repeatedly prompt the user to guess the number. Every time the user guess, inform him/her whether the guess is correct, or the guess is high or low.Continue accepting guesses until the user guesses correctly or chooses to surrender. Use a sentinel value to determine whether the user wants to quit. Count the number of guesses and display that value when the user guesses correctly. At the end of each game (either by quitting or a correct guess) prompt to determine whether the user wants to play again. Continue playing until the user chooses to stop. When the user stops playing, display the number of correct guesses and surrenders.The c++program should use suitable selection and repetition structures. The input process, guessing process and output must be organized into appropriate functions.arrow_forwardQUESTION 18 Int xt= 200 int yt 100; Int d1, d2; LAm( mov EAX, x1: mov EBX, y1: push EBX pop ECX mov d2, ECX: mov d1. EAX: What is d2 in decimal format? 100 1200 400 O 300 QUESTION 19 Int xt200; int yt 100; int 0, z1 int d1, 2 mov EAX xt: mov EBX vt: mov a0, ESP, assume inta ESP aoss push EAX mov d1, EAX mov z1, ESP push EBX mov 2, EX mov 2. ESP What is dt n decimal format? 200 0.100 QUISTION 20 CA N end C4 A ws al annarrow_forward
- Hi, the assignment is asking for a code and here is the intructions.arrow_forwardPHP ATM machines allow 4 or 6 digit PIN codes and PIN codes cannot contain anything but exactly 4 digits or exactly 6 digits. *With user input ($pinNumbers), create a function that takes a string and returns true if the PIN is valid and false if it's not. Examples validatePIN("$1234") ➞ true validatePIN("12345") ➞ false validatePIN("a234") ➞ false validatePIN("") ➞ false Notes ● Some test cases contain special characters. ● Empty strings must return false.arrow_forwardpython" You have an Internet connection with a download speed of 41 Megabits per second (Mbps) and you want to calculate how long it will take to download a files based on their size. Write a function named "download_time" that takes an integer as a parameter. The parameter represents the size of a file in Gigabytes that you want to download. The function should return the number of seconds it will take to download that file if your download speed is 41 Megabits per second. To convert the file size from Gigabytes to Megabits remember that 1 Gigabyte equals 1000 Megabytes and that 1 Megabyte equals 8 Megabits.arrow_forward
- The following variables have been initialized for you: int a; float f: double d: You have to cast the variable into different data types as follows: • Cast a as float to a variable x. • Cest fas an integer to a varieble y. • Cest d as flost to a variable z. Hint: You nae to initia ize the varlebles xy and z of proper data types. Note: The required code to take user input is already written for you. Similar to value asinput. Sample Input 11 12.2345 12.34567895343534511 Sample Output: =110y-12z=12.3-5679arrow_forward7- You are creating an application which requires the user to input their password for logging into an account. Input is accepted using the input() function. What is the most appropriate approach to writing the code for type conversion of the input value and why? a. Convert to str, because we don't want the program to crash if the user inputs a number. b. Convert to float, since the input is a "floating" (non-permanent) value. c. Convert to float, since int only supports whole numbers. d. No type conversion necessary, since the Python interpreter will determine the best type for the value implicitly. e. Convert to int, since the input is an "intermediate" value. f. No type conversion necessary, since the input will already be the appropriate type for text (str).arrow_forwardThe following variables have been initialized for you: int a; float f; double d; You have to cast the variable into different data types as follows: Cast a as float to a variable x. Cast f as an integer to a variable y. Cast d as float to a variable z. Hint: You have to initialize the variables x,y and z of proper data typesarrow_forward
- please solve this in python //////////////// //////////////// //////////////// ////////////////arrow_forwardThe variable "age" of type int has been declared. Write the code required to ask the user to enter the age, store the entered value in the variable "age". If the value entered by the user is zero or negative then output the msg. "invalid age" and repeat the above steps as many times as required till the user enters a value that is more than zero, then output the value to the screen and do not ask the user for input again. Use a do-while looparrow_forwardJava programming : I can’t figure question 9 out. Help would be appreciated of any input or output. Thanks!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++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningEBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT