1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
DiKsa [7]
3 years ago
9

Write a programmimg code in c++ for school based grading system, the program should accept the subject in the number of students

from a user and store their details in the array of type student(class) the student class you have:
1. number student name, index number remarks as variables of type string, marks as integer and grade as char.
2. avoid function called getData which is used to get student details
3. avoid function called calculate which will work on the marks and give the corresponding great and remarks as given below on
Marks 70-100 grade A remarks excellent Mark 60-69 Grade B remarks very good marks 50-59 grade C remarks pass maths 0-49 grade F remarks fail​
Computers and Technology
1 answer:
DerKrebs [107]3 years ago
3 0

Answer:

The program is as follows:

#include <iostream>

#include <string>

using namespace std;

class Student{

string studName, indexNo, remarks; int marks;  char grade;

public:

 void getData(){

     cin.ignore();

     cout<<"ID: "; getline(cin,indexNo);

  cout<<"Name:"; getline(cin,studName);

  cout<<"Marks: ";cin>>marks;  }

 void calculate(){

  if(marks>=70 && marks<=100){

      remarks ="Excellent";       grade = 'A';   }

  else if(marks>=60 && marks<=69){

      remarks ="Very Good";       grade = 'B';   }

  else if(marks>=50 && marks<=59){

      remarks ="Pass";       grade = 'D';   }

  else{

      remarks ="Fail";       grade = 'F';   }

  cout << "Grade : " << grade << endl;

  cout << "Remark : " << remarks << endl;  }

};

int main(){

int numStudents;

cout<<"Number of students: "; cin>>numStudents;

Student students[numStudents];

for( int i=0; i<numStudents; i++ ) {

 cout << "Student " << i + 1 << endl;

 students[i].getData();

 students[i].calculate(); }

return 0;}

Explanation:

This defines the student class

class Student{

This declares all variables

string studName, indexNo, remarks; int marks;  char grade;

This declares function getData()

public:

 void getData(){

     cin.ignore();

Prompt and get input for indexNo

     cout<<"ID: "; getline(cin,indexNo);

Prompt and get input for studName

  cout<<"Name:"; getline(cin,studName);

Prompt and get input for marks

  cout<<"Marks: ";cin>>marks;  }

This declares funcion calculate()

 void calculate(){

The following if conditions determine the remark and grade, respectively

<em>   if(marks>=70 && marks<=100){ </em>

<em>       remarks ="Excellent";       grade = 'A';   } </em>

<em>   else if(marks>=60 && marks<=69){ </em>

<em>       remarks ="Very Good";       grade = 'B';   } </em>

<em>   else if(marks>=50 && marks<=59){ </em>

<em>       remarks ="Pass";       grade = 'D';   } </em>

<em>   else{ </em>

<em>       remarks ="Fail";       grade = 'F';   } </em>

This prints the grade

  cout << "Grade : " << grade << endl;

This prints the remark

  cout << "Remark : " << remarks << endl;  }

};

The main begins here

int main(){

This declares number of students as integer

int numStudents;

Prompt and get input for number of students

cout<<"Number of students: "; cin>>numStudents;

This calls the student object to declare array students

Student students[numStudents];

This is repeated for all students

for( int i=0; i<numStudents; i++ ) {

Print number

 cout << "Student " << i + 1 << endl;

Call function to get data

 students[i].getData();

Call function to calculate

 students[i].calculate(); }

return 0;}

You might be interested in
When might you use the Internet without accessing the World Wide Web?
harina [27]
Jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
5 0
3 years ago
The Leader Motive Profile (LMP) includes a: a. high need for power. b. low need for achievement. c. moderate need for power. d.
algol [13]

Answer:

a. is correct

Explanation:

6 0
4 years ago
TRY IT Choose the Right Technology MP3 player Widescreen laptop computer Smartphone Tablet computer with wireless Internet Suppo
Gnoma [55]

is this like a story or sum

3 0
3 years ago
Read 2 more answers
How to set a prperty to all intems in array c#
Katena32 [7]
Try looking at this site, <span>www.c-sharpcorner.com/article/working-with-arrays-in-C-Sharp/</span>
6 0
3 years ago
Vitamins and minerals dissolve easily in water.True or false?
noname [10]
True vitamins and minerals dissolves in water
8 0
3 years ago
Other questions:
  • To what device, inside the computer, do all other devices connect
    10·2 answers
  • Apart from confidential information, what other information does NDA help to outline?
    15·1 answer
  • Which social network site has 1.5 billion actives users per month?
    15·1 answer
  • What is the purpose of an internet protocol address (ip address)?
    5·1 answer
  • An alteration threat violates information integrity. <br> a. True <br> b. False
    13·1 answer
  • Which statement describes Augmented Reality (AR) technology?
    12·1 answer
  • What is an example of using the Internet of Things (IoT) to deliver innovative Cloud-based solutions to customers?
    14·1 answer
  • What is used to print out very large posters or maps?
    10·2 answers
  • What methods could you use to set up printing in an organization?
    15·1 answer
  • Which original VPN protocol is supported by most platforms but offers low levels of security?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!