Background Information For this assessment you need to write an object-oriented console application in the Java programm

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Background Information For this assessment you need to write an object-oriented console application in the Java programm

Post by answerhappygod »

Background Information For This Assessment You Need To Write An Object Oriented Console Application In The Java Programm 1
Background Information For This Assessment You Need To Write An Object Oriented Console Application In The Java Programm 1 (272.79 KiB) Viewed 35 times
Background Information For this assessment you need to write an object-oriented console application in the Java programming language which adheres to the following basic object-oriented programming principles: a) Your code should follow good object-oriented principles such as encapsulation, composition, cohesion, etc... b) Setting the visibility of all instance variables to private or protected. c) Using getter and setter methods only where needed and appropriate with consideration given to scope & visibility. d) Only use static variables and methods when there is good reason to do so, such as reducing code repetition whilst still maintaining good objected-oriented design. You are being assessed on your ability to write a program in an object-oriented manner. Writing the program in a procedural style is not permitted and will be considered inadmissible receiving a zero grade. The following guidelines apply throughout this assessment: e) You must use an array to store any collections of objects in your program. f) You must not use ArrayList, HashMap or any other data structures within the Java API or from 3rd party libraries. g) Your code should java8 compliant

Overview You are approached to build a Class Booking Application for a vocational training centre. Note the class here is not to be confused with ‘class' in Object-Oriented Programming. The application has a menu as the main user interface, supporting four main functions: (1) book a class; (2) view the booked class(es); (3) cancel a booked class; and (4) Enrolment. A trainee can navigate through the menu to book classes. The menu is provided and shown below: Welcome to Funtastic Training Centre Main menu - select one option: b. Book a class v. View my bookings c. Cancel class e. Enrol all booked classes q. Quit To complete the booking application, you need to design the (OOP) classes and fully implement them. Your application is case insensitive and considers 'q' the same as 'Q', 'c' the same as 'C' and so on. General Introduction TrainingClass class - which should have at least six member fields: String name, String duration, String level, String startDate, int capacity, and int numOfStudents. These instance variables keep the class name, the total duration (e.g. 3 weeks), level of difficulties, starting date of the class, the maximum number of students that the class can accommodate, and the current number of enrolled students. Note that the value of numOfStudents should always be zero at instantiation. ClassList class - It stores all training classes offered by the centre. MyBooking class - This class is similar to a shopping cart. It is empty at the time of instantiation. All classes that a student/trainee booked will be stored here. Once the enrolment is confirmed, e.g., like checkout in a shopping application, the bookings should be then all removed. StudentHub class – It prints the menu shown above and allows a student to reserve a class through the menu. The class should interact with both ClassList and MyBooking. When a student tries to enrol into a class, it should get all available classes from the list for the student. It should also allow students to add classes into MyBooking and remove a class from that. InvalidOptionException class - A customized exception class. This type of exception should be thrown if a user has entered an invalid option at any stage when navigating through the menu. Training Centre class - This is the driver class that initializes and runs a new session of StudentHub when a student starts engage with the application.

Detailed requirements The following are implementation details for the above classes. Only mandatory fields/methods are provided. You may need to add more fields/methods to fully achieve the required functionalities. • TrainingClass oString toString() • ClassList o void display() method: shows all available classes. Example output is as follows. The width of each information column is 30, 12, 12, 15, and 15 characters (index column is 3 characters). The availability column shows how many places are available. "Full" is displayed if the class has reached its full capacity. NOTE: for testing purposes, your program must always support the following classes. You are free to add more classes if you would like to. The capacity of these classes are all 40 people. Class Availability Duration 8 weeks 1. 3D Modelling Start Date 1 July 1 July 10 2. Paper Folding 2 days 30 Level Advanced Easy Medium Easy Advanced 3. Java 5 5 weeks 3 weeks 15 July 10 June 4. Painting FULL 5. 3D Modelling 8 weeks 20 June FULL MyBooking o void viewBooking() method: Prints all booked classes. Example output is as follows. The width of each information column is 40, 15, 12, 12 characters (index column is 3 characters). Bookings Start Date 15 July Duration 5 weeks 1. Java Level Medium Advanced 2. 3D Modelling 1 July 8 weeks If the list is empty, a message should show, e.g. "No booked classes." StudentHub o Constructor signature: StudentHub (ClassList list). The constructor initializes a new session by setting the class list and initializing a new empty booking basket. o void showMenu() method: display the main menu for the user. The menu must be identical to the example provided above. O void run() method: shows the menu by calling showMenu() method and prompts the user to choose an option. If the entered option is invalid, throws an InvalidOptionException and lets the user to enter again until a valid option is entered. For a valid option, it performs the corresponding function. Note that the program. should always return to the main menu once a function (for example, viewing the booked classes) is completed, unless the user chooses to quit the program. o void bookClass() method: performs the first option b. Book a class in the main menu. It allows student to choose a class from the class list. If 'q' is entered, go back to the ● ●

Select option 5 which is full. Option 1 selected Cannot repeat option 1 main menu. If an invalid option is entered, ask the user to choose a correct class again until this operation is successful. Note: when a class is full, the selection to that class would be viewed as invalid! If the student selected a class that is already booked previously, then the selection would be viewed as invalid as well even the class is available! No student should double book the same class. Repeating a class is possible though. For example, one can book "3D Modelling" starting from 1 July, then repeat "3D Modelling" starting from 1 November. These two classes are considered as different classes although they are just the repeats of same content starting at different time. Example the student is interested in learning 3D Modelling. Class Availability Duration 8 weeks 10 1. 3D Modelling Start Date 1 July 1 July 15 July 2. Paper Folding 2 days Level Advanced Easy Medium Easy Advanced 30 3. Java 5 weeks 5 4. Painting 3 weeks 10 June FULL FULL 5. 3D Modelling 8 weeks 20 June Please choose a class by its number (enter `q` to go back): 5 Sorry, this class is already full. Try again. 9 No option 9 Sorry, invalid entry. Try again. 1 3D Modelling starting 1 July is selected! Class Duration Start Date 1 July 1. 3D Modelling 8 weeks 2. Paper Folding 2 days Level Advanced Easy Medium Easy Advanced 3. Java 5 weeks 1 July 15 July 10 June 4. Painting 3 weeks 5. 3D Modelling 8 weeks 20 June Please choose a class by its number (enter `q` to go back): 1 Sorry, you have already selected this class. Try again. Class Duration Availability Start Date 1 July 1. 3D Modelling 8 weeks 9 2. Paper Folding 2 days 1 July 30 Level Advanced Easy Medium Easy Advanced 3. Java 15 July 5 5 weeks 3 weeks 4. Painting 10 June FULL 5. 3D Modelling 8 weeks 20 June FULL Please choose a class by its number (enter `g` to go back): Q Main menu select one option: b. Book a class v. View my bookings c. Cancel class e. Enrol all booked classes q. Quit o void view() method: performs the v. View my bookings function in the main menu. It shows the currently booked classes by calling the method viewBooking() of MyBooking class. La Availability 30 FULL FULL

Two classes in the booking list Java is cancelled 3D Modelling is now Option 1 Back to main menu when the booking list is empty o void cancel() method: performs the c. Cancel class function in the main menu. Shows the current booking details and prompts the user to choose a class to be cancelled until a valid option is entered. If the user enters 'q', quit and go back to the main menu. Example outputs are as follows. Example - User enters a valid option and a class is removed from the booking. Main menu - select one option: b. Book a class v. View my bookings c. Cancel class e. Enrol all booked classes q. Quit V Bookings Start Date Duration 1. Java 15 July 5 weeks Level Medium Advanced 2. 3D Modelling 1 July 8 weeks Main menu - select one option: b. Book a class v. View my bookings c. Cancel class e. Enrol all booked classes q. Quit Bookings Start Date 15 July Duration 5 weeks 1. Javal Level Medium Advanced 2. 3D Modelling 1 July 8 weeks Please choose the class by its number (enter `g` to go back): x123 No such option Sorry, invalid entry. Try again. 1 Java starting 15 July is cancelled! Bookings Start Date Duration 1 July 8 weeks Level Advanced 1. 3D Modelling Please choose the class by its number (enter `q` to go back): 2 Sorry, invalid entry. Try again. 1 3D Modelling starting 1 July is cancelled! No booked classes. Back to the main menu. Main menu select one option: b. Book a class v. View my bookings c. Cancel class e. Enrol all booked classes q. Quit v No booked classes. Back to the main menu. Main menu - select one option: b. Book a class v. View my bookings c. Cancel class e. Enrol all booked classes q. Quit

Back to main menu when the booking list is empty Back to main menu when the booking list is empty 1 & 3 booked. Notice their numbers under Availability? No booked classes. Back to the main menu. o void enrol() method: Performs e. Enrol into all booked classes function in the main menu. If the booked course list is not empty, reset the basket to empty, and prints "You have successfully enrolled in these classes!". Otherwise, prints the error message "No booked classes". Example outputs are as follows. A real enrolment module would require payment, student details etc, which are NOT required here. Example - this student has no class booked at the moment. Main menu select one option: b. Book a class v. View my bookings c. Cancel class e. Enrol all booked classes q. Quit E No booked classes. Back to the main menu. Main menu - select one option: b. Book a class v. View my bookings c. Cancel class e. Enrol all booked classes q. Quit Sorry, invalid entry. Try again. Main menu - select one option: b. Book a class v. View my bookings. c. Cancel class e. Enrol all booked classes q. Quit b Class Duration Availability 10 1. 3D Modelling Start Date 1 July 1 July 8 weeks 2. Paper Folding 2 days 30 Level Advanced Easy Medium Easy Advanced 3. Java 5 weeks 15 July 4. Painting 3 weeks 10 June 6 FULL FULL 5. 3D Modelling 8 weeks 20 June Please choose the class by its number (enter `g` to q' to go back): 1 3D Modelling starting 1 July is selected! Class Start Date Availability Duration 8 weeks 1. 3D Modelling 9 1 July 1 July 2. Paper Folding 2 days 30 Level Advanced Easy Medium Easy Advanced 3. Java 5 weeks 15 July 4. Painting 3 weeks 10 June 6 FULL FULL 5. 3D Modelling 8 weeks 20 June Please choose the class by its number (enter `g` to go back): 3 Java starting 15 July is selected! Class Availability Duration 8 weeks 1. 3D Modelling Start Date 1 July 1 July 9 2. Paper Folding 2 days 30 Level Advanced Easy Medium Easy Advanced 3. Java 5 weeks 15 July 5 4. Painting 3 weeks 10 June FULL 5. 3D Modelling 8 weeks 20 June FULL

Please choose the class by its number (enter `q` to go back): 9 Main menu - select one option: b. Book a class v. View my bookings c. Cancel class e. Enrol all booked classes q. Quit v Bookings Duration 1. Java 5 weeks 8 weeks Level Medium Advanced 2. 3D Modelling Main menu - select one option: b. Book a class v. View my bookings c. Cancel class Enrol all booked classes q. Quit You have successfully enrolled in: Duration 1. Java 5 weeks Level Medium Advanced 2. 3D Modelling 8 weeks Main menu - select one option: b. Book a class v. View my bookings. c. Cancel class e. Enrol all booked classes q- Quit V No booked classes. Back to the main menu. o void quit() method: Quits and terminates the application gracefully e.g. with a "Thank you" message. Note, if the booking list is not empty, confirm with the student before terminating the application. The user can go back to complete the enrolment or quit with a non-empty booking list. It is up to you how to design and implement this requirement. InvalidOptionException (extends Exception class) Constructor signature: InvalidOptionException() which is the no-argument constructor. Constructor signature: InvalidOptionException(String message), which initializes the exception message using the message parameter. ● Training Centre. This class is provided only contains the main method. It may engage with multiple StudentHubs. For this exercise, one StudentHub instance is sufficient. NOTE: You cannot assume all input will be valid e.g., scanner.nextInt(); can fail due to mismatched input. You need to handle invalid input by throwing and catching InvalidOptionException, so the program does not crash because of invalid user input. NOTE: For error messages you may use System.err instead of the standard System.out. Now the booking list is empty. Start Date 15 July 1 July Start Date 15 July 1 July

NOTE: The requirements provided above must not be adjusted/modified. However, you may add to the design presented, for example adding extra methods or instance variables.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply