Create a class called Student. This class will hold the first name, last name, and test grades for a student. Use separate files to create the class (.h and .cpp)
Private Variables
Two strings for the first and last name
A float pointer to hold the starting address for an array of grades
An integer for the number of grades
Constructor
This is to be a default constructor
It takes as input the first and last name, and the number of grades.
It sets the name variables and the integer variable for the size
It allocates memory for the grades array based on the number of grades passed in
Destructor
free up memory associated with the array for the grades
A public method to enter the grades one at a time.
This is a void method.
The input is a float for the grade and an integer for the location in the grade array
The method places the grade in the appropriate spot in the array
A public method that returns a specific grade
This is a float method
Input is an index number into the grade array
Returns the grade at the index number passed in
A public method to compute the average
This is a float method
Returns the average of all the grades
A public method to return the full name of the student
Has no inputs
returns a string of the student's full name
Main function
Ask the user to enter the first name, last name, and number of grades for a student
Create a student instance and pass the user entered information to the constructor
Using a loop ask the user to enter all the grades for the student. Place that data in the instance using the appropriate method
Using the appropriate method, print the full name of the student
Using a for loop and the appropriate method print out all the grades of a student
Using the appropriate method, print out the average grade of the student
#include <iostream>
#include <string>
using namespace std;
//Student class
class Student{
//private variables
private :
string firstName, lastName;
float* grades;
int noOfGrades;
public:
//default constructor
Student(string _firstName, string _lastName, int
_noOfGrades){
firstName = _firstName;
lastName = _lastName;
noOfGrades = _noOfGrades;
grades = new
float[_noOfGrades];
}
//destructor to delete the dynamically allocated
grades array
~Student(){
delete[] grades;
}
//method to set a particular grade
void setGrade(float grade, int index){
grades[index] = grade;
}
//method to get a particular grade at the given
index
float getGrade(int index){
return grades[index];
}
//method to compute the average of the grades
float getAverage(){
float totalMarks = 0;
for(int i = 0; i < noOfGrades;
i++){
totalMarks +=
grades[i];
}
return totalMarks/noOfGrades;
}
//method to return the full name of the
student
string getName(){
string fullName = firstName + " " +
lastName;
return fullName;
}
};
//main method to show the working of above student class
int main(){
//variable to get the values from the user
string firstName, lastName;
int noOfGrades;
//taking information from the user
cout << "Enter the first name of the Student :
";
cin >> firstName;
cout << "\nEnter the last name of the Student :
";
cin >> lastName;
cout << "\nEnter the number of grades : ";
cin >> noOfGrades;
//creating a instance of the Student class
Student student(firstName,lastName,noOfGrades);
cout << "\nEnter the Grades of the Student
:\n";
//for loop to set the grades of the student from
the user
float grade;
for(int i = 0; i < noOfGrades; i++){
cin >> grade;
student.setGrade(grade,i);
}
//printing the details using appropriate methods
//using getName method to print the full name of
the student
cout << "\nName of the Student is : " <<
student.getName();
//using getGrade method to print all the grades of
the student inside a for loop
cout << "\nGrades of the Student are :\n";
for(int i = 0; i < noOfGrades; i++){
cout << student.getGrade(i)
<< "\n";
}
//using getAverage method to print the average of
grades
cout << "\nAverage of Grades is :" <<
student.getAverage();
}
Ouput:

Create a class called Student. This class will hold the first name, last name, and test...
Create a java class for an object called Student which contains the following private attributes: a given name (String), a surname (family name) (String), a student ID number (an 8 digit number, String or int) which does not begin with 0. There should be a constructor that accepts two name parameters (given and family names) and an overloaded constructor accepting two name parameters and a student number. The constructor taking two parameters should assign a random number of 8 digits....
Write a class called Student. The specification for a Student is: Three Instance fields name - a String of the student's full name totalQuizScore - double numQuizesTaken - int Constructor Default construtor that sets the instance fields to a default value Parameterized constructor that sets the name instance field to a parameter value and set the other instance fields to a default value. Methods setName - sets or changes the student name by taking in a parameter getName - returns...
Java - In NetBeans IDE: • Create a class called Student which stores: - the name of the student - the grade of the student • Write a main method that asks the user for the name of the input file and the name of the output file. Main should open the input file for reading . It should read in the first and last name of each student into the Student’s name field. It should read the grade into...
Create a Business class: Instance variables: Student id 1000 - 9999 Student name Present Student email address Present Number of hours 3.5 - 18 Two constructors should be coded, one that accepts no arguments and sets every field to its default value, and one that accepts all four fields, and assigns the passed values into the instance variables. For each instance variable create two methods; a getter and a setter. Add a static method to the class that will accept...
using C# Write a program which calculates student grades for multiple assignments as well as the per-assignment average. The user should first input the total number of assignments. Then, the user should enter the name of a student as well as a grade for each assignment. After entering the student the user should be asked to enter "Y" if there are more students to enter or "N" if there is not ("N" by default). The user should be able to...
*** C++ *** Create a class called Student that contains a first name ( string) and an student id number (type long). 1. Include a member function called get_data( ) to get data from the user for insertion into the object, 2. Also include a function called display_data( ) that displays the student data. Then write a complete program that uses the class to do some computation. Your main function, main( ), should create a Dynamic Array of...
Course Class Create a class called Course. It will not have a main method; it is a business class. Put in your documentation comments at the top. Be sure to include your name. Course must have the following instance variables named as shown in the table: Variable name Description crn A unique number given each semester to a section (stands for Course Registration Number) subject A 4-letter abbreviation for the course (e.g., ITEC, PHED, CHEM) number A 4-digit number associated...
Create a class called Employee that includes three instance variables—a first name, a last name, and a monthly salary. Code the default (no-args, empty) constructor. Provide a set and a get method for each instance variable. If the monthly salary is not positive, do not set its value.
Part I (20%) [File: Student.java] Create a class called Student that has the following stored properties: • StudentID • First Name • Last Name Class Student should have read/write properties, constructor(s) and should implement the Academic interface. For academic methods, return zero for average, zero for credits and false for graduate. Also implement the toString() method that returns the above information as a String. Part II (5%) [File: Academic.java] Create an interface Academic that declares three methods: 1. average -...
The object class should be a Student with the following attributes: id: integer first name: String last name: String write the accessors, mutators, constructor, and toString(). In your main test class you will write your main method and do the following things: Create an array of Student objects with at least 5 students in your array. Write a sort method that must be your original work and included in the main class. The sort method will sort based on student...