Question: Answer using c++ programming language. Objective: The purpose of this lab project is to expose you to structures and classes. Problem Specification: Using a structure:
Answer using c++ programming language.
Objective:
The purpose of this lab project is to expose you to structures and classes.
Problem Specification:
Using a structure:
You are to write a program that will define a structure consisting of the following data members, fields:
- Name - a string
- Student id number an integer.
- Three test scores positive short integers.
- Average a float
- Grade a character.
Input to the program consists of:
- name
- id number
- three test scores
Requirements:
- Use a function to read the name, id number and three test scores, the function will return a structure.
- A function to find the average, the function is a void function that takes the entire structure as an argument (by reference) and calculates the average.
- A function that takes the average as argument and returns the grade (A,B,C,D, or F) using standard grading.
- A function that prints each data member of the structure on a separate line and calls another function that prints the message You Passed, if average is >= 70, or You Failed.
Using a class:
You are to write a program that will define a class consisting of the following data members:
- Name - a string
- Student id number an integer.
- Three test scores positive short integers.
Input to the program consists of:
- name
- id number
- three test scores
Requirements:
- Must use a project with three files (a specification, an implementation, and a client file)
- Must define a null destructor, and a constructor with default arguments to initialize data members to null or zero.
- Use setter function(s) to read the name, id number and three test scores from the keyboard.
- Getter function(s) that prints each data member of the object on a separate line and uses two private functions that will find the average and grade (local to print) to be printed. Print will also print You Passed, if the average is >= 70 or You Failed.
- All getter functions are constant and all setter functions use constant parameters by reference.
Your output, for both, should be a report like follows:
Employee Name : Jim Donavan
Id Number : 2345
Tests :
- 78
- 88
- 98
Average : 88.00
Grade : B You Passed.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
