Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

language is c++ For this exercise you will be creating a classroom of students using dynamic allocation. Program Description This problem is designed to give

image text in transcribedimage text in transcribed

language is c++

For this exercise you will be creating a classroom of students using dynamic allocation. Program Description This problem is designed to give you practice at creating and using classes, using dynamic allocation of arrays, objects, and pointer accesses to objects. For this program you will define a Student class and use it to implement the required functionality in main. Program Requirements For this, as in all assignments, you are expected to follow the course programming style guidelines and to properly implement both header and source files for your functions. All input should be fully validated You should have two header and source files. One will be for the Student class and its methods and the other will be for any helper functions you implement Student Class The Student class should include two private variables, string name and int age. It should have a default constructor that sets name to and age to 0. It should have an overloaded constructor that has parameters to set both values. All constructors should use initialization lists. There should be a destructor that does nothing All variables should have setters and getters. All getters should be constant. Helper Functions getInteger o used to get an input value o input parameters are min and max value oget and validates an integer between min and max return the value createStudent o used to create a new student get name and age, age validated as being positive integer use name and age to dynamically create a student return the student displayStudents o used to display array of students o array should be passed safely o no return values Main functionality Your main program should ask the user how many students are in the class. It should use getInteger to enter a value and create a dynamic array of that many pointers to Student It should have a for loop that calls createStudent and fills the array with the returned Student objects. It should then use std::sort to sort the Students alphabetically by name. Since name is private, you will have to use the accessor method to accomplish this. Finally, it should call displayStudents to list then in alphabetical order

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

Intelligent Databases Technologies And Applications

Authors: Zongmin Ma

1st Edition

1599041219, 978-1599041216

More Books

Students also viewed these Databases questions