import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
StudentInfo s1 = new StudentInfo();
s1.display();
}
}
import java.util.InputMismatchException;
import java.util.Scanner;
public class MainOption extends StudentInfo {
public void main()
try {
Scanner s = new Scanner(System.in);
StudentInfo s1 = new StudentInfo();
System.out.println("====================================================================================================");
System.out.println("(1)Viewn (2)Updaten (3)Deleten(4)Addn");
System.out.println("Enter your choice: ");
option = s.nextInt();
do {
switch (option) {
case 1:
System.out.println("n");
System.out.println("====================================================================================================");
s1.StudInfo();
this.main();
System.out.println("====================================================================================================");
break;
case 2:
System.out.println("n");
System.out.println("====================================================================================================");
StudUpdate u1 = new StudUpdate();
s1.StudUpdate();
u1.StudentUpdate();
System.out.println("====================================================================================================");
this.main();
break;
case 3:
System.out.println("n");
System.out.println("====================================================================================================");
StudDelete d1 = new StudDelete();
d1.StudDelete();
s1.StudInfo();
System.out.println("====================================================================================================");
this.main();
break;
case 4:
System.out.println("n");
System.out.println("====================================================================================================");
StudAdd a1 = new StudAdd();
a1.StudAdd();
s1.StudInfo();
System.out.println("====================================================================================================");
this.main();
break;
case 5:
System.out.println("Invaild Input!!");
this.main();
System.out.println("Enter your choice: ");
System.out.println("====================================================================================================");
default;
{
}
while (option != 8);
}
catch (InputMismatchException err){
System.out.println("Invalid Input!!");
}
import java.util.InputMismatchException;
import java.util.Scanner;
public class StudAdd extends StudentInfo {
public void StudentUpdate() {
StudentInfo s1 = new StudentInfo();
Scanner s = new Scanner(System.in);
try {
System.out.println("nEnter the slot you want to update:");
edit = s.nextInt();
System.out.println("n");
lucban = 1;
adds = add - 1;
} catch (Exception error) {
System.out.println("Invalid Input!!");
StudentUpdate();
}
try {
if (Age[adds] != 0 && add > 0) {
}
}
do {
{
System.out.println("Enter First name: ");
slot5 = s.next();
System.out.println("Enter Last Name: ");
slot6 = s.next();
System.out.println("Enter Gender: ");
slot7 = s.next();
System.out.println("Enter Birthday: ");
slot8 = s.next();
System.out.println("Enter Hometown: ");
slot4 = s.next();
System.out.println("Enter Teacher: ");
slot3 = s.next();
System.out.println("Enter Section: ");
slot2 = s.next();
System.out.println("Enter Age: ");
slot1 = s.nextInt();
System.out.println("Enter Grade: ");
slot9 = s.next();
if (slot1 > 1) {
System.out.println("Invalid Input!!");
StudentUpdate();
}
}
if (slot1 > 0);
{
Name[adds] = slot5;
LN[adds] = slot6;
Gender[adds] = slot7;
Birthday[adds] = slot8;
Hometown[adds] = slot4;
Teacher[adds] = slot3;
Section[adds] = slot2;
Age[adds] = slot1;
Grade[adds] = slot9;
System.out.println("Student Information has been UpdatedSuccessfully!!");
lucban++;
}
} while (lucban < 2);
}
else{
System.out.println("Try Again!!");
}
catch (Exception oops){
MainOption m = new MainOption();
System.out.println("Invaild Input!!");
m.main();
}
}
im having trouble with this code do to some errors so im hopingi can have some help with it im using java 8 i couldnt copy thecode cuz it said question was too long so i had to do it likethis