I need a working C++ program, preferably in XCode IDE that has an enum for 3 degree types (degree.h); student .h & .cpp files for the student class & setting all attributes to private; roster .h &...

1 answer below »
I need a working C++ program, preferably in XCode IDE that has an enum for 3 degree types (degree.h); student .h & .cpp files for the student class & setting all attributes to private; roster .h & .cpp files for the roster class. Vectors are not allowed and the 5 students must be stored in an array and the pointers are in the classRosterArray. Functions will remove a student (id "A3") and print the students by the degree type (SOFTWARE) in addition to printing the full roster of students. My program was close to working except it couldn't print just the SOFTWARE students nor could it recognize that A3 was removed & needed to be resized.


8/11/2021 https://srm--c.na127.visual.force.com/apex/coursearticle?Id=kA03x000000l9DcCAI https://srm--c.na127.visual.force.com/apex/coursearticle?Id=kA03x000000l9DcCAI 1/5 Tip #13: How do I develop the Performance Assessment (PA) incrementally? One approach students often use to work on this PA is to begin coding according to task requirements, A through G, in order. This is a good approach for an experienced C++ programmer wh Oriented Programming paradigm. However, it is not a suitable approach for novice C++ programmers. In this tip we propose a decomposition strategy for novice C++ programmers. The decomposition strategy suggests breaking down the large project into parts. There are many ways to decom system can be decomposed according to a bottom-up or the top-down design model. We will develop the PA incrementally, with step wise refinement. We will not necessarily work on the Req Of course, in the end we must meet all the requirements according to the rubric to pass the PA. One principle we will follow throughout this exercise is to always have a functional project, that produces meaningful and useful intermediate results at each step of the development. Please review this tip in conjunction with the PA task requirements. With that in mind let us begin. Our PA is well suited for a top-down design model. Let us review Requirement F. F. Demonstrate the program’s required functionality by adding a main() function in main.cpp, which will contain the required function calls to achieve the following results: 1. Print out to the screen, via your application, the course title, the programming language used, your WGU student ID, and your name. 2. Create an instance of the Roster class called classRoster. 3. Add each student to classRoster. 4. Convert the following pseudo code to complete the rest of the main() function: classRoster.printAll(); classRoster.printInvalidEmails(); //loop through classRosterArray and for each element: classRoster.printAverageDaysInCourse(/*current_object's student id*/); classRoster.printByDegreeProgram(SOFTWARE); classRoster.remove("A3"); classRoster.printAll(); classRoster.remove("A3"); //expected: the above line should print a message saying such a student with this ID was not found. 5. Implement the destructor to release the memory that was allocated dynamically in Roster. Here is a depiction of the top down design model for Requirement F: We can make the following observations after examining the top down design: All functions are called by the main function in the specified order (depth first, left to right), that is, the call graph is also a dependency graph. It simply means we can’t add a student to the cla the given string. The function add depends on the function parse. All functions main calls belong to the Roster class. However, functions of the Roster class may call other functions of the Stu add function may call the Student constructor to instantiate a student object. We must instantiate an object of the Roster class called classRoster before main can call its functions using the the member access operator). The main function calls the classRoster.parse function after printing out the course title, the programming language used, your WGU student ID, and your name to the screen and instantiatin classRoster.parse function parses the given string (e.g., "A1,John,Smith,John1989@gm ail.com,20,30,35,40,SECURITY" from studentData). The objective of the classRoster.parse functio (i.e., A1, John, Smith, etc.) of the student. Once the attributes have been extracted from the string, we will call the classRoster.add function. In the classRoster.add function we need to perfo call the Student constructor to instantiate a student object. We must transform “days in course” to an “array of number of days to complete each course” because the Student constructor req to complete each course” instead of “days in course”. In the classRoster.add function, we call the Student constructor with the new operator to instantiate the Student object. The new opera given type (Student) and returns a pointer (i.e., the address) to that allocated memory. We store this pointer in the classRosterArray. The classRosterArray is an array of pointers of type S Next, the main function calls the class Roster.printAll function to print all the students in the classRosterArray. However, the Roster.printAll function delegates the printing of the specific st in the Student class. Next, the main function calls the Roster.printInvalidEmails function to print all invalid emails. Next, the main function calls the Roster.printAverageDaysInCourse function to print average days in course. Current student’s ID is provided as input to the Roster.printAverageDaysInCo Next, the main function calls the Roster.printByDegreeProgram function to print all the student in the classRosterArray degree type. SOFTWARE is provided as input to the Roster.printB Next, the main function calls the Roster.remove function to remove the student identified as A3. “A3” is provided as input to the Roster.remove function. The function should print a messag A3 has been removed. Rate This Article (Average Rating: 3.08) Show Properties Tip #13: How do I develop the Performance Assessment (PA) incrementally? ARTICLE LINKARTICLE LINK BACK TO SEARCHBACK TO SEARCH 8/11/2021 https://srm--c.na127.visual.force.com/apex/coursearticle?Id=kA03x000000l9DcCAI https://srm--c.na127.visual.force.com/apex/coursearticle?Id=kA03x000000l9DcCAI 2/5 Next, the main function calls the class Roster.printAll function to print all the remaining students in the classRosterArray. Recall “A3” has been removed so it should not be printed. Howev delegates the printing of the specific student’s data to the print function in the Student class. Next, the main function calls the Roster.remove function again to remove the student identified as A3. “A3” is provided as input to the Roster.remove function. However, this time the remov message stating the student identified as A3 was not found because it has already been removed. After this general overview of the PA, here is the expected output - Note that there is no user interaction: let us now work on it incrementally, one step at a time. Step # Req. Task Tips and Tricks 1 B Create a project in the IDE including 6 files: degree.h student.h and student.cpp roster.h and roster.cpp main.cpp In all .cpp files add: #include #include using namespace std; In file main.cpp add: #include “roster.h” Tip #4 (PC) or Tip #5 (Mac) 2 F In file main.cpp add an empty main() function Zy: 2.2 3 A In file main.cpp add studentData[] from task scenario into the main() function Zy: 6.13 4 F1 In file main.cpp print out to the screen, via your application, the course title, the programming language used, your WGU student ID, and your name, in main() Zy: 2.4 5 C In file degree.h define an enumerated data Zy: 5.11, 7.19 8/11/2021 https://srm--c.na127.visual.force.com/apex/coursearticle?Id=kA03x000000l9DcCAI https://srm--c.na127.visual.force.com/apex/coursearticle?Id=kA03x000000l9DcCAI 3/5 type DegreeProgram for the degree programs containing the data type values SECURITY, NETWORK, and SOFTWARE. Tip #8 6 D For the Student class, do the following: 1. In files student.h and student.cpp create the Student class, which includes each of the following variables: • student ID • first name • last name • email address • age • array of number of days to complete each course • degree program 2. Create each of the following functions in the Student class: a. an accessor (i.e., getter) for each instance variable from part D1 b. a mutator (i.e., setter) for each instance variable from part D1 c. All external access and changes to any instance variables of the Student class must be done using accessor and mutator functions. d. constructor using all of the input parameters provided in the table e. print() to print specific student data Notice how the .h file and .cpp are being used for the Student class. student.h contains the class definition, including data members and member function declarations. student.cpp contains member function definitions. In file student.h: #include “degree.h” In file student.cpp: #include “student.h” You may defer the actual definition of the functions in student.cpp until they are required, that is, create stub functions (empty functions) for now. Zy: 7.4, 7.19, 8.4, 8.5, 8.6, 8.7, 8.9 and 8.14 7 E In files roster.h and roster.cpp create the Roster class, by doing the following: 1. Create an array of pointers, classRosterArray, to hold the data provided in the “studentData Table.” 2. Create a student object for each student in the data table and populate classRosterArray. a. Parse each set of data identified in the “studentData Table.” b. Add each student object to classRosterArray. 3. Define the following functions: a. public void add(string studentID, string firstName, string lastName, string emailAddress, int age, int daysInCourse1, int daysInCourse2, int daysInCourse3, DegreeProgram degreeprogram) that sets the instance variables from part D1 and updates the roster. b. public void remove(string studentID) that removes students from the roster by student ID. If the student ID does not exist, the function prints an error message indicating that the student was not found. c. public void printAll() that prints a complete tab-separated list of student data in the provided format: A1 [tab] First Name: John [tab] Last Name: Smith [tab] Age: 20 [tab]daysInCourse: {35, 40, 55} Degree Program: Security. The printAll() function should loop through all the students in classRosterArray and call the print() function for each student. d. public void printAverageDaysInCourse(string studentID) that correctly prints a student’s average number of days in the three courses. The student is identified by the studentID parameter. e. public void printInvalidEmails() that verifies student email addresses and displays all invalid email addresses to the user. Notice how the .h file and .cpp are being used for the Roster class. roster.h contains the class definition, including data members and member function declarations. roster.cpp contains member function definitions. In file roster.h: #include “student.h” In file roster.cpp: #include “roster.h” You must define the parse() and the add() functions now because we will need them in the next steps. Declaration for add is given in E3a. Declaration of parse is: public void parse(string row); The definition of the remaining functions may be deferred until they are required, that is, create stub functions (empty functions) for now. Zy: 7.4, 7.19, 8.4, 8.5, 8.6, 6.7, 8.9 and 8.14 8 F2 In file main.cpp create an instance of the Roster class called classRoster in the main() function. Zy: 8.6 and 8.14 Tip #15 9 F3 In file main.cpp
Answered 3 days AfterAug 11, 2021

Answer To: I need a working C++ program, preferably in XCode IDE that has an enum for 3 degree types...

Aditya answered on Aug 15 2021
146 Votes
New folder/degree.h
#pragma once
enum DegreeProgram
{
    SECURITY, NETWORK, SOFTWARE
};
New folder/main.cpp
#include
#include "Roster.h"
#include "degree.h"
using namespace std;
int main()
{
Roste
r classRoster;
classRoster.add("A1", "John", "Smith", "John1989@gm ail.com", 20, 30, 35, 40, SECURITY);
classRoster.add("A2", "Suzan", "Erickson", "Erickson_1990@gmailcom", 19, 50, 30, 40, NETWORK);
classRoster.add("A3", "Jack", "Napoli", "The_lawyer99yahoo.com", 19, 20, 40, 33, SOFTWARE);
classRoster.add("A4", "Erin", "Black", "[email protected]", 22, 50, 58, 40, SECURITY);
classRoster.add("A5", "Max", "Smith", "[email protected]", 22, 50,50,50, SOFTWARE);
cout << "Displaying all students:" << endl;
classRoster.printAll();
classRoster.printInvalidEmails(); //loop through classRosterArray and for each element:
cout << endl;
classRoster.printAverageDaysInCourse("A1");
classRoster.printAverageDaysInCourse("A2");
classRoster.printAverageDaysInCourse("A3");
classRoster.printAverageDaysInCourse("A4");
classRoster.printAverageDaysInCourse("A5");

cout << "\nShowing students in degree program: SOFTWARE\n" << endl;
classRoster.printByDegreeProgram(SOFTWARE);
cout << "\nRemoving A3" << endl;
classRoster.remove("A3");
cout << "\n" << endl;
classRoster.printAll();
cout << "\nRemoving A3 again\n" << endl;
classRoster.remove("A3");
//expected: the above line should print a message saying such a student with this ID was not found.
}
New folder/Roster.cpp
#include "Roster.h"
Roster::Roster()
{
    index = 0;
    
}
void Roster::add(string studentID, string firstName, string lastName, string emailAddress, int age, int days1, int days2, int days3, DegreeProgram degreeProgram)
{
    classRosterArray[index] = new Student (studentID, firstName, lastName, emailAddress, age, days1, days2, days3, degreeProgram);;
    index++;
}
void Roster::remove(string studentID)
{
    int found = 0;
    for (int i = 0; i < index; i++)
    {
        if (classRosterArray[i]->getStudentID() == studentID)
        {
            found++;
            for (int j = i; j < index - 1;j++)
            {
                classRosterArray[j] =...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here