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
Why have countries requested for the removal of content?
Kipish [7]
These links should help u:
https://support.google.com/transparencyreport/answer/7347744?hl=en

https://searchengineland.com/most-censorship-and-content-takedown-requests-come-from-us-says-google-...
5 0
3 years ago
You can use ____ arguments to initialize field values, but you can also use arguments for any other purpose.
Fofino [41]
B.constructor I think that’s the answer
7 0
3 years ago
Pls answer thank you​
Sav [38]

Answer:

That would be your opinion

5 0
3 years ago
Outline the things that Mccann needs to do right away
olya-2409 [2.1K]

He needed to get Tompkins on board for using the new system companywide language that would assist in furthering the project. Tompkins would be required to recruit a new outsourced team that can work on-site

McCann also needs to talk with the architects about communication. They not only need to start attending the biweekly programs, but also they need to learn proper communication with the business.

Another important thing that McCann needs to do is to get in contact with the HR department about retaining Linda as a full time employee.






5 0
3 years ago
You are the security analyst for your organization and have discovered evidence that someone is attempting to brute-force the ro
Sergeu [11.5K]

Answer:

Active Attack

• It is an active attack 1, because someone is actively attacking your system. It is also an active attack because it is affecting the way your system works negatively, and visibly.

• 2, because they have been caught for actively committing a crime.

• lastly, because a brute-force is classified as an active attack, regardless. It is an illegal way to attempt to damage, steal or change a root password.

•<em> Fun fact </em>

 <em>A DDoS(distributed denial-of-service) is also classified as an active attack.</em>

6 0
3 years ago
Other questions:
  • A. True
    14·2 answers
  • About ___% of children score within one standard deviation above or below the national average in intelligence.
    5·1 answer
  • Although a user directory is treated as a file, it is flagged to indicate to the file manager that this file is really a ____ wh
    9·1 answer
  • Swapping two numbers
    10·1 answer
  • write a function that takes a string as parameter, return true if it’s a valid variable name, false otherwise. You can use keywo
    6·1 answer
  • Which term is used to define the wires on a motherboard that move data from one part of a computer to another?
    13·1 answer
  • Is backing up computer files done on the hard drive?
    14·2 answers
  • Hat is the purpose of the domain name?
    7·2 answers
  • Anyone 13 i a boy 13 pan
    12·2 answers
  • I hope The characters That I want in Mortal kombat 12 is Lori and peron That’s My character wishlist in The next Mortal kombat g
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!