- PiDay.java
Grader Results
x/x
Pass | Test | Message | |
---|---|---|---|
- | Test results will show here. | - |
Errors:
As you can probably see, once we get to a large number of decimal places, our difference gets pretty small. Since it can be hard to comprehend a fraction of a mile or fraction of a foot, we want to add one final step to our program.
Right now, when we calculate the difference, the results are in miles. If the difference is less than a mile, convert the difference to feet by multiplying it by 5280, the number of feet per mile.
Likewise, if the difference is less than a foot, convert it to inches by multiplying by 12.
Once you find the right units, print out the results. Make sure you label your value!
Here is a sample output:
**************
Number of decimals: 7
Current Circumference: 26467.9184975 miles
Difference:-2.0645116438390687 feet
Percent error: -1.4772827676816937E-6%
**************
Number of decimals: 8
Current Circumference: 26467.91807625 miles
Difference:1.916260204743594 inches
Percent error: 1.1426665911160208E-7%
Hint: Make sure you consider that the difference could be positive or negative!
Note: Be sure to copy your code before moving on to the next exercise!
Upload an image
Upload from your computer
Or paste a link here
Slides and Notes
No slides available for this video
About
Java (main)
Java Version 1.8.0_222
Upload Media
File URL:
Please use up-to-date Chrome or Firefox in order to use audio and video recordings in your programs. Uploading files and taking photos should still work in your current browser.