PROGRAM:
#include <iostream> // To input and output operation from
console.
#include <list> // STL list , to store object of structure
Records
#include <string> // To perform operation related string like
comparison,etc.
#include <iterator> // To iterate the list.
using namespace std;
struct Records // Define structure with two attributes
{
string class_name;
char grade;
};
class Student // Define class
{
public:
Student(string& name) // Define constructor
{
this->st_name=name; // Initialize the name.
numClassesTaken = 0; // Initially set the total number of class
taken by student as zero.
}
void printRecords(); // Declare method to print all records about
student.
char gradeForClass(string& cl_name); // To find the grade of
given class.
string standing(); // To find the standing of student/
void addClass(string&, char); // To add class.
private:
int numClassesTaken; // To keep the track of clssses
string st_name; /// To store name of student
list<Records> st_records; // Declare list with type of
structure named Records.
};
void Student::printRecords()
{
cout << "\nName Of Student : " << st_name; // Printing
all details of student.
cout << "\nNumber of Classes taken : " <<
numClassesTaken;
for (const Records& record : st_records) // Iterate the
list
{
cout << "\nClass name : " << record.class_name; //
Print each class name
cout << "\nGrade : " << record.grade; // Peint grade
for that class
}
}
string Student::standing()
{
int classesTaken = st_records.size(); // Caculate number of class
attend by student
if (classesTaken >= 0 && classesTaken <= 3) // Check
condition to find standing of student
{
return "Freshman";
}
else if (classesTaken >= 4 && classesTaken <= 6) //
Check condition to find standing of student
{
return "Sophomore";
}
else if (classesTaken >= 7 && classesTaken <= 10) //
Check condition to find standing of student
{
return "Junior";
}
else
{
return "Senior"; // If student attend more than 10 class.
}
}
char Student::gradeForClass(string &cl_name)
{
for (const Records& record : st_records) // Iterate the
list.
{
if (cl_name.compare(record.class_name) == 0) // Compare the given
class with each object.
{
return record.grade; // If match the class return grade.
}
}
return 'F'; // Otherwise return F as grade.
}void Student::addClass(string & class_name,char grade
)
{
int flag = 0; // Initially set the flag as zero.
for (const Records& record : st_records) // Iterate the
list.
{
if (record.class_name.compare(class_name) == 0) // If class name
match with previouslly entered class name
{
flag = 1; // Set flag as zero
break; // Break the loop
}
}
if (flag != 1) // If class is not taken previouslly.
{
numClassesTaken++; // Inrement number of class taken.
struct Records r; // Make object of structure.
r.class_name = class_name; // Initialize the name of class.
r.grade = grade; // Initialize the grade of class.
list<Records>::iterator it;
it = st_records.end(); // Take the address of last object.
st_records.insert(it, r); // Insert at the end of list.
}
else
{ // If class is already in list, print this message.
cout << "\n" << class_name << " is taken already!
Please enter other class.";
}
}
int main()
{
string name, classname;
char grade;
cout << "Enter Name of Student : ";
getline(cin,name); // Taking name of student
Student student(name); /// Creating object of class student
cout << "\nDo you want to add class : \n Yes -> y\n No
-> n\n (y/n)?";
cin >> name; // Read choice
while (name.compare("y") == 0) // Iterate the loop untill user like
to stop.
{
cout << "\nEnter name of class : "; // get details
cin >> classname;
cout << "\nEnter Grade : ";
cin >> grade;
student.addClass(classname, grade); /// Call the function to add
class in list
cout << "\nDo you want to add class again :\n Yes -> y\n
No -> n\n (y/n)?";
cin >> name; // Again asked to enter other class.
}
cout << "\n################# YOUR DETIALS
#################\n";
student.printRecords(); // Print the details by calling the
function
cout << "\nYour standing : " << student.standing(); //
Find the standing of student.
cout <<
"\n\n####################################################\n";
cout << "\n Do you want to find grade of any class?\n Yes
-> y\n No -> n\n (y/n)";
cin >> name; // Read choice of student to find the grade of
any class.
while(name.compare("y") == 0) // Iterate the loop untill user like
to stop.
{
cout << "\nPlease enter class name : ";
cin >> classname; // Read the class name and pass as
parameter in function call
cout << "\nYour Grade in class " << classname <<
" is " << student.gradeForClass(classname); // print the
grade of class
cout << "\n Do you want to find grade of any class again?\n
Yes -> y\n No -> n\n (y/n)";
cin >> name; // Again ask to find.
}
cout << "\n Thank you!"; // Print the message
return 0;
}
OUTPUT:



SCREENSHOT OF PROGRAM:




please help Write a simple program with Student class having STL list of Record's structure as...
Please provide the code for the last part(client side
program).
yes i have all the class implementations.
``` person.h
#ifndef PERSON_H
#define PERSON_H
#include <string>
using namespace std;
class person
{
public:
person();
string getname() const;
string getadd() const;
string getemail() const;
string getphno() const;
string toString() const;
private:
string name;
string add;
string email;
string phno;
};
```person.cpp
#include "person.h"
person::person()
{
name = "XYZ";
add="IIT ";
email="%%%%";
phno="!!!!!";
}
string person::getname() const
{
return name;
}
string person::getadd()...
A teacher wants to create a list of students in her class. Using the existing Student class in this exercise. Create a static ArrayList called classList that adds a student to the classList whenever a new Student is created. In the constructor, you will have to add that Student to the ArrayList. Coding below was given to edit and use public class ClassListTester { public static void main(String[] args) { //You don't need to change anything here, but feel free...
A teacher wants to create a list of students in her class. Using the existing Student class in this exercise. Create a static ArrayList called classList that adds a student to the classList whenever a new Student is created. In the constructor, you will have to add that Student to the ArrayList. Coding below was given to edit and use public class ClassListTester { public static void main(String[] args) { //You don't need to change anything here, but feel free...
Last picture is the tester program!
In this Assignment, you will create a Student class and a Faculty class, and assign them as subclasses of the superclass UHPerson. The details of these classes are in the UML diagram below: UHPerson - name : String - id : int + setName(String) : void + getName(): String + setID(int) : void + getID(): int + toString(): String Faculty Student - facultyList : ArrayList<Faculty - rank: String -office Hours : String - studentList...
1. Do the following a. Write a class Student that has the following attributes: - name: String, the student's name ("Last, First" format) - enrollment date (a Date object) The Student class provides a constructor that saves the student's name and enrollment date. Student(String name, Date whenEnrolled) The Student class provides accessors for the name and enrollment date. Make sure the class is immutable. Be careful with that Date field -- remember what to do when sharing mutable instance variables...
Implement the following class in interface and implementation files. A separate file (the main project file) shall have the main function that exercises this class. Create a class named Student that has three member variables: name - string that stores the name of the student numClasses - integer that tracks how many courses the student is currently enrolled in, this number must be between 1 and 100 ClassList - an array of strings of size 100 used to store the...
Please help!! I am supposed to write a program in C++ about student & grades. Needs to have two functions that sorts students letter grade, and another one to sort Students name in your student’s record project. Remember, to add necessary parameters and declaration in main to call each function properly. Order of functions call are as follow Read Data Find Total Find average Find letter grade Call display function Call sort letter grade function Call display function Call sort...
Set-Up · Create a new project in your Eclipse workspace named: Lab13 · In the src folder, create a package named: edu.ilstu · Import the following files from T:\it168\Labs\lab13. Note that the .txt file must be in the top level of your project, not inside your src folder. o Student.java o StudentList.java o students.txt Carefully examine the Student.java and StudentList.java files. You are going to complete the StudentList class (updating all necessary Javadoc comments), following the instruction in the code....
Question 1 (4 mark): Implement a program with two classes according to the following UML diagram: College -firstLab Student: StudentAccount - secondLab Student: StudentAccount +main (String (1) : void +College (String, String, int, int) : +printStudents(): void contains StudentAccount -name: String -studentNumber: int StudentAccount (String, int): +getName(): String +getStudentNumber(): int 2 REQUIREMENTS • The constructor College (String, String, int, int) shall create two component objects of type StudentAccount, i.e., the first lab student and the second lab student, and initialize...
Greetings, everybody I already started working in this program. I just need someone to help me complete this part of the assignment (my program has 4 parts of code: main.cpp; Student.cpp; Student.h; StudentGrades.cpp; StudentGrades.h) Just Modify only the StudentGrades.h and StudentGrades.cpp files to correct all defect you will need to provide implementation for the copy constructor, assignment operator, and destructor for the StudentGrades class. Here are my files: (1) Main.cpp #include <iostream> #include <string> #include "StudentGrades.h" using namespace std; int...