Status: Not Started
  • PiDay.java
Font Size
14
Parentheses autocomplete
Wrap lines
Editor
Theme
Code with blocks by default
Console Font Size
12
Console Theme
Display Server Graphics Screen
Show File Tab Bar
Debug Mode
9 Customize the Output
PiDay.java
public class PiDay
{
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Output
Grading
Docs
Exercise
More
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Pass Test Message

Errors:

This student is viewing this assignment in English. View this page in English?

5 points

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!

Reset Code

Slides and Notes

No slides available for this video

About

Java (main)
Java Version 1.8.0_222

Upload Media