Write a test program for tracking their course sections

Assignment Help Data Structure & Algorithms
Reference no: EM131321625

Programming Assignment: Data Structures

A college wants to you to write a test program for tracking their course sections.

Classroom capacities on campus range from a minimum of 1 student to a maximum of 30 students.

Data stored about each course includes: the course number, the course title, the capacity (number of seats) for the course, the number of students enrolled in the course, and a list of student ids for students enrolled in the course.

Class Details

The following data members must be declared as part of the new class, course.

Data Field Data Type
course number string (2 uppercased letters followed by 3 digits)
course title string
capacity integer (between 1 and 30)
number students enrolled integer (between 0 and capacity)
student id list array of 5-digit student ids (size = maximum course capacity)

The following member functions must be declared as part of the new class, course.

Two constructor functions (one without parameters, and one with parameters)

Constructor without parameters will set the initial values to:
course number to " "
course title to " "
capacity to minimum capacity of a classroom
number students enrolled to 0

Constructor with parameters will provide the following parameters and default values:
course number (no default - must be supplied)
course title (no default - must be supplied)
capacity = (default = maximum capacity)
The number students enrolled will not be a parameter, and this constructor will set it to 0.

Mutator functions (assign values to data members)
setCourseNum
setCourseTitle
setCapacity

Accessor functions (access values from data members)
getCourseNum
getCourseTitle
getCapacity
getNumEnrolled

Facilitator functions:
printCourse (display course data)
printStudentIds (display all student ids on student id list)
addOneStudent (add one student to course)
dropOneStudent (drop one student from course)

Operator overloading functions:
operator++ (increment capacity by one)
operator<< (displays object data)

NOTE: Data members within the course type class may only be accessed via the above member functions.

You will also need to define several functions outside of the class, for reading and error checking user input and managing the courses.

Program Details

When the program begins, it will create three course type objects as follows:

Create using the constructor with parameters to set the course number and course title to CS361, Control Structures (will use the default capacity).

Create using the constructor with parameters to set the course number and course title to CS362, Data Structures, and set the capacity to 10.

Create using the constructor without parameters.

After course3 is created, prompt the user for the course number and course title, and assign them to the object data fields.

When all three courses objects have been created, the program will allow the user to manipulate the objects.

The program will access the course number and course name in each of the course objects to present a Choose Course menu to the user for choosing a course to manage.

The Choose Course menu must be implemented so that the user enters either a course number or E to exit.

Example:

Choose a course to manage:
CS361 - Control Structures
CS362 - Data Structures
MT415 - Linear Algebra
Enter the course number (e.g. CS200) or E to exit:

After the user chooses a course to manage, the program will display a Course Management menu of actionchoices, as detailed on the next page.

The actions will be applied to the course that was chosen to be managed.

Course Management menu choices:

P - Print course data (to the screen)

Use the overloaded << operator to display the course data as follows:

CS361 - Control Structures:

1 seats taken, out of 15 total seats

N - Modify course Number

Call a function to read, error check, and return a valid course number.

Course numbers must be 2 letters followed by 3 digits. If a course number entered by the user is invalid, issue an error message stating why it is invalid. Loop and re-prompt for the course number, until it is valid.

The function should uppercase the letters, if user enters them in lowercase, before returning the value.

Then use setCourseNum to store the new value, and then confirm the change.

Example:
New course number is CS430
T - Modify course Title

Call a function to read, error check, format, and return a valid course title (i.e. course name).

Course titles can contain only letters and spaces. If a title entered by the user is invalid, issue an error message stating why it is invalid. Loop and re-prompt for the title, until it is valid.

NOTE: In order to read the title, you will need to use getline (covered in text Chapter 3) because the extraction operator (>>) will only read strings up to the first whitespace.

After error checking the title characters, format the title. The first letter and each letter following a space will be uppercased, and the rest will be lowercased. Return the valid formatted title.

Then use setCourseTitle to store the new value, and confirm the change.

Example:
New course title is Operating Systems

C - Modify course Capacity

Call a function to read, error check, and return a valid course capacity. The function should insure that the new capacity is within the minimum and maximum allowable capacity.

Using the returned value, check to insure the new capacity is not less than the current student enrollment (use getNumEnrolled to check the current enrollment).

If the new value is below the current number of students enrolled, issue a message saying that students must be dropped from the course first.

Example:

Error - cannot change capacity to 20 unless 2 students are dropped, because 22 students are already registered.

Otherwise, use setCapacity to store the new value and confirm the change.

Example:

Capacity is now 11

I - Increment course Capacity

Use the overloaded ++ operator to increment the course capacity by one, as long as it does not exceed the maximum capacity allowed, and then confirm change.

Example:

Capacity is now 12

S - Student Management

Display a Student Management sub-menu (display student ids, add one student, drop one student, and return back to the Course Management menu).

The options should be implemented as follows:

P - Print Student IDs (to the screen)

Use printStudentIds to display the ids of students enrolled in the course,

one student per line.

Example:

2 students enrolled in CS361
77777
87228

A - Add one student

If course is full, issue an error message.

Example:

Course is full. Cannot add any more students.

Otherwise, use addOneStudent to add one student to the course, as follows:

Call an input function to read, error check, and return a valid student ID (must be a 5digit integer, no leading zeros allowed).

Then store the student id number in the list, increment the student enrollment, and Confirm the change.

If the course is empty, simply display a message stating there are no students enrolled.

Example:
Cannot drop a student -- no students are enrolled.

Otherwise, use dropOneStudent to drop one student from the course, as follows:

a) Display the student ids
b) Ask the user for the student id number of the student to drop
c) Find the student id number in the list
d) If the student id number is found, delete the id from the list and decrement the enrollment.

Reminder: Deleting from unordered arrays was covered in online content sections 3.4.3 and 3.4.4.

e) Display a message confirming which student id number was dropped, or stating that the student id number could not be found.

B - Back to Course Management menu

Exit the Student Management menu and return to the Course Management menu.

Loop around the Student Management menu options, until the user chooses B.

[END of Student Management menu options]

B - Back to Choose Course menu

Exit the Course Management menu and return to the Choose Course menu.

Loop around the Course Management menu options, until the user chooses B.

The program will loop around the Choose Course menu, until the user chooses Exit.

NOTE: For each menu, when a menu choice is entered, the program will error check the user has entered a valid choice, and will issue an error message if the choice is not valid.

Before exiting the program, use the overloaded << operator again to display the course data for all three courses.

Program Notes:

1. Your program must conform to all CS362 Coding Standards specified in Content section 1.7.

- The program should include a file header at the top of each program file
- Each function should include a function header.

2. This program should be of modular design (minimum of FIFTEEN functions/methods).

- The breakdown of the code must be logical, not arbitrary!

Unauthorized distribution (including uploading to any non-Regis Internet website) violates copyright law

- The main function should do little more than call other functions.
- The other functions/methods should each perform ONE well-defined task.

3. Your program should be thoroughly tested, and test data files should be submitted.

Reference no: EM131321625

Questions Cloud

Analyze inventory valuation methods : Analyze inventory valuation methods discussed in the textbook. Based on your analysis, recommend the most accurate valuation method that reflects current economic conditions. Provide a rationale for your recommendation
What is present value of this investment : An investment will pay $2,566 two years from now, $2,243 four years from now, and $2,639 five years from now. If the opportunity rate is 6.98 percent per year, what is the present value of this investment?
Discuss the merits and demerits of computer freezing : One of the methods used in extracting computer forensics evidence is to freeze the computer. While this is considered a good approach by many people, there are those who think it is shoddy work. Discuss the merits and demerits of computer "freezin..
Write a function that creates a file with two nicely columns : Write a function that creates a file with two nicely formatted columns containing the t values to the left and the corresponding y values to the right. Let the t values appear in increasing order.
Write a test program for tracking their course sections : A college wants to you to write a test program for tracking their course sections. Classroom capacities on campus range from a minimum of 1 student to a maximum of 30 students.
Present value and future value of this cash flow stream : Claire Conscience has shares of an oil well that only occasionally generates any income. Her projections are that she will receive $200 in year 1, $1,000 in year 3, and $500 in year 4. If Claire’s opportunity cost is 5.5%, what is the present value a..
What is a bastion router : Search and discuss as many services and protocols as possible offered by a modern firewall.
Pressure inside the eardrum does not change : Assume that the air pressure inside and out are balanced when you leave Denver, the pressure inside the eardrum does not change, and that the density of the air is constant and is equal to 0.80 kg/m3.
Fast-growing firm recently paid a dividend : A fast-growing firm recently paid a dividend of $0.80 per share. The dividend is expected to increase at a 15 percent rate for the next three years. Afterwards, a more stable 11 percent growth rate can be assumed. If a 12 percent discount rate is app..

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Explain binary tree by induction

Binary tree is full if all of its vertices have either zero or two children. Let Bn denote number of full binary trees with n vertices. Illustrate by induction (substitution) that Bn is 2 (n) .

  What data structure did you choose

what data structure did you choose (from lists, stacks, queues or trees) and why, and briefly explain why you did not choose the others.

  Find optimal routing for the trucks

Based on the provided coordinates, compute the rectilinear distance between the nodes. All nodes have to be served in one day by several trucks. Find optimal routing for the trucks with the least total distance, by applying any of the methods prese..

  Create a class whose main method creates three arrays

Create a class whose main method creates three arrays. The first array will contain five kinds of flowers - petunia, pansy, rose, violet, and carnation.

  Modify the algorithm to print the sales amount

Study the algorithm below and then modify the algorithm to print the sales amount for all ten salespersons. Review the algorithm, identify the inaccuracies, insert the corrections, save the document, and submit the document for grading.

  Determine the optimal data storage method

Analyze the fundamental impact of IT architecture or enterprise architecture on information management for your chosen company or industry. Determine if IT architecture impacts the effectiveness or efficiency of information management and vice ver..

  Show how the box can be used to factor n

That is, given a quadratic residue y, the box outputs an x with x2 = y (equation is modulo n). Show how the box can be used to factor n.

  You assign each int with a particular id

You assign each int with a particular ID.Array (4, 5, 6, 5, 4, 6) ID (1, 2, 3, 4, 5, 6)

  Question about character array

The 2-most important design issues that are specific to character string types are the given, Should strings be simply a special kind of character array or a primitive type?

  Question about data network

The Minnesota Computer Consulting Group is a fifty person consulting services practice focusing on telecommunications and systems administration that includes Minnesota offices in Minneapolis, St. Paul, and Rochester.

  Create a binary search tree from an array

Create a binary search tree from an array

  How would you modify the rabin-karp algorithm

Implement the floor(), ceil(), rank(), and select() (from our standard ordered ST API from CHAPTER 3) for TrieST - Construct a worst-case example for the Boyer-Moore implementation in ALGORITHM 5.7 (which demonstrates that it is not linear-time).

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd