Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C++ class called Student that should contain the following: A data member name. A data member idNumber Three data members quiz1, quiz2, quiz3.

Write a C++ class called Student that should contain the following:

  • A data member name.
  • A data member idNumber
  • Three data members quiz1, quiz2, quiz3.
  • A constructor that initializes each of the data members.
  • A get member function for each of the data member.
  • Three set member functions, one for each of setQuiz1, setQuiz2 and setQuiz3
  • A member function average to return the average of the three quizzes.
  • A member function printDetails to print the details of a student object in the following format:
    • Student Name:
    • Student ID:
    • Quiz Grades:

Also write a driver program StudentDriver.cpp that does the following:

  • Creates an object of type Student, supplying values for name, ID number and three quizzes in a constructor call.
  • Calls the printDetails member function to print the details of the student
  • Calls the average member function to get the average and print it.
  • Prompts the user if any change of grades is wanted
  • Asks the user of which quiz grade to change
    • Prompts for and reads the new grade for the quiz
    • Then updates the quizs grade with the newly entered grade
    • Prints the details and the average again to show that the change is reflected in the students record
  • Requests if any more change is need to be made to any of the quizzes.
  • Repeat the process of prompting the user for changes until the user selects N

Below, you find a sample run of the program. Pay attention to the format of the output and what gets printed. Also note that the input of of the program is indicated by text that is enclosed by two stars on both sides (you do not need to write code that prints out the input). You should mimic the output.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Student Name: Mustafa Al Lail Student ID: 970875 Quiz Grades: 85 100 95 The student's quiz average is: 93.33 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Do you want to change any of the quizzes' grades ( Y or N) : **Y** Which quiz do you want to change ( 1 or 2 or 3 ): **1** Enter the grade for quiz 1: **1** ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Student Name: Mustafa Al Lail Student ID: 970875 Quiz Grades: 1 100 95 The student's quiz average is: 65.33 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Do you want to change any of the quizzes' grades ( Y or N) : **Y** Which quiz do you want to change ( 1 or 2 or 3 ): **2** Enter the grade for quiz 2: **0** ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Student Name: Mustafa Al Lail Student ID: 970875 Quiz Grades: 1 0 95 The student's quiz average is: 32 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Do you want to change any of the quizzes' grades ( Y or N) :**Y** Which quiz do you want to change ( 1 or 2 or 3 ):**3** Enter the grade for quiz 3: 52 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Student Name: Mustafa Al Lail Student ID: 970875 Quiz Grades: 1 0 52 The student's quiz average is: 17.67 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Do you want to change any of the quizzes' grades ( Y or N) : **N** ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Student Name: Mustafa Al Lail Student ID: 970875 Quiz Grades: 1 0 52 The student's quiz average is: 17.67 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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

Practical Database Programming With Visual Basic.NET

Authors: Ying Bai

1st Edition

0521712351, 978-0521712354

More Books

Students also viewed these Databases questions