Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi there, Can someone help me with this assignment please? An IMPORTANT note about numeric literals: It is OK to use literals 0 (zero) or

Hi there, Can someone help me with this assignment please?

An IMPORTANT note about numeric literals: It is OK to use literals 0 (zero) or 1 (one) to initialize variable values, but constants or variables should be used otherwise.

Besides main.cpp, Week-4 in Replit has a folder named includes with 2 files: student.h and student.cpp.

main.cpp

Enter your first and last name at the top in comments. Include file student.h be sure to include the path as it is in a different folder. Declare a constant integer named AP_STUDENTS with a value of 2. Declare a constant integer named NBR_STUDENTS with a value of 3.

Inside the main function:

Declare a Student array named students_ap with an array size of AP_STUDENTS, and initialize the student names as: Mike Miller and Linda Lawson. Declare a Student array named students with an array size of NBR_STUDENTS.

Under the code: cout << "Enter scores for AP students "; Write a loop to call setScores for each student in the students_ap array.

Under the code: cout << "Show scores for AP students "; Write a loop to call showScores for each student in the students_ap array.

Under the code: cout << "Enter names for non-AP students "; Write a loop to call updateName for each student in the students array.

Under the code: cout << "Enter scores for non-AP students "; Write a loop to call setScores for each student in the students array.

Under the code: cout << "Show scores for non-AP students "; Write a loop to call showScores for each student in the students array.

student.h

Above the code: using namespace std; Include file iostream.

Define a class named Student with

Public members:

A static constant integer named NBR_SCORES with a value of 4. Prototype the below functions: A void function named setName with 2 string parameters for first name, and last name. A void function named updateName with no parameters. A void function named setScores with no parameters. A void function named show Scores with no parameters. A constructor with 2 string parameters each with a default value of (an empty string).

Private members:

A string named firstName. A string named lastName. An integer array named scores with an array size of NBR_SCORES. An integer named studentID. A static integer named ID.

student.cpp

Include file student.h no path needed as it is in the same folder. Initialize the private static variable ID with a value of 100.

Function definitions:

Define setName to

set the private variables firstName and lastName with the values of the parameters.

Define updateName to

prompt the user for first name and last name then call setName. For example: Enter first name for student 103: Enter last name for student 103: Note: the prompts show the student ID number. Hint: you will need 2 local string variables.

Define setScores to

prompt the user for the students scores and populate the private scores array. For example: Enter score 1 for student 101: Mike Miller Note: the prompt shows which score and the student ID number and student name. Note: you must write a loop to run NBR_SCORES times.

Define showScores to

show the scores in the private scores array as well as the average for the scores. For example: Scores for student 101: Mike Miller are 100 100 99 98 The average is: 99 Note: the output shows the student ID number and student name. Note: you must write a loop to show all of the scores. Note: write just one loop to show the scores and calculate the average.

Define the constructor to

Increment the private static variable ID then assign that value to the private variable studentID Then call setName.

Sample output :

// SAMPLE OUTPUT Enter scores for AP students Enter score 1 for student 101: Mike Miller 100 Enter score 2 for student 101: Mike Miller 100 Enter score 3 for student 101: Mike Miller 99 Enter score 4 for student 101: Mike Miller 98 Enter score 1 for student 102: Linda Lawson 100 Enter score 2 for student 102: Linda Lawson 98 Enter score 3 for student 102: Linda Lawson 99 Enter score 4 for student 102: Linda Lawson 92 Show scores for AP students Scores for student 101: Mike Miller are 100 100 99 98 The average is: 99 Scores for student 102: Linda Lawson are 100 98 99 92 The average is: 97 Enter names for non-AP students Enter first name for student 103: Mary Enter last name for student 103: Mills Enter first name for student 104: Jacob Enter last name for student 104: Johnson Enter first name for student 105: Tim Enter last name for student 105: Thomas Enter scores for non-AP students Enter score 1 for student 103: Mary Mills 98 Enter score 2 for student 103: Mary Mills 97 Enter score 3 for student 103: Mary Mills 96 Enter score 4 for student 103: Mary Mills 95 Enter score 1 for student 104: Jacob Johnson 87 Enter score 2 for student 104: Jacob Johnson 86 Enter score 3 for student 104: Jacob Johnson 85 Enter score 4 for student 104: Jacob Johnson 84 Enter score 1 for student 105: Tim Thomas 76 Enter score 2 for student 105: Tim Thomas 75 Enter score 3 for student 105: Tim Thomas 74 Enter score 4 for student 105: Tim Thomas 73 Show scores for non-AP students Scores for student 103: Mary Mills are 98 97 96 95 The average is: 96 Scores for student 104: Jacob Johnson are 87 86 85 84 The average is: 85 Scores for student 105: Tim Thomas are 76 75 74 73 The average is: 74

Goodbye ***********************************/

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 Oracle8I Building Efficient Databases

Authors: Jonathan Lewis

1st Edition

0201715848, 978-0201715842

More Books

Students also viewed these Databases questions