Question: public class Drill5ASp21Nbr1 { public static void main(String args[ ]) { final int HWY = 36; final int CTY = 28; final float TANK_CAP =

public class Drill5ASp21Nbr1

{

public static void main(String args[ ])

{

final int HWY = 36;

final int CTY = 28;

final float TANK_CAP = 9.3f;

final float DIST = 280.4f;

float h;

float c;

h=HWY*TANK_CAP;

System.out.println(h);

c=CTY*TANK_CAP;

System.out.println(c);

if(c==DIST)

{

System.out.print("You drove on the city.");

}

//end of if

else if(!(c<=DIST)) System.out.println("You drove half and half");

else

{System.out.print("You drove on the highway.");

System.out.print(" GREAT! you get better mileage.");}

} //closing main method

} //closing class header

Please help i want to make it works for all three conditions. explain plz .

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!