Answer to Question #165294 in C++ for zain ul abdeen

Question #165294

If the user enters 'A', ask the user for the following information for a SINGLE student and then store it:

1) id (it is unique to each student and can be any integer between 0 and 99).

2) first initial (can be any character between A and Z). Example: In the case of Aadil Khan the first initial is A.

3) last initial (can be any character between A and Z). Example: In the case of Aadil Khan the last initial is K.

4) GPA (can be any floating-point value between 0.0 and 4.0)

5) course marks (can be any integer value between 0 and 100)

This information can be stored in multiple separate arrays, or in a single array of structures (also known as a struct). For this task, assume the user will only enter correct values and you do not have to check for wrong input. As soon as the user enters the value for one student, the menu will be displayed again.

 

 

If the user enters 'B', a loop will run and display all the values stored up till that point. If there is no information, tell the user “Empty Database”.

 

 

If the user enters 'C', the user would be asked to enter the id, and the program would display all the information stored for that id. If the id doesn't exist, the program would inform the user “ID Doesn’t Exist”.

 

 

If the user enters 'D', a loop will run and calculate the average of all the course marks stored up till that point. If there is no information, tell the user “Empty Database”.

 

 

If the user enters 'E', the user would be asked to enter the GPA. A loop will run and display the information of all the students who have a GPA greater or equal to that. If there is no information, tell the user “Not Found”.

 

 

If the user enters 'F', display “Have a nice day” and then exit the program.


1
Expert's answer
2021-02-21T19:51:06-0500
#include<iostream>
using namespace std;
void student_detail();

char user,name,last_name;
int id, marks;
float gpa;

int main(){

cout<<"Please enter the user name from A, B, C or D"<<endl;
cin>>user;
switch(user){

case 'A':
    cout<<"you have choosen user A"<<endl;
    student_detail();
    break;
case 'B':
    cout<<"You have choosen user B"<<endl;
    break;
case 'C':
    cout<<"You have choosen C"<<endl;
    break;
case 'D':
    cout<<"You have choosen D"<<endl;
    break;
case 'E':
    cout<<"You have choosen E"<<endl;
    break;
case 'F':
    cout<<"You have choosen F"<<endl;
    cout<<"Have a nice day"<<endl;
    break;
default:
    cout<<"Please enter the correct value"<<endl;


}
return 0;
}
void student_detail(){
    cout<<"Please enter the user id(integer value)"<<endl;
    cin>>id;
    cout<<"Please enter first initial character of first Name of user"<<endl;
    cin>>name;
    cout<<"Please enter the first initial character of Last name of user"<<endl;
    cin>>last_name;
    cout<<"Please enter the GPA of the user:"<<endl;
    cin>>gpa;
    cout<<"Please enter the course marks obtained by the user"<<endl;
    cin>>marks;
    cout<<"The complete details of the user is given below"<<endl;
    cout<<"\n user id:"<<id<<"\n user first letter of user's first name:"<<name<<"\n first letter of last name of the user:"<<last_name<<endl;
    cout<<"GPA score:"<<gpa<<endl;
    cout<<"Marks obtained by the user:"<<marks<<endl;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment