Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Strategic Database Technology Management For The Year 2000

Authors: Alan Simon

1st Edition

155860264X, 978-1558602649

More Books

Students also viewed these Databases questions

Question

All Estonian schools are connected to the Internet.

Answered: 1 week ago

Question

Define Management or What is Management?

Answered: 1 week ago

Question

What do you understand by MBO?

Answered: 1 week ago