
Suppose that you are required to store information about students for the module Data structures and Algorithms. The information for each student consists of the studentââ?¬â?¢s ID number, surname, other names and marks obtained in four modules. Implement a Student class and a StudentApplication class with a main method that keeps an array of student records, displays the following menu and allows a user to enter a value in the range 1 to 5: 1. Add a new student record 2. Delete a student record 3. Display a student record 4. Display all student records 5. Exit Please enter your choice (1 ââ?¬â?? 4): Choice of ââ?¬Ë?1ââ?¬â?¢ should allow the user to add a new student record. Choice of ââ?¬Ë?2ââ?¬â?¢ allows the user to delete a particular student record. Choice ââ?¬Ë?3ââ?¬â?¢ allows the user to enter a student ID, search for the studentââ?¬â?¢s record and display the studentââ?¬â?¢s details, together with the latterââ?¬â?¢s average mark, if found. Choice ââ?¬Ë?4ââ?¬â?¢ must display all existing student records. Choice ââ?¬Ë?5ââ?¬â?¢ must terminate the program.

import java.util.*;
public class StudentApplication {
Scanner input=new Scanner(System.in);
int index = 0;
public String[] id = new String[20];
public String[] name = new String[20];
public String[] marks = new String[20];
String Search = " ";
public static void main(String[]args){
StudentApplication app=new StudentApplication();
app.choices();
}
public void choices(){
System.out.println("1. Add Student record");
System.out.println("2. Delete Record");
System.out.println("3. Display Record");
System.out.println("4. Display All Records");
System.out.println("5. Exit");
try{
int choices;
System.out.print("Enter Your choice: ");
choices = input.nextInt();
if(choices == 1){
index = index + 1;
add();
choices();
}
else if(choices == 2){
delete();
choices();
}
else if(choices == 3){
System.out.print("Enter an INDEX: ");
index = input.nextInt();
System.out.println("****View Record****");
System.out.println("ID: " + id[index]);
System.out.println("Name: " + name[index]);
System.out.println("Marks:" + marks[index]);
choices();
}
else if(choices == 4){
System.out.println("****View All Records****");
for(int i=0;i<id.length;i++){
if(id[i]!=null){
System.out.println(id[i]+"\t"+name[i]+"\t"+marks[i]);
}
}
choices();
}
else if(choices == 5){
System.exit(0);
}
else{
System.out.println("Program will now exit");
System.exit(0);
}
}
catch (Exception e){
System.out.print(e);
}
}
public void add(){
try{
System.out.print("Enter ID: ");
id[index] = input.next();
System.out.print("Enter Name: ");
name[index] = input.next();
System.out.print("Enter marks: ");
marks[index] = input.next();
System.out.println("Data has been added!");
}
catch(Exception e){
System.out.print(e);
}
}
public void delete(){
try{
System.out.print("Enter index to delete data: ");
index = input.nextInt();
id[index] = null;
name[index] = null;
marks[index] = null;
index = 0;
System.out.println("Data has been deleted!");
choices();
}
catch(Exception e){
System.out.print(e);
}
}
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.