Question: Practice: Using java, take the given Meeting Scheduler System(MSS) program and implement it using a GUI (No Command Line). Guidelines: 1. Your application should have

Practice:

Using java, take the given Meeting Scheduler System(MSS) program and implement it using a GUI (No Command Line).

Guidelines:

1. Your application should have a GUI. All interaction should be through the GUI. The command line should never be used.

2. At any time, the user should be able to save all the information on a file.

3. When a program start the user can upload all the information from a file

MeetingScheuler.Java

public class MeetingScheduler { private static int getMeetingsCount(HashMap rooms,Participant p,int slot)//checks to see how many meetings a participant has scheduled { Room r; Meeting m; ArrayList meetings=new ArrayList(); for(Integer k:rooms.keySet()) { r=rooms.get(k); m=r.getMeeting(slot); if(m!=null && m.hasParticipant(p)) meetings.add(m); } return meetings.size(); } public static void main(String[] args) { int choice,num,slot,room; String fname,lname,phone,mname,ans=""; Participant p; Room r; Meeting m; Scanner scanner=new Scanner(System.in); HashMap rooms= new HashMap(); HashMap participants=new HashMap();//helpful data structure that uses a key to represent objects https://www.youtube.com/watch?v=c3RVW3KGIIE HashMap meetings=new HashMap(); System.out.println("Enter the number of rooms:"); num=scanner.nextInt(); for(int i=1;i<=num;i++) { rooms.put(new Integer(i),new Room(i)); } do//loops until 10 is entered { System.out.println("1. Add Participant"); System.out.println("2. Delete Participant"); System.out.println("3. Add Meeting"); System.out.println("4. Delete Meeting"); System.out.println("5. Add Room"); System.out.println("6. Delete Room"); System.out.println("7. Display all meetings "); System.out.println("8. Display meetings in a room"); System.out.println("9. Display meetings by participant"); System.out.println("10. Exit"); System.out.println("Enter your choice: "); choice=scanner.nextInt(); switch (choice)//switch statement for options { case 1: //add participant System.out.println("Enter first name: "); fname=scanner.next(); System.out.println("Enter last name: "); lname=scanner.next(); System.out.println("Enter phone number: "); phone=scanner.next(); p=new Participant(fname,lname); p.setPhone(phone); participants.put(p.getName(),p); break; case 2: //delete participant System.out.println("Enter the details of the participant to be deleted"); System.out.println("Enter first name: "); fname=scanner.next(); System.out.println("Enter last name: "); lname=scanner.next(); p=participants.get(fname.toUpperCase()+" "+lname.toUpperCase()); if(p==null)//participant does not exist System.out.println("Participant "+fname+" "+lname+" does not exist!"); else//participant exists { for(int i=0;i ms; for(Integer k:rooms.keySet()) { r=rooms.get(k); if(r.getNumMeetings()!=0) { ms=r.getMeetings(p); if(!ms.isEmpty()) { System.out.println("Room No: "+r.getRoomNum()); for(int i=0;i

}

Participant.Java

public class Participant { private String firstName; private String lastName; private String phone; public Participant(String fname,String lname)//constructor { firstName=fname.toUpperCase();//eliminates confusion from user input lastName=lname.toUpperCase(); } public String getFirstName() { return firstName; } public String getLastName() { return lastName; } public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } public String getName() { return firstName+" "+lastName; } }

Room.Java

public class Room { private int roomNo; private Meeting meetings[]; private int count; public Room(int num)//constructor { roomNo=num; //9 slots for meetings starting from 9:00 hr , 10:00....5:00hr meetings=new Meeting[9]; count=0; } public int getRoomNum() { return roomNo; } public boolean addMeeting(Meeting meeting)//adds a meeting { int startHour=meeting.getStartHour(); //meetings can be from 9 to 5 if(startHour<9 || starthour>17) return false; int index=startHour-9; //caluclate what this meeting index is. 9:00 will be at index 0, 10:00 at index 1 and so on if(meetings[index]==null) //if no other meetings is assigned already { meetings[index]=meeting; count++; return true; } else return false; } public boolean isSlotAvailable(int startHour)//determines if meeting can be scheduled at this hour { if(startHour<9 || starthour>17) return false; int index=startHour-9; //caluclate what this meeting index is. 9:00 will be at index 0, 10:00 at index 1 and so on return (meetings[index]==null); } public boolean cancelMeeting(int startHour)//delete meeting { //meetings can be from 9 to 5 if(startHour<9 || starthour>17) return false; int index=startHour-9; //caluclate what this meeting index is. 9:00 will be at index 0, 10:00 at index 1 and so on if(meetings[index]==null) { return false; } else { meetings[index]=null; count--; return true; } } public int getNumMeetings() { return count; } public Meeting getMeeting(int startHour) { //meetings can be from 9 to 5 if(startHour<9 || starthour>17) return null; int index=startHour-9; //caluclate what this meeting index is. 9:00 will be at index 0, 10:00 at index 1 and so on return meetings[index]; } public boolean isAttending(Participant p)//checks to see whos at the meeting { Meeting m; for(int i=0;i getMeetings(Participant p) { ArrayList ms=new ArrayList(); Meeting m; for(int i=0;i<9;i++) { m=meetings[i]; if(m!=null && m.hasParticipant(p)) { ms.add(m); } } return ms; } public void displayMeetings()//displays meetings { Meeting m; System.out.println("Room No.:"+roomNo); for(int i=0;i<9;i++) { m=meetings[i]; if(m!=null) System.out.println("\t"+m.getStartHour()+" Hrs: "+m.getName()); } } }

Meeting.Java

public class Meeting { private String name; private Room room; private int startHour; private ArrayList participants; public Meeting(String mname)//constructor { name=mname; participants=new ArrayList(); } public void setRoom(Room r) { room=r; } public Room getRoom() { return room; } public boolean setStartHour(int hour)//makes sure meeting can be scheduled at this hour, then schedules it { if(hour<9 || hour>17) return false; startHour=hour; return true; } public int getStartHour() { return startHour; } public String getName() { return name; } public void addParticipant(Participant p)//adds a participant { String name=p.getName(); for(int i=0;i

Thank you in advance, please let me know if you need more information

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!