Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You are to code the following three source files in C++: Student.h In this file, you declare a class named Student. This class contains 4

You are to code the following three source files in C++:

Student.h In this file, you declare a class named Student. This class contains 4 private attributes, name, idNumber, department, and year. name is a struct that contains two strings: firstName and lastName. idNumber is an integer and department is a string. year is an enum that contains four possible values: FRESHMAN, SOPHOMORE, JUNIOR, SENIOR. Note that struct and enum declarations should be placed before the class declaration. Define public getter functions and setter functions for all 4 attributes, that is, 4 getters and 4 setters.

Student.cpp In this file, you provide definitions for 3 constructors of Student. The first constructor takes 4 parameters, one for each attribute, then initializes the attributes accordingly. The second constructor takes 2 parameters, one for name and one for idNumber, then initializes those attributes accordingly. The remaining 2 attributes are initialized as (empty string) and FRESHMAN, respectively. The third constructor is a default constructor that takes no parameters. Here, the 4 attributes are initialized as (firstName), (lastName), 0 (idNumber), (department) and FRESHMAN (year), respectively.

hw3.cpp In this file, you define main function. In the main function, first create at least 3 Student objects. The first object must be created using the first constructor (4 parameters). The second object must be created using the second constructor (2 parameters). Since the second constructor does not provide proper information for department and year, set those values by calling their associated setter functions. 1 The third object must be created using the default constructor. Since the default constructor does not provide proper information for any attributes, set all 4 values by calling their associated 4 setter functions. After creating all the objects, call a function named displayStudent for each student to print all the information (all 4 attributes) about the student. Note that this function must be called at least 3 times to print all objects. The displayStudent function must have the following prototype: void displayStudent(Student); When displaying year, make sure the freshman year starts at 1, not 0.

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

Microsoft SQL Server 2012 Unleashed

Authors: Ray Rankins, Paul Bertucci

1st Edition

0133408507, 9780133408508

More Books

Students also viewed these Databases questions

Question

In an Excel Pivot Table, how is a Fact/Measure Column repeated?

Answered: 1 week ago