What I'm trying to do is if the user input is Monday through Friday it charges them 1.25 and if it's Saturday or Sunday it charges them 0.50? For Example:
public static void main(String[] args) {
Scanner inputInfo = new Scanner(System.in);
System.out.println("Please enter the (Full Name) day of the week: ");
String inputDay = inputInfo.nextLine();
System.out.println("Please enter the vehicle's arrival time: ");
Integer inputSTime = inputInfo.nextInt();
System.out.println("Please enter it's departure time: ");
Integer inputETime = inputInfo.nextInt();
List<String> Week = Arrays.asList("Monday", "Tuesday", "Wednesday", "Thursday", "Friday");
List<String> Weekend = Arrays.asList("Saturday", "Sunday");
Double Money_1 = 1.25;
Double Money_2 = 0.50;
Integer halfHour_S = (inputSTime % 100);
Integer frontHour_S = (inputSTime / 100) * 100;
Double hourR = frontHour_S * .6;
Integer hourFH = (int) (hourR + halfHour_S);
Integer halfHour_E = (inputETime % 100);
Integer frontHour_E = (inputETime / 100) * 100;
Double hourRE = frontHour_E * .6;
Integer hourFH_E = (int) (hourRE + halfHour_E);
Integer d_Minutes = (hourFH_E - hourFH);
System.out.println("Day came in: " + inputDay);
if(inputDay == Week);
(inputDay.replace(Week, Money_1));
if(inputDay == Weekend);
(inputDay.replace(Weekend, Money_2));
System.out.println("Parking duration in minutes: " + d_Minutes + ", rate: " + inputDay);
}
output: Please enter the (Full Name) day of the week: Tuesday Please enter the vehicle's arrival time: 1600 Please enter it's departure time: 1930 Day came in: Tuesday Parking duration in minutes: 210, rate: 1.25
Process finished with exit code 0
Aucun commentaire:
Enregistrer un commentaire