Program Writing
Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both floats) as input, and output the gas cost for 10 miles, 50 miles, and 400 miles.
Ex: If the input is 20.0 3.1599, the output is:
1.57995 7.89975 63.198
Note: Small expression differences can yield small floating-point output differences due to computer rounding. Ex: (a + b)/3.0 is the same as a/3.0 + b/3.0 but output may differ slightly. Because our system tests programs by comparing output, please obey the following when writing your expression for this problem. First use the dollars/gallon and miles/gallon values to calculate the dollars/mile. Then use the dollars/mile value to determine the cost per 10, 50, and 400 miles.
Note: Real per-mile cost would also include maintenance and depreciation.
6 years ago 5
- Decision tree
- Microcontrollers - Lab: Introduction to MPLABX IDE
- Differentiating Between Market Structures
- Word document
- Should a counselor remain value-objective about controversial issues presented by a client (such as abortion, suicide, adultery, drug use, domestic violence, child abuse, etc.)?
- Three identical light bulbs are connected in series, then are disconnected and arranged in parallel. For each of the scenarios...
- "Course Wrap-Up
- Management Planning Presentation
- 8 to 10 power point slides 200 words each slide.
- motivate employees