mTasks
QuartsToGallonsInte…
+
>_ Te
=
O out of 3 checks
passed. Review the
results below for
more details.
{
Checks
Test Case @ Incomplete
QuartsToGallons Interacti
ve
1 class QuartsTogallons Interactive
{
B public static void main(String[] args)
4 {
5
// Modify the code below
6
final int QUARTS_IN_GALLON = 4;
T
int quartsNeeded = 18;
8
int gallonsNeeded;
9
int extraQuarts Needed;
gallonsNeeded = quartsNeeded /
QUARTS_IN_GALLON;
extraQuartsNeeded = quartsNeeded %
QUARTS_IN_GALLON;
System.out.println(“A job that needs”
quarts Needed +
quarts requires + gallons Needed +
gallons plus
14
extraQuartsNeeded + quarts.”);
}
16 ]
20
Test Case @ Incomplete
>
QuartsToGallons Interacti
12
+
ve
13
IF
+
Test Case o Incomplete
>
QuartsToGallons Interacti
ve
17
27
2
Run Checks
Submit 0%
Programming Exercise 2-7
Tasks
Mile ConversionsInter…
+
>_ Terminal
ractive
v=
5.00
out of
10.00
functions as
expected
olul
MileConversions Interacti
ve
23
Test Case • Incomplete
>
18
MileConversions Interacti
ve
4.5
?
Run Checks
Submit 0%
i
Programming Exercise 2-6
Instructions
MileConversions.java
+
>_ Termin
!!!
1 class MileConversions {
2 public static void main(String[] args)
{
4
// Write your code here
5
3
Lalal
}
6 }
7
*
Write a program that declares
constants to represent the
number of inches, feet, and
yards in a mile. Name the
constants INCHES_IN_MILE ,
FEET_IN_MILE , and
YARDS_IN_MILE respectively.
Also declare a variable named
miles to represent a number
of miles. Compute and
display, with explanatory text,
the value in inches, feet, and
yards-for example: 4.0 miles
is 253440.0 inches, or
21120.0 feet, or 7040.0 yards
MITED
When submitting the program
for testing/grading, assign the
value 4 to miles.