
Concept explainers
Answer this in C++ Programming Language:
Define a structure called Class with name (string), units (int) and grade (char) as its member data.
Define a structure called Student with ID (int), name (string), num (int), gpa (double) and an array of maximum of 20 Class structures called classes, where ID is a 5 digit number, name is the student's full name, num is the number of classes taken so far and gpa is the current grade point average and classes is all the classes taken so far.
Write a function called get_info which takes an array of Student structures called students and array size, reads all the information for as many students as the user wants to enter except for the gpa which is later calculated, storing them in students array. It then returns the number of students entered by the user before quitting. The user indicates the end of data entry by entering -99 for the ID of a student. The user must enter as many classes for each student as indicated by num - number of classes.
Write a function called display which takes an array of Student structures called students and array size and displays the information for all the students of the array.
Write a function called get_gpa that takes the array of Class structures belonging to a single student and the size of the array of classes and returns the GPA for those classes. GPA is calculated by multiplying the number of units for each class by the number of points earned for the class, adding up all these units*points products and dividing the resulting sum by the total number of units of all classes. The points earned is given by the letter grade earned for each class. A is worth 4 points, B 3 points, C 2 points, D 1 point and F 0 points. For example, if a student has taken 3 classes with units of 3, 5 and 4 and grades of A, C and B, respectively, the GPA is given by: (3 x 4 + 5 x 2 + 4 x 3) / (3 + 5 + 4) which is 2.8.
Write a sort_id function that takes an array of Student structures and array size and sorts the array in ascending order based on the student id. Write a sort_name function that takes an array of Student structures and array size and sorts the array in ascending order based on the student name. Write a sort_gpa function that takes an array of Student structures and array size and sorts the array in ascending order based on gpa.
Write a search_id function that takes students sorted on id, its size and an id and performs a binary search on the students to find the specified id. The function must return the index of the student if found or -1 if not found.
Write a search_name function that takes students sorted on name, its size and a name and performs a binary search on the students to find the specified name. The function must return the index of the student if found or -1 if not found.
In main, declare an array of maximum of 100 Student structures. Pass the array and its maximum size to get_info to read as many students as the user wants storing the information entered in the array passed as parameter. The function must set gpa to 0.0.
Then, pass the array of Class structures (classes) of each student to get_gpa function and store the returned gpa in gpa field of the student overwriting the 0.0. For example, if students[0] has taken 3 classes with units of 3, 5 and 4 and grades of A, C and B, respectively, get_gpa should return a gpa of 2.8 which main must store in the gpa field of the student in question.
Then, pass the array of students and the size returned by get_info to display to print all students entered.
Pass the array of Student structures and the actual size returned by get_info to sort_id function to sort the array based on id Then, print the sorted students using the display function.
Ask the user to enter an id and pass it along with students array and array size to the search_id function. Print the information of the student found or print "Student not found" in main.
Pass the array of Student structures and the actual size returned by get_info to sort_name function to sort the array based on name. Again, display the sorted list of students using display.
Ask the user to enter a name and pass it along with students array and array size to the search_name function. Print the information of the student found or print "Student not found" in main.
Finally, pass the array of Student structures and the actual size returned by get_info to sort_gpa function to sort the array based on gpa. Then, print the sorted list of students using the display function.
Upload and submit only the cpp file. Submitting only the exe file will not earn you any points. If you cannot build due to errors, submit only the cpp file.

Trending nowThis is a popular solution!
Step by stepSolved in 3 steps with 3 images

- Calculator Assignment Modify a calculator program that currently displays the Abstract Syntax Tree (AST) structure after parsing an input expression. Instead of printing the AST, enhance the program to evaluate the expression and display the result. Add support for the binary "%" remainder (modulo) operator and introduce variables with the assignment operator "=". Key steps to implement the assignment operator and variables: Introduce a new static attribute in the AstNode class to represent variables: Add a method isIdentifier() to the TokenStream class to detect variables: Modify the primaryRule() in AstNode to handle variables and variable assignment: Handle new node types in the AstNode evaluate() method for variables and assignment: These changes allow the calculator to evaluate expressions, support variables, and handle variable assignments. Users can create and use variables in subsequent expressions.EmployeeJava Type: package week3;import static week3.MainApp.*; public enum…arrow_forwardUSE C++ PLEASE Q#1 Using the concept of classes, constructors and data structure (arrays or any under data structure) implement a detailed University and student enrollment system. Each department of university has a separate class and perform every functionality with in a class. Create a main class where methods of other classes will be called.arrow_forwardJavascript Question: Part 1 Design a Pet object. A Pet is created with a language argument string and a stomach represented by an array. The Pet should support functions: eat() and speak(). Use the prototype property to define your object's interface. eat(food) will store the passed argument into its stomach and return what it has eaten thus far. speak(sentence) will simply return the passed in phrase. function Pet(language) {// create stomach// set language}// takes a food_item STRING and returns everything eaten so far ARRAYPet.prototype.eat = function(food_item) {// ... complete }// takes in a sentence STRING and returns the passed in sentence STRING with no changePet.prototype.speak = function(sentence) {// ... complete} You may also use the newer class notation. Part 2 Create an object, Dog, that implements the Pet interface and takes the same argument language. Dogs eat the same way all pets do. Dogs speak differently. Dogs replace each word in a sentence with its only known…arrow_forward
- Write UML Class Diagram that illustrates the following program: 1) Person class The person class should include the following data fields; • Name • ID number • birth date • home address • phone number Be sure to include get and set methods for each data field. 2) Course class The course class should contain the following fields: • ID Number • Name College (Business, Engineering, Nursing, etc) • An Array of person objects . 3) University class The University class should contain the data fields for the university, such as: • University name • Federal ID number • Address • Array / ArrayList of course class objects • Array / ArrayList of person class objects Extended Classes: 4 & 5) Extend the Person class into Student class and Employee class 6) Extend the Employee class into Instructor class and Staff class 7 & 8) Extend the Student class into graduate Student and undergrad Student class 9) Registration Class ---> The Registration class creates transactions to link each student with…arrow_forwardPlease answer in Programming C++ Define a structure called Class with name (string), units (int) and grade (char) as its member data. Define a structure called Student with ID (int), name (string), num (int), gpa (double) and an array of maximum of 20 Class structures called classes, where ID is a 5 digit number, name is the student's full name, num is the number of classes taken so far and gpa is the current grade point average and classes is all the classes taken so far. Write a function called get_info which takes an array of Student structures called students and array size, reads all the information for as many students as the user wants to enter except for the gpa which is later calculated, storing them in students array. It then returns the number of students entered by the user before quitting. The user indicates the end of data entry by entering -99 for the ID of a student. The user must enter as many classes for each student as indicated by num - number of classes. Write a…arrow_forwardUsing C# language: Programming PLO-2 Measured: Design, implement, and evaluate computer solutions utilizing structured and object-oriented programming methodologies. Design a class named Contractor. The class should keep the following information: Contractor name Contractor number Contractor start date Write one or more constructors and the appropriate accessor and mutator functions for the class.arrow_forward
- Design a struct with following members: p_num_lots, int* type pa_lots, int [] type (dynamically allocated) Implement following methods: parameterized constructor which takes an int for num of lots copy constructor copy assignment operator destructorarrow_forwardc++ programmingarrow_forwardWhat do you specifically mean when you refer to something as an abstract data type?arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





