Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Lab 1 I Introduction This lab will help you to practice Java statements, method and array, by implementing a toy simulator of our course add-drop

Lab 1

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedI

Introduction

This lab will help you to practice Java statements, method and array, by implementing a toy simulator of our course add-drop system. The system maintains a "database" of students' names and courses that he/she has enrolled. The system should support adding courses, dropping courses, and list courses. You will need to self-study course add-drop system. Tasks For example, we have 5 courses available: comp2011, comp2012, comp2013, comp2014, comp2015. When adding or dropping a course, you need to specify the student's name (you may assume it is unique) and the course that is going to be added/dropped. For adding a course, if the student has already enrolled in at least one course, the system will append the newly added course to his/her course record. But if it is the first time the student is trying to add courses, the system will create a record for him/her and state that this is the first course of this student (see sample output below).. The system should support listing the courses that the student has enrolled. The system should support some basic validation check: Student cannot add the same course two times nor drop a course that is not enrolled. When dropping the last course, there will be nothing in the student course list, but the system should still keep the empty file for him/her so that when another course is added, it knows that this is not the first time. Sample Output The sample output format is for reference only. Feel free to change the output format as long as it is clearly understandable. ---------------------- Add-Drop course menu A for add; D for drop; L for list; Q for quit: A Please enter the student name: Tom Please enter the course you want to add: comp2011 Adding course: comp2011 This is the first course of this student Add course successfully ---------------------- Add-Drop course menu A for add; D for drop; L for list; Q for quit: A Please enter the student name: Tom Please enter the course you want to add: comp2012 Adding course: comp2012 Add course successfully ---------------------- Add-Drop course menu A for add; D for drop; L for list; Q for quit: D Please enter the student name: Tom Please enter the course you want to drop: comp2011 Dropping course: comp2011 Drop course successfully ---------------------- Add-Drop course menu A for add; D for drop; L for list; Q for quit: L Please enter the student name: Tom Listing course of the student: Tom comp2012 ---------------------- Add-Drop course menu A for add; D for drop; L for list; Q for quit: A Please enter the student name: Tom Please enter the course you want to add: comp2012 Adding course: comp2012 This course has been alreay added ---------------------- Add-Drop course menu A for add; D for drop; L for list; Q for quit: D Please enter the student name: Tom Please enter the course you want to drop: comp2011 Dropping course: comp2011 The student has not enrolled the course, cannot drop. ---------------------- Add-Drop course menu A for add; D for drop; L for list; Q for quit: L Please enter the student name: Bob Listing course of the student: Bob Cannot find student: Bob; list failed! ---------------------- Add-Drop course menu A for add; D for drop; L for list; Q for quit: D Please enter the student name: Bob Please enter the course you want to drop: comp2011 Dropping course: comp2011 Cannot find student: Bob; drop failed! ---------------------- Add-Drop course menu A for add; D for drop; L for list; Q for quit: I Input Invalid, please input again ---------------------- Add-Drop course menu A for add; D for drop; L for list; Q for quit: Q Quit...

Lab1 Introduction This lab will help you to practice Java statements, method and array, by implementing a toy simulator of our course add-drop system. The system maintains a "database" of students' names and courses that he/she has enrolled. The system should support adding courses, dropping courses, and list courses. You will need to self-study course add-drop system. Tasks For example, we have 5 courses available: comp2011, comp2012, comp2013, comp2014, comp2015. When adding or dropping a course, you need to specify the student's name (you may assume it is unique) and the course that is going to be added/dropped. For adding a course, if the student has already enrolled in at least one course, the system will append the newly added course to his/her course record. But if it is the first time the student is trying to add courses, the system will create a record for him/her and state that this is the first course of this student (see sample output below).. The system should support listing the courses that the student has enrolled. The system should support some basic validation check: Student cannot add the same course two times nor drop a course that is not enrolled. When dropping the last course, there will be nothing in the student course list, but the system should still keep the empty file for him/her so that when another course is added, it knows that this is not the first time. Sample Output The sample output format is for reference only. Feel free to change the output format as long as it is clearly understandable. Add-Drop course menu A for add: D for drop; L for list: Q for quit: A Please enter the student name: Tom Please enter the course you want to add: comp2011 Adding course: comp2011 This is the first course of this student Add course successfully Add-Drop course menu A for add: D for drop: L for list; Q for quit: A Please enter the student name: Tom Please enter the course you want to add: comp2012 Adding course: comp2012 Add course successfully Add-Drop course menu A for add: D for drop: L for list: Q for quit: D Please enter the student name: Tom Please enter the course you want to drop: comp2011 Dropping course: comp2011 Drop course successfully Add-Drop course menu A for add; D for drop: L for list: Q for quit: L Please enter the student name: Tom Listing course of the student: Tom comp2012 menu Add-Drop course mer A for add: D for drop; L for list: Q for quit: A Please enter the student name: Tom Please enter the course you want to add: comp2012 Adding course: comp2012 This course has been alreay added Add-Drop course menu A for add; D for drop; L for list; Q for quit: D Please enter the student name: Tom Please enter the course you want to drop: comp2011 Dropping course: comp2011 The student has not enrolled the course, cannot drop Add-Drop course menu A for add; D for drop; L for list: Q for quit: L Please enter the student name: Bob Listing course of the student: Bob Cannot find student: Bob; list failed! Add-Drop course menu A for add; D for drop; L for list; Q for quit: D Please enter the student name: Bob Please enter the course you want to drop: comp2011 Dropping course: comp2011 Cannot find student: Bob; drop failed! Add-Drop course menu A for add: D for drop; L for list: Q for quit: I Input Invalid, please input again Add-Drop course menu A for add; D for drop; L for list; Q for quit: Q Quit

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Q .1. Different ways of testing the present adulterants ?

Answered: 1 week ago

Question

Q.1. Health issues caused by adulteration data ?

Answered: 1 week ago

Question

1. Traditional and modern methods of preserving food Articles ?

Answered: 1 week ago

Question

What is sociology and its nature ?

Answered: 1 week ago