Question

In: Computer Science

Write a C++ programs to: 1. Create a class called Student with four (4) private member...

Write a C++ programs to:
1. Create a class called Student with four (4) private member variables, name (string), quiz, midterm, final (all
double type);
2. Include all necessary member functions for this class (at least 1 constructor, 1 get function, and 1 grading
function – see #6);
3. Declare three (3) objects of Student type (individual or array);
4. Read from the keyboard three (3) sets of values of name, quiz, midterm, final and assign them to each object;
5. Using the object’s member function to calculate the grade for each student (grade = quiz * 0.2 + midterm * 0.4 +
final * 0.4)
6. Display on the screen only the name of each student and the grade.

Solutions

Expert Solution


#include <iostream>

using namespace std;

class student
{
   
    private:
    string name;
    double final, quiz, midterm,grade ;
   
   
    public:
    student();
    void getdata();
    void grading();
  
};


    student :: student()
{
cout<<"This is Student Details"<<endl;
}
void student :: getdata()
{
cout<<"Enter the student Name"<<endl;
cin>>name;
cout<<"Enter the student midterm marks"<<endl;
cin>>midterm;
cout<<"Enter the student quiz marks"<<endl;
cin>>quiz;
cout<<"Enter the student final marks"<<endl;
cin>>final;

grade = (quiz * 0.2 + midterm * 0.4 +final * 0.4);

}


void student :: grading()
{
cout<<"Student Name :"<<name<<endl;
cout<<"Student grade:"<<grade<<endl;

}


int main()
{

student s;
s.getdata();
s.grading();

return 0;
}


Related Solutions

C++ Classes & Objects Create a class named Student that has three private member: string firstName...
C++ Classes & Objects Create a class named Student that has three private member: string firstName string lastName int studentID Write the required mutator and accessor methods/functions (get/set methods) to display or modify the objects. In the 'main' function do the following (1) Create a student object "student1". (2) Use set methods to assign StudentID: 6337130 firstName: Sandy lastName: Santos (3) Display the students detail using get functions in standard output using cout: Sandy Santos 6337130
Language C++ Student-Report Card Generator: create a class called student and class called course. student class...
Language C++ Student-Report Card Generator: create a class called student and class called course. student class this class should contain the following private data types: - name (string) - id number (string) - email (s) - phone number (string) - number of courses (int) - a dynamic array of course objects. the user will specify how many courses are there in the array. the following are public members of the student class: - default constructor (in this constructor, prompt the...
C++ HW Aim of the assignment is to write classes. Create a class called Student. This...
C++ HW Aim of the assignment is to write classes. Create a class called Student. This class should contain information of a single student. last name, first name, credits, gpa, date of birth, matriculation date, ** you need accessor and mutator functions. You need a constructor that initializes a student by accepting all parameters. You need a default constructor that initializes everything to default values. write the entire program.
C++ language You will create a Hangman class. Possible private member variables: int numOfCharacters; //for the...
C++ language You will create a Hangman class. Possible private member variables: int numOfCharacters; //for the secret word char * secretWord; char *guessedWord; public: //please create related constructors, getters, setters,constructor() constructor() You will need to initialize all member variables including the two dynamic variables. destructor() Please deallocate/freeup(delete) the two dynamic arrays memories. guessALetter(char letter) 1.the function will check if the letter guessed is included in the word. 2. display the guessed word with related field(s) filled if the letter guessed...
Question 1 (10) Create a class Student with public member variables: Student name, student number, contact...
Question 1 (10) Create a class Student with public member variables: Student name, student number, contact number, ID number. The following specifications are required:  Add init() method of the class that initializes string member variables to empty strings and numeric values to 0. (2)  Add the method populate() to the class. The method is used to assign values to the member variables of the class. (2)  Add the method display() to the class. The method is used...
WRITE IN C++ Create a class named Coord in C++ Class has 3 private data items...
WRITE IN C++ Create a class named Coord in C++ Class has 3 private data items               int xCoord;               int yCoord;               int zCoord; write the setters and getters. They should be inline functions               void setXCoord(int)             void setYCoord(int)            void setZCoord(int)               int getXCoord()                     int getYCoord()                   int getZCoord() write a member function named void display() that displays the data items in the following format      blank line      xCoord is                          ????????      yCoord is                          ????????      zCoord...
Create a C# Application. Create a class object called “Employee” which includes the following private variables:...
Create a C# Application. Create a class object called “Employee” which includes the following private variables: firstN lastN idNum wage: holds how much the person makes per hour weekHrsWkd: holds how many total hours the person worked each week regHrsAmt: initialize to a fixed amount of 40 using constructor. regPay otPay After going over the regular hours, the employee gets 1.5x the wage for each additional hour worked. Methods: constructor properties CalcPay(): Calculate the regular pay and overtime pay. Create...
Create a class called Student which stores • the name of the student • the grade...
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 the grade field. • Calculate the...
please write this in C # Create a Patient class which has private fields for patientid,...
please write this in C # Create a Patient class which has private fields for patientid, lastname, firstname, age, and email. Create public properties for each of these private fields with get and set methods. The entire lastname must be stored in uppercase. Create a main class which instantiates a patient object and sets values for each data item within the class. Display the data in the object to the console window.
C# programming Create a class called A with private integer field x, protected integer field y,...
C# programming Create a class called A with private integer field x, protected integer field y, public integer field z. Create a class B derived from class A with public integer field d and protected integer field e and private field f. Write a main (in a THIRD class called Program) that create an object B and assign all publicly accessible fields of the object with value of 1. Which fields will have a value of 1? Create a method...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT