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
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.
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...
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...
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...
create a class in C++ having the following 4 private members: one double variable representing the...
create a class in C++ having the following 4 private members: one double variable representing the balance of a bank account on string variable representing the bank account number a function to deposit money from the bank account a function to withdraw money from the bank account the following 2 public members: -two wrapper functions. - one parameterless constructor - one constructor initializing the account balance and account number - sample: #include <iostream> using namespace std; class account { public:...
Task You will write a class called Grid, and test it with a couple of programs....
Task You will write a class called Grid, and test it with a couple of programs. A Grid object will be made up of a grid of positions, numbered with rows and columns. Row and column numbering start at 0, at the top left corner of the grid. A grid object also has a "mover", which can move around to different locations on the grid. Obstacles (which block the mover) and other objects (that can be placed or picked up)...
follow pseudo 1) Create class called Node Declare private integer called data (or any other name)...
follow pseudo 1) Create class called Node Declare private integer called data (or any other name) Declare private Node called link (or any other name) 2) Declare constructor Should be public (ex: Node) where: link is equal to null data is equal to zero 3) Declare another constructor public Node with parameters integer d, Node n where: data is equal to d link is equal to n 4) Declare function to set link to next Node link equal to n...
***Given a class called Student and a class called Course that contains an ArrayList of Student....
***Given a class called Student and a class called Course that contains an ArrayList of Student. Write a method called dropStudent() as described below. Refer to Student.java below to learn what methods are available.*** Course.java import java.util.*; import java.io.*; /****************************************************** * A list of students in a course *****************************************************/ public class Course{ /** collection of Students */ private ArrayList<Student> roster; /***************************************************** Constructor for objects of class Course *****************************************************/ public Course(){ roster = new ArrayList<Student>(); } /***************************************************** Remove student with the...
Using C# Create a class called Artist that contains 4 pieces of information as instance variables:...
Using C# Create a class called Artist that contains 4 pieces of information as instance variables: name (datatype string), specialization – i.e., music, pottery, literature, paintings (datatype string), number of art items (datatype int), country of birth (datatype string). Create a constructor that initializes the 4 instance variables. The Artist class must contain a property for each instance variable with get and set accessors. The property for number should verify that the Artist contributions is greater than zero. If a...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT