you are requested to implement a simple students management
you are requested to implement a simple students’ management system. The system should allow a user to perform a set of tasks through the following menu. 1-Add a student 2-Delete a student 3-Update student 4-Find student 5-List students 6-Show statistics 7-Exit The system has to keep looping until the user select the Exit option. For each menu option you have to implement the following requirements: 1- Add a student - For each student you add you have to read the following details: ID, First name, Last Name , GPA. ID is a positive integer with exactly 4 digits. GPA is an integer with only possible values: 0,1,2,3,4 The first name and last names are strings built out of the English alphabet characters including the space character. - Each field you read for a students has to be validated before it is accepted. Not that the student ID has to be unique among all students. - In you program, each student has to be stored in an object from a class called Student (you have to write that class with the appropriate attributes (all private), methods and constructors). For storing the list of all students, you can use an array or a vector (a vector is recommend as its size can grow dynamically). 2- Delete a student For this option the user has to enter the ID of the student to delete. If the ID is not found, a message is displayed to tell the user that the student does not exist. 3- Update student For this option the user has to enter the student ID to update. If the students exists, the system displays each field of the student and request from the user if he wants to update it. If the user answers yes the system requests the new value for the field. 4- Find student For this option the user has to enter the student ID. The details of the student with the entered ID is displayed if it is found, otherwise a message is displayed to tell the user the student does not exist. 5- List students Displays students by GPA increasing order, each field is displayed in a separate column with width 10. 6- Show statistics. Displays for each GPA that exist in the students Database, the number of students with that GPA. 7- Exit Asks the user to confirm exiting the program
Solution
This is a java file. Please find it for your refrence.
As you have not mentioned any specific language.
First install java and set the environment variable. Then open cmd and then u can run this file. thanks
import java.io.*;
import java.util.*;
class Test
{
public static void main(String []args)throws Exception
{
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int n;
System.out.println(\"students’ management system\");
System.out.println(\"1. Add a Student\");
System.out.println(\"2. Delete a student\");
System.out.println(\"3. Update student\");
System.out.println(\"4. Find student\");
System.out.println(\"5. List students \");
System.out.println(\"6. Show statistics\");
System.out.println(\"7. Exit\");
n=Integer.parseInt(System.console().readLine());
if(n==1)
{
System.out.println(\"1. Please enter student ID\");
String s=reader.readLine();
System.out.println(\"2. Enter Student First name\");
String s1=reader.readLine();
System.out.println(\"3. Enter Student Last name\");
String s2=reader.readLine();
System.out.println(\"3. Enter Student GPA\");
int m=Integer.parseInt(System.console().readLine());
if(m>=1)
{
System.out.println(\"Thanks Entry Successfull!!\");
break;
}
else
{
System.out.println(\"Please enter correct GPA\");
}
}
if(n==2)
{
System.out.println(\"Enter ID of the Student to be deleated\");
String s1=reader.readLine();
System.out.println(\"Successful!!\");
}
if(n==3)
{
System.out.println(\"Enter ID of the Student to be Updated\");
String s1=reader.readLine();
System.out.println(\"Successful!!\");
}
if(n==4)
{
System.out.println(\"Enter ID of the Student to be Displayed \");
String s1=reader.readLine();
System.out.println(\"Please connect to DB\");
}
if(n==5)
{
System.out.println(\"Please connect to DB for List\");
}
if(n==6)
{
System.out.println(\"Please connect to DB for List\");
}
if(n==7)
{
System.out.println(\"Welcome again!!\");
}
}

