QuestionQuestion

Transcribed TextTranscribed Text

Write a simple program with Student class having STL list of Record's structure as a member. 1. Records of the Students are not accessible to the outside world. 2. Student shall output its standing (Freshman, Sophomore etc). 3. A Student can only be created with the name. 4. A class can only be added if there is a class name and the passing grade. Driver program creates a Student, adds few classes to the Student's records, then prints student's standing. Your Record and Student objects should be like the following (Note, that is not a complete declaration to implement specification as given. You will need to add something else): struct Record { string class_name; char grade; }; class Student { public: Student(string & name); void printRecords(); char gradeForClass(string & cl_name); string standing(); void addClass(string &, char); private: int numClassesTaken; string st_name; std::list<Records> st_records; }; /*********************** * Student::printRecords() * When called from the main(), this function prints the entire Student's record: * classes taken along with their grades. */ void Student::printRecords() { //Your implementation here } /*********************** * Student::standing() * When called from the main(), this function should output: * "Freshman", "Sophomore", "Junior", "Senior", * depending on the number of classes successfully(!) taken. * The exact implementation (in the part of * how many classes needed to advance to the next level) is up to you. * But this function should not iterate over the list of Records, or call std::list's * size() to determine the number of classes. You have a variable for that in * the Student's class. * Note that this function returns string by value. */ string Student::standing() { //Your implementation here } /*********************** * Student::gradeForClass() * Parameter: A class name. * Return type: a single character of grade. * Behavior: * When called from the main(), this function shall find a class by its name * in the Student's Records and output the grade for that class. * In case there is no such class in the Records, you shall output the value, * somehow reflecting that. */ char Student::gradeForClass(string & cl_name) { //Your implementation here } /*********************** * Student::addClass() * When called from the main(), this function creates a new Record and adds that to * the list of Student's Records. It also increments the numClassesTaken, * which will be used to determine a Student's standing. */ void Student::addClass(string & class, char grade) { //Your implementation here } Extra credit 1 (+5). Modify a program as appropriate so that no two the same classes could be in the Records. Make sure that numClassesTaken is correctly reflects the number of unique classes. Extra credit 2 (+5). In the lecture we discussed that objects need constructors. Why there is no constructor in my declaration of the Record and what happens in such case?

Solution PreviewSolution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

#include "Student.h"
#include <iostream>
#include <fstream>

using namespace std;

int main(int argc, char const *argv[])
{
    // clean the old output file
    fstream out;
    out.open("output.txt", ios::out);
    out.clear();
    out.close();
    string name = "Kim Haly";
    Student student(name);
    string classes [] = {"English", "French", "Italian"};

    student.addClass(classes[0], 'A');
    student.addClass...
$30.00 for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available C-Family Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats