Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is for C++ Write a program that will read students ID, first name, last name, and 5 scores from an input file hw2data.txt. The

This is for C++

Write a program that will read students ID, first name, last name, and 5 scores from an input file hw2data.txt. The 5 scores are midterm exam score, final exam score, homework score, lab score, and quiz score. The program calculates a students weighted total based on the formula: Weighted total = 25%(midterm score) + 25%(final exam score) + 30%(homework score) + 10%(lab score) + 10%(quiz score). And then assigns a letter grade to student using the grade scale: 90 <= weighted total <= 100 A 80 <= weighted total < 90 B 70 <= weighted total < 80 C 60 <= weighted total < 70 D 0 <= weighted total < 60 F The program should output each students ID, full name, 5 scores, weighted total, and letter grade in a neat format. Your program should define a class Student and implement it as required. The class Student should have the following private member variables. Member Variable Description ID An int variable that holds a students ID. firstName A string variable that holds a students first name. lastName A string variable that holds a students last name. scores An int array that holds a students 5 scores in the order of midterm exam score, final exam score, homework score, lab score, and quiz score. The class Student should also have the following public member functions. Member Function Description Default constructor Set ID to 0, firstName and lastName to empty string, and all elements of scores to 0. Overload constructor Accepts a students ID, first name, last name, and an int array (storing 5 scores) as arguments. Calls other member functions to copy these values into the appropriate member variables. setID Accepts an int argument and copies it into the ID member variable. setFName Accepts a string argument and copies it into the firstName member variable. setLName Accepts a string argument and copies it into the lastName member variable. setScores Accepts an int array argument and copies it into the scores member variable. getID Returns the value in ID. getFName Returns the value in firstName. getLName Returns the value in lastName. getWeightedTotal Calculates and returns the weighted total as a floating-point value. The weight for the midterm score, final score, homework score, lab score, and quiz score is 25%, 25%, 30%, 10%, and 10%, respectively. getGrade Finds and returns the letter grade based on the students weighted total. printStudent Call other member functions and output a students ID, first name followed by a space, followed by last name, and followed by 5 scores, weighted total, and letter grade. Align each column in a neat format as shown in the sample output. Suppose that the input data file contains the records of 25 students. Use an array of Student that holds 25 objects. In the main function, the program reads from the data file and calls member functions of class Student to set member variables and output the results. The hw2data.txt file can be downloaded separately. Assume all the data are valid. Submission: You should submit a ZIP file that contains three files: the class header file Student.h, the class implementation file Student.cpp and the test program hw2main.cpp. Be sure to include the integrity statement I certify that this submission is my own original work with your name and RAM ID in each source file. Do NOT use any other names for the above three files.

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2017 Skopje Macedonia September 18 22 2017 Proceedings Part 3 Lnai 10536

Authors: Yasemin Altun ,Kamalika Das ,Taneli Mielikainen ,Donato Malerba ,Jerzy Stefanowski ,Jesse Read ,Marinka Zitnik ,Michelangelo Ceci ,Saso Dzeroski

1st Edition

3319712721, 978-3319712727

More Books

Students also viewed these Databases questions

Question

Prepare an ID card of the continent Antarctica?

Answered: 1 week ago

Question

What do you understand by Mendeleev's periodic table

Answered: 1 week ago