Page 1 of 1

Write the following three source files in C++: • Student.h – In this file, you declare a class named Student. – This cla

Posted: Tue Jul 05, 2022 10:19 am
by answerhappygod
Write 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 andlastName.– 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 beforethe class declaration.– Define public getter functions and setter functions for all 4attributes, that is, 4 getters and 4 setters.• Student.cpp– In this file, you provide definitions for 3 constructors ofStudent.– 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 onefor idNumber, then initializes thoseattributes accordingly. The remaining 2 attributes are initializedas “” (empty string) and FRESHMAN,respectively.– The third constructor is a default constructor that takes noparameters. Here, the 4 attributes are initializedas “” (firstName), “” (lastName), 0 (idNumber), “” (department) andFRESHMAN (year), respectively.• hw3.cpp– In this file, you define main function.– In the main function, first create at least 3 Studentobjects.– The first object must be created using the first constructor (4parameters).– The second object must be created using the second constructor (2parameters).– Since the second constructor does not provide proper informationfor department and year, set thosevalues by calling their associated setter functions.– The third object must be created using the defaultconstructor.– Since the default constructor does not provide proper informationfor any attributes, set all 4 values bycalling their associated 4 setter functions.1
– After creating all the objects, call a function nameddisplayStudent for each student to print all theinformation (all 4 attributes) about the student. Note that thisfunction must be called at least 3 timesto print all objects. You must define this displayStudent function(next to main) with the followingprototype:void displayStudent(Student);– When displaying year, make sure the freshman year starts at 1,not 0.
Example run:Name: Roger FedererID Number: 12345Department: ArtYear: 4Name: Rafael NadalID Number: 56789Department: Computer ScienceYear: 3Name: Novak DjokovicID Number: 13579Department: PhysicsYear: 1