Answered step by step
Verified Expert Solution
Link Copied!

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 object-oriented programming in C++.
Define Student and ClassRoom class.
Create Student and ClassRoom objects and use the objects to perform object-oriented programming.
COURSE PREPARATION
Read the following documents:
Chapter 8 and 10 of lecture slides and e-textbook.
Chapter 8 and 10 C++ Program Examples.
The references listed with this assignment.
CSC134-Coding 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, 5 pts]
Define Student header files Student.h.[Application Development, 15 pts]
Implement Student class in Student.cpp file. [Application Development, 25 pts]
Define Classroom header files ClassRoom.h.[Application Development, 15 pts]
Implement Classroom class in ClassRoom.cpp file. [Application Development, 25 pts]
Implement object-oriented programming in TestProgram.cpp file. [Application Development, 10 pts]
Compress the whole project folder in a zip file, submit the zip file to BB for credits. [Quality Assurance, 5 pts]
PROBLEM and INSTRUCTIONS
In this assignment, you will develop a C++ program to create Student object using the data in the attached studentInfo.txt file. Then put the Student objects in a ClassRoom object, and use ClassRoom object to perform object-oriented programming tasks:
Input data file studentInfo.txt----1. Create a new C++ project LastName_Lab8, define class Student, class ClassRoom and test program by adding the following files:
Student.h
Student.cpp
ClassRoom.h
ClassRoom.cpp
TestProgram.cpp
2. 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 (5 parameters, one for each data member)
o Getter and setter functions for each non-static data member
o Value-returning function called calcAvgGpa which calculates and returns the average of 2 GPAs.
o Void function called displayStudent which displays a students last name, first name, 2 GPAs and average GPA.
3. Details/Define the member functions of class Student in
Student.cpp:
Null Constructor (no parameters)
o Initialize non-static data members to default initial value (First name, Last name, Student ID should have default value of , GPA1 and GPA2 should have a default value of 0.0)
Constructor with parameters
o Initialize non-static data members with the parameters.
Getter and Setter functions for each non-static data member
Value-returning function called calcAvgGpa to calculate and return the average of 2 GPA.
Void function called displayStudent to display students last name, first name, 2 GPA scores and average GPA score (by calling the calcAvgGpa function).
4. Declare the following data members and member function prototypes of class ClassRoom in ClassRoom.h:
Data members
o Number of student objects read/added in this classroom (int)
o Array of student objects (make size is 10 since there are 10 students in the file)
Student StudentArray[10];
Member functions
o Constructor with classroom name for a parameter (this can be CSC-134).
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 Value-returning function called calcStudentAvg which calculates and returns the average score of all students.
o Value-returning function called getNumStudent which returns the number of student objects.
5. Details/Define the member functions of class ClassRoom in
ClassRoom.cpp:
Constructor with 1parameter
o Initialize classroom name with parameter value.
o Initialize number of students as 0.
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::setStudentArray(Student 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

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

Databases And Python Programming MySQL MongoDB OOP And Tkinter

Authors: R. PANNEERSELVAM

1st Edition

9357011331, 978-9357011334

More Books

Students also viewed these Databases questions

Question

When and how will strategy reviews take place?

Answered: 1 week ago

Question

Do you know how you will monitor progress?

Answered: 1 week ago