Anyone can tell me how to return value of 2d array at specific position? Appreci
ID: 3775657 • Letter: A
Question
Anyone can tell me how to return value of 2d array at specific position? Appreciate it. Weekly Calendar ols Options Retrieve an existing appointment (i f any) by day and hou @param day The day to check (0-6) eparam hour The hour to check (0-23), in military time. k @return The appointment at the specified day and time, if there is one or null if no appointment is found, if the day specified is invalid, or if the hour specified is outside the range 8-17. public Appointment getAppointment (int day, int hour) if (day 0 && day K 6 && hour 8 && hour 17) if (a day] hour] null) T return a day] [hour]Explanation / Answer
public Appointment getAppointment(int day,int hour){
if(day >= 0 && day <=6 && hour >= 8 && hour <= 17){
if(a[day][hour] != NULL)
System.out.println("Your appointment scheduled on :"+a[day][hour]);
else
System.out.println(" Sorry your appointment is not scheduled !! ");
}
else
System.out.println("You have entered either invalid day or hour ");
}
/* Note:Please do ask in case of any doubt,Thanks. */
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.