Starting from:

$30

CS235-Project 1 git + GitHub + OPP and Inheritance Solved

will set the baseline for this course. Its purpose is to get you up-to-speed with working with multiple classes and multiple source files, while applying the new concept of Inheritance.




Moreover, it will introduce you to GitHub Classroom so you can work with git version control. All projects in this course will be distributed via GitHub Classroom and submitted to Gradescope via GitHub. We truly hope you will start establishing best practices of version control, you will need it in the near future, so better start now!




The project is therefore divided in 2 parts:


In Part 1 you will:

•       Set up a GitHub account if you don’t have one. 

•       Learn or brush-up on git and GitHub •    Accept a GitHub classroom assignment  •      Clone a repository for this project.

In Part 2 you will write 3 classes to apply the concepts of OOP and Inheritance.

Part 1 - getting started with GitHub Classroom:

•       If you don’t already have one, got to https://github.com/ and create a GitHub account. You will likely use your GitHub account professionally in the future, so choose a username you will want to keep.

•       Next, watch this video to brush-up on or learn the basics of git and GitHub:




https://www.youtube.com/watch?v=MJUJ4wbFm_A


•       For this project we will use GitHub Classroom. The following video will guide you through the entire process: from accepting an assignment to submitting your solution.




https://www.youtube.com/watch?v=AHDCokfgcSo




Although the video is about a different course, the instructions are the same (with different repo and file names). The only difference is that we will not add a distribution branch, so you can ignore the part where it says to execute the two git commands in the readme file (there are not extra instructions in the readme file on our repo).




This is the link to accept the assignment on GitHub Classroom:
https://classroom.github.com/a/d3uSrjqd




This video will also show you how to submit to Gradescope via GitHub. Make sure to refer back to these instructions when it’s time to submit.




Part 2 - OOP and Inheritance:

You will write 3 very simple classes. You will find the starter files for this project  on the GitHub Classroom repo,  which consist of the class  Person. Every Person has a first name, last name and ID by which they can be identified. Everyone in this course is a Person, however there are different roles a Person may take.  We have Students, TeachingAssistants and Instructors. These are all Person (with a first name, last name and ID), but they also have other attributes specific to their role. 

You will write 3 classes:

-Student

-TeachingAssistant

-Instructor

Both Students and Instructors are a Person. A TeachingAssistant is not only a Person but also a Student. Thus the inheritance structure will be as follows:

-     Student will be a derived class of Person

-     TeachingAssistant will be a derived class of Student - Instructor will be a derived class of Person

Implementation:

You must write the 3 classes (both .hpp and .cpp files for each class) based on the following specification (FUNCTION PROTOTYPES AND MEMBER VARIABLE NAMES MUST MATCH EXACTLY). Remember that accessor functions (e.g. getID()) are used to access the private data members (e.g. all getID() will do is return id_). As you implement these classes think about what is inherited and what is not (e.g. constructors are not inherited!!!). Also think about the order in which constructors are called, and how/where must you explicitly call the base class constructor (parameterized constructors must explicitly call the base class parameterized constructor, you can do that in the initializer list!).

Remember, you must thoroughly document your code!!! Please refer to the Person class for an example of style and documentations.

_____________________________________________________________________________

class Student public members:

    Student();

     Student(int id, std::string first, std::string last);      std::string getMajor() const;      double getGpa() const;

     void setMajor(const std::string major);      void setGpa(const double gpa);

class Student protected members:

  std::string major_;      double gpa_;

_____________________________________________________________________________ class TeachingAssistant auxiliary types:

The TeachingAssistant class uses an enum (a user-defined data type) to keep track of the specific role the TA has:  enum ta_role {LAB_ASSISTANT, LECTURE_ASSISTANT, FULL_ASSISTANT};

You may assume for initialization purposes that the default role is LAB_ASSISTANT. class TeachingAssistant public members:

    TeachingAssistant();

     TeachingAssistant(int id, std::string first, std::string last);      int getHours() const;      ta_role getRole() const;      void setHours(const int hours);      void setRole(const ta_role role);

class TeachingAssistant private members:

     int hours_per_week_;    ta_role role_;

_____________________________________________________________________________

class Instructor public members:

    Instructor();

    Instructor(int id, std::string first, std::string last);

    std::string getOffice() const;     std::string getContact() const;     void setOffice(const std::string office);     void setContact(const std::string contact);

     class Instructor private members:

      std::string office_;      std::string contact_;

Testing:

You must always test your implementation INCREMENTALLY!!!

What does this mean?

•       Implement and test one class at a time!!!

•       For each class:

•       Implement one function/method and test it thoroughly (multiple test cases + edge cases if applicable)

•       Implement the next function/method and test it …

•       …

How do you do this? 

Write your own main() function to test your classes. First implement and test one class, for example Instructor. Start from the constructor(s), then move on to the other functions.  Instantiate an object of type Instructor and as you implement each method, call it in main and test that it is working correctly. Choose the order in which you implement your methods so that you can test incrementally (i.e. implement mutator functions before accessor functions). Sometimes functions depend on one another. If you need to use a function you have not yet implemented, you can use stubs: a dummy implementation that always returns a single value for testing (don’t forget to go back and implement the stub!!! If you put the word STUB in a comment, some editors will make it more visible so you will remember to implement it later) For example:

//******** STUB ************// double Student::getGpa() const

{

    return 0; }

Note: this will make much more sense as your programs become more complex, but it is very important to understand the fundamental concepts and develop good implementation/testing/debugging habits from the very beginning.

Once you are done with the Instructor class, you can move on to implementing Student, then TeachingAssistant.

In your main function you also want to test for inheritance. Think about:

-     Can you access members of the base class from the derived class? Test it!!!

-     Test calling a member function of the base class via an object to type derived. Make sure it works!

More products