c967

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

5. Things that confused me: Q. Where does the studentData Table go? A. in the Main.cpp file Q. How do I implement the days to complete array? A. Define it as an array of 3 integers. In the constructor definition in the Student.cpp page you will create a for loop to fill it with data. Q. What exactly does a Roster class object consist of? A. This was a bit hard for me to wrap my head around, because it has no obvious attributes like the Student class does (e.g. ID, first name, email, age, etc.). The Roster class needs no constructor, instead in the public space along with the functions just make and array of 5 pointers to a Student object (classRosterArray). For the parse function, there is a video by on the course tips that is great, although instead of a return statement at the end, you will call the add function. Using the add function to link to your Student class is something that confused me as well. If you're struggling with it, it is the perfect type of question to have a CI go through with you. Q. What exactly goes in main.cpp? A. the student table data goes here. Then you will create an instance of the Roster class (classRoster), next you will populate it by creating a for loop that calls your parse function for the student data table. Once you have done this, the rest of the task is pretty straight forward, just calling your functions to use on your new Roster object array. 4. For my learning resource I used Udemy's "C++, from beginner to beyond". It is long (40+ hours) and very thorough. I skipped some parts and skimmed others, and focused most on sections 11, 12, and 13. . To explain the project as simply as possible, your task is to take an array of strings containing student data (studentData Table), and turn them into objects of the Student class. Then you will create a Roster class who's entity is an array of pointers that point to objects in the Student class. Within the Roster class you will create functions that access the Student objects that the Roster array points to.

I'm going to preface everything first however by saying this; if you've run into a wall that nothing in this post seems to help with, put your project folder into a zipped file, upload it to the Google Drive attached to your student email, and send it to your assigned CI with questions. You don't even need to fight for an appointment in their schedules, just email them. It's the fastest way to get an answer and it'll likely save you a lot of time. I know when I took this class, which was NOT that long ago, trying to find a free appointment with a CI was difficult. The project for this class requires you to take the string presented to you and create a command-line C++ application that parses this string into an array, then carries out some specified functions below. Those of you with a lot of C++ familiarity will likely find this to be a breeze, but if you're coming into this without C/C++ knowledge or being simply new to programming, you'll likely feel a bit shell-shocked.

Roster.cpp and Roster.h

I've bundled these two files together because you're going to be handling very similar code in these two. The first file you'll work on, the Roster.h file, is where you're going to define everything related to your Roster class. (Make sure you add the correct ".h" files to you includes so their code will work in this class.) That means you'll need to... Create a class constructor Create a class destructor IF YOU CHOOSE NOT TO PARSE IN MAIN.CPP, Create a function that parses a string with delimiters Create a function that adds a student object to a roster object Create a function that removes a student by their ID Create a function that outputs all the objects in this object Create a function that outputs the integer array of average days by student ID Create a function that outputs invalid email addresses Create a function that outputs all students with a certain degree program. And create an array that holds objects from an abstract class... For the Roster.h file you only need to type out what functions/methods and variables this class will contain. In the Roster.cpp class, you'll take the above functions and actually define them (as in, you'll write the code that makes them work. Make sure you to add "roster.h" as an include for your Roster.cpp file.

Student.cpp and Student.h

Last, but surely not least, is the Student class. You may be a bit confused about this class at first because it's what you might call an "abstract class" meaning it's a class that's only called by another class to create objects. Like the Roster.cpp and Roster.h files, you'll be writing out what you need in your header files first, which is; A set of private variables for each of the information you want to parse from your string (including an array for three specific integers) Create a class constructor Create an overloaded class constructor Create a destructor Create "Accessor/Getter" functions for all your variables Create "Mutator/Setter" functions for all of your varaibles Create a function that prints all of those variables when called As you define the functions in your Student.cpp file, you may want to keep your all of your getter and all of your setter functions grouped together so you can find them easily in case of errors. This is the part of the project where understanding how "this" and the "->" operator work will REALLY come in handy. Aside from that, the functions in this .cpp file are far less complicated than Roster.cpp's.

Just keep in mind that you don't need to be a C++ master to pass this class, so to keep from getting lost in the weeds, I recommend focusing on concepts related to the project (at least until you've finished it) and learning new ones based on where you're struggling with it. Below are some of the most important concepts you'll want to learn, the ones that you'll need to complete your project.

Outputing data to the screen (cout) Creating Classes and Objects Using for loops and if statements Accessing an Object's method Deleting Objects Creating functions, calling them, and returning data using them Creating Class Methods like Construtors, Destructors, Accessors/Getters, Mutators/Setters, and Print. Overloading a Class Constructor Creating Arrays in C++, specifically arrays of pointers Adding data to an Array and deleting data from it Parsing a string with delimiters Creating and using Enums Using C++ libraries (#include <libraryname>) Using the "this" keyword Using the "->" operator

Degree.h

This is the only header file you'll be including into your program that will not require a matching .cpp. The reason for this is because the Degree.h file is used only to create your Enum class a certain variable. I'm going to quickly explain something about enums that might help; think of an enum class as a traffic light. A traffic light might have 3 states, here's how that might look in C++; enum class TrafficLight { RED, YELLOW, GREEN, }; Don't be fooled by the text however, if you called an enum, you'd actually get back a number. That's because the states, which are what the RED, YELLOW, and GREEN, stand for in the enum class, actually refer to integers. So for example, RED = 0, YELLOW = 1, GREEN = 2. Think about this as you set enums in your code for the other files. You can set strings to match your enum states by creating a static const string array, but I believe that's above and beyond what's asked for this project.

Main.cpp

You should have your string of data to be parsed included here (make sure your information is included in A5). You should have code that outputs your personal information (Course Title, Language Used, Student ID, and Name) You should call your roster class's constructor to create a new roster object called "classRoster". You should a method that seperates the elements from the string array from the top and sends them a parse function. (I believe you can either include the parse function here OR you can call a parse function in one of your classes.) You should call a function that outputs the contents of your new Roster object (so you know all the Students were added correctly). You should call a function that outputs all Students that have invalid emails. You should loop through your classRoster and call a function that outputs the integer array for "average days in course" for each student ID. You should call a function that outputs students that match a certain degree program state. You should call a function that deletes a certain Student by its ID. You should call a function that outputs all Students again. You should call a function that deletes a certain Students by its ID again and comes up with an error. You should then delete your classRoster to free its memory. For this file you're mostly going to want to focus on understanding how to call function methods, parse a string (or call a function in the class that does), use if and loop statements, output data to the screen, and release memory.


Ensembles d'études connexes

chapter 6 (6.4 and 6.5) human factors reading

View Set

Sinoatrial (SA) node Action Potential

View Set

English 11- Midterm questions over the whole year

View Set

Environmental Science Final; Mutiti GCSU

View Set

NUR 2092 Ch 54 Drugs acting on the upper respiratory system

View Set

The Process of Occupational Therapy

View Set