the top n students Search for a student Exit the program. If the user chooses 1, the user will be prompted for the value of n, and the netID, major and GPA of the top n students will be listed, starting with the student with highest GPA and going down. If the user chooses 2, user will be
Max Function
Statistical function is of many categories. One of them is a MAX function. The MAX function returns the largest value from the list of arguments passed to it. MAX function always ignores the empty cells when performing the calculation.
Power Function
A power function is a type of single-term function. Its definition states that it is a variable containing a base value raised to a constant value acting as an exponent. This variable may also have a coefficient. For instance, the area of a circle can be given as:
Write code for this
Write a
- List the top n students
- Search for a student
- Exit the program.
If the user chooses 1, the user will be prompted for the value of n, and the netID, major and GPA of the top n students will be listed, starting with the student with highest GPA and going down.
If the user chooses 2, user will be prompted to enter the student’s netID. If the netID is found in the netID array, the array index, major and GPA of the student are displayed. If the student is not found, a “Student not found” message is displayed.
If the user chooses 3, the program prints “Exiting\n” and terminates.
Here are the expected screenshots when the program is executed on an external IDE ("interactive Console" on OnlineGDB) .
Enter file name: in0.txt Could not open file Exiting
Output-1
Enter file name: in1.txt Original arrays: ---------------- index netID major GPA index netID major GPA 0 1007 ME 3.80 1 1013 CS 3.20 2 1018 BME 3.75 3 1025 CS 3.30 4 1031 ME 2.90 5 1038 ME 3.00 6 1043 EE 3.10 7 1048 BME 3.70 8 1054 CS 3.95 9 1061 CS 3.50
Trending now
This is a popular solution!
Step by step
Solved in 3 steps