Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For this homework, you will simulate basic data structure management for a hypothetical ski school. Assume a ski school can have an indefinite number of

For this homework, you will simulate basic data structure management for a hypothetical ski school. Assume a ski school can have an indefinite number of instructors and students. In an ideal scenario, each ski instructor should have no more than 5 students. Each student is assigned to an instructor on an as available basis (i.e. whoever is most available). However, students can also request a specific instructor. When all instructors already have 5 students, priority should be on maximizing the number of instructors with only 5 students, with other instructors having up to 8 students. When all instructors already have 8 students, any additional students will be assigned to instructors with the least number of students. Create a tree data structure with inserts based on these requirements.

Formula

  • Less than 5 students per instructor: Students distributed evenly across all instructors -> 5 instructors and 5 students means each instructor has 1 student

  • More than 5 students, up to 8 students per instructor: Students should be added to an instructor until the instructor has 8 students before adding students to another instructor -> 3 instructors and 20 students means one instructor has 8 students, another instructor has 7 students, and the last instructor has 5 students

  • More than 8 students per instructor: Students are distributed evenly across all instructors -> 3 instructors and 28 instructors means two instructors has 9 students and one instructor has 10 students.

Assignment Description

Create a tree data structure used to keep track of the above data. Implement insert and remove for the tree data structure (what should happen when an instructor is removed?)

Grading Criteria

Objects expected: o [1 Point] Abstract class Person o [1 Point] Instructor class inherits from Person o [1 Point] Student class inherits from Person o [1 Point] Supervisor class inherits from either Person or Instructor (whats the correct inheritance model and why?)

Implementation o [3 Points] Tree data structure root will be one supervisor overseeing all instructors Students are child nodes of instructor nodes i.e. Root node: one supervisor. 2nd level: instructors. 3rd level: students.

o Insert and Remove [5 Points] Follows the above formula [2 Points] Insert instructor [2 Points] Insert a student without specifying instructor [2 Points] Insert a student with specifying instructor (what if the instructor already has more than 5 students?) [2 Points] Remove student [3 Points] Remove Instructor (what happens to all the students?)

o Find a teacher [2 Points] Given the teachers name [2 Points] Given the students name

o [3 Points] Display function prints out all teachers with all students under each teacher, e.g.

Teacher 1 Student 1 Student 2 Student 3 Teacher 2 Student 1 Student 2

Demonstration o A ski school containing each of the following 3 teachers, 19 students [1 Point] Inserts without specifying instructor [1 Point] Inserts with instructor specified [1 Point] Display the resulting structure after all students inserted [1 Point] Remove one teacher from the previous tree and "Display" (there should be 2 teachers, 19 students remaining) [1 Point] Attempt to insert a student for the teacher that was previously removed (what should happen?)

Please use C++, and must meet all of the grading criteria, thank you!

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

Database Design And Relational Theory Normal Forms And All That Jazz

Authors: Chris Date

1st Edition

1449328016, 978-1449328016

More Books

Students also viewed these Databases questions

Question

Why is the System Build Process an iterative process?

Answered: 1 week ago