Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a generic program to implement student information system. User could be shown follow Press 5 to quit 1 - To add a new student

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Write a generic program to implement student information system. User could be shown follow Press 5 to quit 1 - To add a new student 2 - Find a student by student Id 3 - Delete a student by student Id 4 - List all students On selecting 1, user should be asked for all the attribute values of the student On selecting 2, user should be asked for the student Id. Scarch should be performed accordingly. On selecting 3, user should be asked for the student ld. Delete should be performed accordingly. On selecting 4, user should be shown all the students with the details. Use the startup code to do the following 1. Convert the classes and methods to generic where it is necessary [04 2. Wirte the code for the class MyArrayImpl. [14 3. Write the code for the class STS [10 4. Write the code for Student class 102 5: Write the code for SISTest class [08 6. Output 102 Sample Output: Welcome to MySIS Press 1 to add a student Press 2 to find a student Press 3 to delete a student Press 4 to list a students Press 5 to exit Enter Option(1..5) > 1 Enter Student Information :: Id: 100 Name: mer GPA: 3.5 Done Welcome to MySIS Press 1 to add a student Press 2 to find a student Press 3 to delete a student Press 4 to list a students Press 5 to exit Enter Option(1.5) 1 Enter Student Information :: Id: 89 Name: uuu Balance: 2.0 Done Welcome to MySIS Press 1 to add a student Press 2 to find a student Press 3 to delete a student Press 4 to list a students Press 5 to exit Enter Option(1..5) > 1 Enter Student Information :: Id: 150 Name: ddd GPA: 3.1 Done Welcome to MySIS Press 1 to add a student Press 2 to find a student Press 3 to delete a student Press 4 to list a students Press 5 to exit Enter Option(1..5) > 1 Enter Student Information :: Id: 95 Name: GPA: 1.5 Donc Welcome to MySIS Press 1 to add a student Press 2 to find a student Press 3 to delete a student Press 4 to list a students Press 5 to exit Enter Option(1..5) > 4 Student lid=89, name*uuu, GPA =2.01 Student fid=95, name, GPA =1.5 Student fid=100, name=rrr, GPA 3.51 Student id=150, named GPA = 3:11 Welcome to MySIS Press to add student Press 2 to find a student Presto delete student Press this student Press Steenit Enter Option(..5) Eitor id tareh Student RGPA-151 Welcome to MySIS Press 1 to add a student Press 2 to find a student Press 3 to delete a student Press 4 to list a students Press 5 to exit Enter Option(1..5) > 2 Enter id to search = 900 Invalid Student ID Welcome to MySIS Press 1 to add a student Press 2 to find a student Press 3 to delete a student Press 4 to list a students Press 5 to exit Enter Option(1..5) > 3 Enter id to search = 100 Student is deleted Welcome to MySIS Press 1 to add a student Press 2 to find a student Press 3 to delete a student Press 4 to list a students Press 5 to exit Enter Option(1..5) > 4 Student lid=89, name=uuu, GPA =2.01 Student lid=95, name agg, GPA = 1.51 Student id=150, nameddd, GPA =3.1) Welcome to MySIS Press I to add a student Press 2 to find a student Press 3 to delete a student Press to list students Press to exit Enter Option(1..5) 5 Thank you for using SIS application !!! ArrayEmptyException.java X ArrayFullException.java DuplicateException.java 1 package sa.edu.yuc; 2 public class ArrayEmptyException extends Exception { 3e public ArrayEmptyException(String message) { 4 super(message); 5 } 6} ArrayEmptyException.java ArrayFullException.java X DuplicateException.java 1 backage sa.edu.yuc; 2 2 public class ArrayFullException extends Exception{ public ArrayFullException(String message) { 4 super(message); 5 } 6} 7 I ArrayEmptyException.java ArrayFullException.java D DuplicateException 1 package sa.edu.yuc; 120 2 public class DuplicateException extends Exception { 3e public DuplicateException(String message) { 4 super(message); 5 ArrayEmptyException.java ArrayFullException.java DuplicateExceptionjava MyArray.java X 1 package sa.edu.yuc; 2 public interface MyArray { 3 public boolean isEmpty(); 4 public boolean is Full(); 5 public boolean add(int value) throws ArrayFullException, DuplicateException; public boolean delete(int value) throws ArrayEmptyException; 7 public int find(int value); public int get(int index); 9} OOOOY W 9 ArrayEmptyExceptionjava ArrayFullException.java DuplicateException.java MyArrayjava 1 package sa.edu.yuc; 2 3 public class MyArrayImpl implements MyArray { private int capacity; 25 private int[] arr; 06 private int size; 7e public MyArray Impl(int capacity) { E 8 // TODO Auto-generated constructor stub } 100 @Override 411 public boolean isEmpty() { 212 // TODO Auto-generated method stub 13 return false; 14 15 @Override - 16 public boolean isFull() 217 // TODO Auto-generated method stub return false; 19 31 20- @Override -21 public boolean add(int value) throws ArrayFullException, DuplicateException { 222 W TODO Auto-generated method stub 23 return false; 3 25 26 @Override public boolean delete(int value) throws ArrayEmptyException TODO Auto generated method stub return false; 13 24 29 26 -27 328 29 30 31- 432 @Override public boolean delete(int value) throws ArrayEmpty Exception { // TODO Auto-generated method stub return false; } @Override public int find(int value) { // TODO Auto-generated method stub return ; 3 E33 34 35 36 37 438 239 40 I @Override public int get(int index) { // TODO Auto-generated method stub return ; } @Override public String toString() { TODO Auto-generated method stub return null; 3 12 13 16 47 8 ArrayEmptyExceptionjava DArrayFullException.java DuplicateExceptionjava MyArray.java MyArrayImpl.ja 1 backage sa.edu.yuc; 2 3 public class SIS { 4e public boolean addStudent (Student st) throws ArrayFullException, DuplicateException { 25 // TODO Auto-generated method stub 6 return false; 7 } public Student findStudent(int id) { 29 // TODO Auto-generated method stub 10 return null; 11 3 12 public boolean deleteStudent(int id) throws ArrayEmptyException { 213 H/ TODO Auto-generated method stub 14 return false; 15 16 public void showAll() { 212 11. TODO Auto-generated method stub 18 19 3 20) 21 ArrayEmptyExceptionjava ArrayFullExceptionjava DuplicateException.java MyArray.java MyArrayim 1 package sa.edu.yuc; 2 import java.util.Scanner; 3 public class SisTest { 4e public static void main(String[] args) { 5 SIS S = new SIS(); 6 Scanner input = new Scanner(System.in); 7 int option; 8 do { 9 menu(); 10 System.out.print("Enter Option (1..5) > "); 11 option = input.nextInt(); 12 switch (option) { 13 case 1: 214 // TODO Auto-generated method stub 15 break; 16 case 2: 27 // TODO Auto-generated method stub 18 break; 19 28 case 3: 21 // TODO Auto-generated method stub 22 break; 2 24 case 4: I TODO Auto-generated method Stub break; 22 case 5: System.out.println("Thank you for using SIS application !!"); 90 break; default: System.out.println("Invalid option plz enter(1..5371"): 32 33 default: System.out.println("Invalid option Plz enter(1..5111"); } }while(option 1 = 5); 35 36 38 39 private static void menu() { System.out.println("Welcome to MySTS"); System.out.println("Press 1 to add a student"); System.out.println("Press 2 to find a student"); System.out.println("Press 3 to delete a student"); System.out.println("Press 4 to list all students"); System.out.println("Press 5 to exit"); 43 MyArray.java ArrayEmptyException.java ArrayFullExceptionjava DuplicateException.java 1 package sa.edu.yuc; 2 3 import java.util.Scanner; 4 public class Student implements Comparable{ 5 private int id; 6 private String name; 7 private double gpa; se public Student(int id, String name, double gpa) { this.id = id; 10 this.name = name; 11 this.gpa = epa; 12 } 13 public int getId() { 14 return id; 15 } 16 public void setId(int id) { 17 this.id = id; } 19 public String getName() { 20 return name; 21 } 22 public void setName(String name) { this.name is name; 24 3 25 public double getopa) { 26 return apa; 3 25 public void setBalance (double spa) { this.gpa = spa; 38 2 override public String toString() 18 4 2 2 4 30 310 32 33 34 35 36 37 38 @Override public String toString() { return "Student (id=" + id + ", name=' + name + ", GPA-" + gpa + "1"; } public boolean equals(object other) { return this.id = ((Student)other).getId(); } @Override public int compareTo(Student s) { // TODO Auto-generated method stub return; 39 240 41 42 45 48 49 50 public static Student getStudent() { Scanner input = new Scanner(System.in); System.out.println(); System.out.println("Enter Student Information : "); System.out.print("Id: "); int id = input.nextInt(); input.nextLine(); System.out.print("Name: "); String name = input.nextLine(); System.out.print("GPA: "); double gpa - input.nextDouble(); System.out.println(); return new Student(id, name, spa); 52 53 55 $7)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

1. Define the nature of interviews

Answered: 1 week ago

Question

2. Outline the different types of interviews

Answered: 1 week ago