Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Feedback? CHALLENGE ACTIVITY 2 . 8 . 2 : Floating - point numbers ( double ) . 5 8 2 5 4 8 . 4
Feedback? CHALLENGE ACTIVITY : Floatingpoint numbers double qxy Jump to level One gallon equals fluid ounces. The following program intends to read a floatingpoint value from input, convert the value from fluid ounces to gallons, and output the volume in gallons, but the code contains errors. Find and fix the errors. Ex: If the input is then the output is: gallonsInput is a double, but variables volOunces and volGallons are declared as integers. volGallons volounces performs integer division, so results in Therefore, volOunces and volGallons should be doubles.Not all tests passed: Compare outputOutput differs. See highlights below.Input
Feedback?
CHALLENGE
ACTIVITY
: Floatingpoint numbers double
qxy
Jump to level
One gallon equals fluid ounces. The following program intends to read a floatingpoint value from input, convert the value from fluid ounces to gallons, and output the volume in gallons, but the code contains errors. Find and fix the errors.
Ex: If the input is then the output is:
gallonsInput is a double, but variables volOunces and volGallons are declared as integers. volGallons volounces performs integer division, so results in Therefore, volOunces and volGallons should be doubles.Not all tests passed: Compare outputOutput differs. See highlights below.Input
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started