import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Calendar;
import java.util.GregorianCalendar;
public class CheckIn{
Date today;
void getArrivalDate() {
DateFormat df = new SimpleDateFormat("dd/MM/yyyy");
try {
System.out.print("Enter Date in dd/mm/yyyy format: ");
String d = Keyboard.readString();
today = df.parse(d);
df.format(today);
} catch (ParseException e) {
e.printStackTrace();
}
}
void getDepartureDate(){
Calendar ca1 = Calendar.getInstance();
ca1.setTime(today);
System.out.print("How many nights do you want to stay? ");
int nights = Keyboard.readInt();
ca1.add(Calendar.DATE, nights);
System.out.println("Departure Date: " + ca1.get(Calendar.DATE)
+ "/"
+ (ca1.get(Calendar.MONTH) + 1)
+ "/"
+ ca1.get(Calendar.YEAR)
+ "\n");
}
}
I've made these two methods and they are working well. But I'm confused if the method type is good(void).