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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started