My instructor told me to add JOptionPne and some input(ex. timeIn, timeOut), have to use the test data for this program(see attached document).

please check an attached document for instruction. 

Here is what I have so far...

import java.util.Formatter;
class ParkingRate
{
public static void main(String[] args)
{

//Variable Declaration
int timeIn;
int timeOut;
float miles,time,mRate,pRate,total;



timeIn = in;
timeOut = out;
pRate = 1.5f;
miles = mil;

if(miles>=0 && miles<= 500)
{
mRate = 15;
}
else if(miles>=501 && miles<=1000)
{
mRate = 75+(12*(miles-500));
}
else if(miles>=1001 && miles<=1500)
{
mRate = 135+(10*(miles-1000));
}
else if(miles>=1501 && miles<=2000)
{
mRate = 185+(8*(miles-1500));
}
else if(miles>=2001 && miles<=3000)
{
mRate = 225+(6*(miles-2000));
}
else
{
mRate = 285+(5*(miles-3000));
}

Formatter f = new Formatter();
f.format("compensation for mileage:%5.2f",(miles * mRate));
System.out.print(f);
f = new Formatter();
total = miles * mRate+((timeOut-timeIn)/100) * pRate;
f.format("total compensation:%5.2 f",total);
System.out.print(f);
}
}

    • 12 years ago
    100% ACCURATE ANSWER RELIABLE A++ TUTORIAL PLAGIARISM FREE PERFECT GUIDE
    NOT RATED

    Purchase the answer to view it

    • java_code.doc