Answered step by step
Verified Expert Solution
Question
1 Approved Answer
OBJECTIVES In this lab assignment, students will demonstrate the ability to: Understand the basic concepts and syntax of object - oriented programming in C +
OBJECTIVES
In this lab assignment, students will demonstrate the ability to:
Understand the basic concepts and syntax of objectoriented programming in C
Define Student and ClassRoom class.
Create Student and ClassRoom objects and use the objects to perform objectoriented programming.
COURSE PREPARATION
Read the following documents:
Chapter and of lecture slides and etextbook.
Chapter and C Program Examples.
The references listed with this assignment.
CSCCoding Guidelines.doc posted in Course Resources Tutorials and Guidelines to Create and Submit C Programs.
GRADING RUBRIC
Indent code and insert comments to document your program. Quality Assurance, pts
Define Student header files Student.hApplication Development, pts
Implement Student class in Student.cpp file. Application Development, pts
Define Classroom header files ClassRoom.hApplication Development, pts
Implement Classroom class in ClassRoom.cpp file. Application Development, pts
Implement objectoriented programming in TestProgram.cpp file. Application Development, pts
Compress the whole project folder in a zip file, submit the zip file to BB for credits. Quality Assurance, pts
PROBLEM and INSTRUCTIONS
In this assignment, you will develop a C program to create Student object using the data in the attached studentInfotxt file. Then put the Student objects in a ClassRoom object, and use ClassRoom object to perform objectoriented programming tasks:
Input data file studentInfotxt Create a new C project LastNameLab define class Student, class ClassRoom and test program by adding the following files:
Student.h
Student.cpp
ClassRoom.h
ClassRoom.cpp
TestProgram.cpp
Declare the following data members and member function prototypes of class Student in Student.h:
Data members
o First name string
o Last name string
o Student ID string
o First Year GPA double
o Second Year GPA double
Member functions
o Null Constructor no parameters
o Constructor with parameters parameters, one for each data member
o Getter and setter functions for each nonstatic data member
o Valuereturning function called calcAvgGpa which calculates and returns the average of GPAs.
o Void function called displayStudent which displays a students last name, first name, GPAs and average GPA.
DetailsDefine the member functions of class Student in
Student.cpp:
Null Constructor no parameters
o Initialize nonstatic data members to default initial value First name, Last name, Student ID should have default value of GPA and GPA should have a default value of
Constructor with parameters
o Initialize nonstatic data members with the parameters.
Getter and Setter functions for each nonstatic data member
Valuereturning function called calcAvgGpa to calculate and return the average of GPA.
Void function called displayStudent to display students last name, first name, GPA scores and average GPA score by calling the calcAvgGpa function
Declare the following data members and member function prototypes of class ClassRoom in ClassRoom.h:
Data members
o Number of student objects readadded in this classroom int
o Array of student objects make size is since there are students in the file
Student StudentArray;
Member functions
o Constructor with classroom name for a parameter this can be CSC
o Getter and setter functions for Number of students, and Array of student objects.
o Void function called readAndCreateStudentArray which creates an array of Student objects by reading student data from input data file.
o Void function called displayAllStudents which displays the header information and calls the displayStudent function from Student class for loop
o Valuereturning function called calcStudentAvg which calculates and returns the average score of all students.
o Valuereturning function called getNumStudent which returns the number of student objects.
DetailsDefine the member functions of class ClassRoom in
ClassRoom.cpp:
Constructor with parameter
o Initialize classroom name with parameter value.
o Initialize number of students as
Getter and Setter function for each data member Classroom name, Number of student objects
Getter and Setter function for Array of student objects:
o The setter function for the Array of students setStudentArray should request an array of Student objects and number of students as parameters:
void ClassRoom::setStudentArrayStudent students int numStudent
o The getter function for the Array of students getStudentArray should return an array of Student objects, the return type could be a pointer to Student:
Student ClassRoom::getStudentArray
Void function called readAndCreateStudentArray which performs the following:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started