Question

In: Computer Science

Write a program in which a ‘Student’ entity is map(structure) having the following attributes: Name EnrollmentNumber...

  1. Write a program in which a ‘Student’ entity is map(structure) having the following attributes:
  • Name
  • EnrollmentNumber
  • CGPA
  • DegreeProgram

Reserve the memory for 2 students at compile time and make a menu which should allow user to add the student data one by one.

use c++ .

Solutions

Expert Solution

Dear Student,

below i have written the complete C++ program as per the requirement.

==============================================================

Program:

==============================================================

#include<iostream>

using namespace std;

//Student structure Declaration
struct Student
{
string name;
int EnrNum;
double CGPA;
string DegreeProg;
};

//start of the main function

int main()
{

Student s[2];

for(int i = 0; i<2; i++)
{
cout<<"\nEnter student "<<(i+1)<<" Name: ";
cin.ignore();
getline(cin, s[i].name);
cout<<"Enter student "<<(i+1)<<" Enrollment Number: ";
cin>>s[i].EnrNum;
cout<<"Enter student "<<(i+1)<<" CGPA: ";
cin>>s[i].CGPA;
cout<<"Enter student "<<(i+1)<<" Degree Program: ";
cin.ignore();
getline(cin,s[i].DegreeProg);
cin.clear();
}


//Print the student information
for(int i = 0; i<2; i++)
{
cout<<"Student "<<(i+1)<<" Name is: "<<s[i].name<<endl;
cout<<"Student "<<(i+1)<<" Enrollment Number is: "<<s[i].EnrNum<<endl;
cout<<"Student "<<(i+1)<<" CGPA is : "<<s[i].CGPA<<endl;
cout<<"Student "<<(i+1)<<" Degree Program is: "<<s[i].DegreeProg<<endl;
cout<<endl;
}

return 0;
}

=============================================================

Sample Output:

=============================================================

Kindly Check and Verify Thanks..!!!


Related Solutions

Implement a class Student, including the following attributes and methods: Two public attributes name(String) and score...
Implement a class Student, including the following attributes and methods: Two public attributes name(String) and score (int). A constructor expects a name as a parameter. A method getLevel to get the level(char) of the student. score level table: A: score >= 90 B: score >= 80 and < 90 C: score >= 60 and < 80 D: score < 60 Example:          Student student = new Student("Zack"); student.score = 10; student.getLevel(); // should be 'D'. student.score = 60; student.getLevel(); //...
Write a class encapsulating the concept of a student, assuming a student has the following attributes:...
Write a class encapsulating the concept of a student, assuming a student has the following attributes: a name, a Social Security number, and a GPA (for instance, 3.5). Include a constructor, the accessors and mutators, and methods toString and equals. Write a client class (test driver with main method) to test all the methods in your class (create 2 student objects, print the name, social security number and GPA of the 2 students, check if the two student’s GPA is...
In C#, declare structure named Person. The structure should have the following attributes of first name,...
In C#, declare structure named Person. The structure should have the following attributes of first name, last name, zip code, and phone number.
Write a class Car that contains the following attributes: The name of car The direction of...
Write a class Car that contains the following attributes: The name of car The direction of car (E, W, N, S) The position of car (from imaginary zero point) The class has the following member functions: A constructor to initialize the attributes. Turn function to change the direction of car to one step right side (e.g. if the direction is to E,it should be changed to S and so on.) Overload the Turn function to change the direction to any...
Student Structure Assignment Create a Student Structure globally consisting of student ID, name, completed credits, and...
Student Structure Assignment Create a Student Structure globally consisting of student ID, name, completed credits, and GPA. Define one student in main() and initialize the student with data. Display all of the student’s data on one line separated by tabs. Create another student in main(). Assign values to your second student (do not get input from the user). Display the second student’s data on one line separated by tabs. Create a third student in main(). Use a series of prompts...
Write a class Store which includes the attributes: store name and sales tax rate. Write another...
Write a class Store which includes the attributes: store name and sales tax rate. Write another class encapsulating a Book Store, which inherits from Store. A Book Store has the following additional attributes: how many books are sold every year and the average price per book. Code the constructor, accessors, mutators, toString and equals method of the super class Store and the subclass Book Store; In the Book Store class, also code a method returning the average taxes per year....
IN JAVA!   Write a class Store which includes the attributes: store name, city. Write another class...
IN JAVA!   Write a class Store which includes the attributes: store name, city. Write another class encapsulating an Art Gallery, which inherits from Store. An Art Gallery has the following additional attributes: how many paintings are sold every year and the number of artists submitting artwork. Code the constructor, accessors, mutators, toString and equals method of the super class Store. Code the constructor, accessors and mutators for the subclass Art Gallery. In the Art Gallery class, also code a method...
Write a  program in c++ using a map to create the following output. Here is the list...
Write a  program in c++ using a map to create the following output. Here is the list of students: 100: Tom Lee 101: Joe Jones 102: Kim Adams 103: Bob Thomas 104: Linda Lee Enter a student an ID to get a student's name: ID:  103 students[103] - Bob Thomas # of students: 5 Delete a student (Y or N)?  Y Enter ID of student to be deleted:  103 Here is the list of students after the delete: 100: Tom Lee 101: Joe Jones...
Write a class named Person with data attributes for a person’s first name, last name, and...
Write a class named Person with data attributes for a person’s first name, last name, and telephone number. Next, write a class named Customer that is a subclass of the Person class. The Customer class should have a data attribute for a customer number and a Boolean data attribute indicating whether the customer wishes to be on a calling list. Demonstrate an instance of the Customer class in a simple program. Using python
JAVA PROGRAMMING Part 1 Create a class Student, with attributes id, first name, last name. (All...
JAVA PROGRAMMING Part 1 Create a class Student, with attributes id, first name, last name. (All the attributes must be String) Create a constructor that accepts first name and last name to create a student object. Create appropriate getters and setters Create another class StudentOperationClient, that contains a main program. This is the place where the student objects are created and other activities are performed. In the main program, create student objects, with the following first and last names. Chris...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT