the program is supposed to enter type of a car,enter arrival hr.enter arrival min,exit hr,exit min,then it supposed to print type of the car,enter time and exit time in military style and then the charges... i dont know what am i doing wrong that its not doing that any advices pleaseeee THANKKKKKKSSSS alottt
and the calculation is as it is in the program 2.00 per hour max 20.00(car)
3.50 per hour max 30.00(var):
import java.util.Scanner;
public class PublicGarage
{
public static void main(String [] main)
{
char repeat; //To hold 'Y','N','y','n','Car','car','Van' or 'van'
double hours = 0.0;
double mins = 0.0;
double cost = 0.0;
char choice;
String input; //To hold input
Scanner keyboard=new Scanner(System.in);
System.out.println("Enter arrival time: ");
hour=keyboard.nextDouble();
System.out.println("Enter arrival minute: ");
minute=keyboard.nextDouble();
System.out.println("Enter exit hour: ");
hour=keyboard.nextDouble();
System.out.println("Enter exit minute: ");
minute=keyboard.nextDouble();
if(exit < arrival)
{System.out.println("Exit minute must be greater than arrival minute!");
}
System.out.println("************");
System.out.println("XXXGarage");
System.out.println("************");
System.out.println("Enter type of vehicle C for car || V for van:");
choice=keyboard.charAt(0);
{
double totalTime = ( hour * 60.0 ) + minute;
// van type
if( totalTime < 514 && totalTime > 0)
{ cost = 3.50 * totalTime; // 3.50 per hour
System.out.ptintln("The charge is" + cost);
else
System.out.println("The cost is $30.00");
}
// car type
if( totalTime < 600 && totalTime > 0)
{ cost = 2.0 * totalTime; // 2.00 per hour
System.out.ptintln("The charge is" + cost);
else
System.out.println("The cost is $20.00");
}
System.out.println("Parking for a" + char);
System.out.printf("%02d" + hour);
System.out.println("Exit time");
System.out.println("Enter y for a new customer, or N to stop");
string=keyboard.nextLine();
choice=keyboard.charAt(0);
while(choice =='Y' || choice != 'y');
}
}