So what I need to do is calculate the time of a rental from 0900 to 1600 Monday to Friday and store this
I have tried to remove the calculation for one day, but still does not compile in the correct format.
public class Time {
// Variables
static Scanner kbinput = new Scanner(System.in);
private static boolean error = false;
private static String daysoftheweek; // Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday;
DateFormat sdf = new SimpleDateFormat("HH");
// Keyboard for user input
private int time;
public static void main(String[] args) throws ParseException {
System.out.println("Please enter day of your rental");
daysoftheweek = kbinput.nextLine();
System.out.println("Please enter day of your return");
do {
daysoftheweek = kbinput.nextLine();
switch (daysoftheweek.toUpperCase()) {
case "Monday":
error = false;
break;
case "Tuesday":
error = false;
break;
case "Wednesday":
error = false;
break;
case "Thursday":
error = false;
break;
case "Friday":
break;
case "Saturday":
default:
case "Sunday":
}
} while (error);
System.out.println("Please enter your start time (hh) ");
String time = kbinput.nextLine();
System.out.println();
System.out.print("Enter finish time (hh) ");
String time2 = kbinput.nextLine();
DateFormat sdf = new SimpleDateFormat("hh");
Date d1 = sdf.parse(time);
System.out.println("Rental Time: " + sdf.format(d1));
}
}