Subject: “ Web Application Development “
Name :
Reg#:
Section :
Submitted to: PROF.Shoaib Farooq
import java.util.*; class Student1 {
String name;
Student1 () {name=null; }
Student1 (String n) {name=n; } void setName(String n) {name=n;}
String getName() { return name;}
}
class Course {
String title;
Course () {title=null; }
Course (String n) {title=n; } void setTitle(String n) {title=n;}
String getTitle() { return title;} void dropCourse(){this.title=null;}
}
class Registration{
Student1 s;
Course c;
String reg; void setRegName(String n) {s.setName(n);}
String getRegName() { return s.getName();}
void setRegTitle(String n) {c.setTitle(n);}
String getRegTitle() { return c.getTitle();}
void register(String s,String c ) { this.setRegName(s); this.setRegTitle(c);
}
void regNumber(int s){ reg=reg+s;}
void dropCourse(){ c.dropCourse();} void print(){
System.out.print(s.getName() + " Register ");
System.out.println(c.getTitle());
}
public void mainMenu() { int opt; c=new Course(); s=new Student1();
}
}
class MainMenu {
Registration objr[]=new Registration[30];
Scanner scan=new Scanner(System.in);
int count=0; public void mainMenu() { int opt;
do{
System.out.print("Press 1 to Add Student\nPress 2 to Enter Course\nPress 3 to Registration\nPress 4 to Show Current Student Press\nPress 5 to Drop Student\nPress 6 to EXit "); opt=scan.nextInt(); objr[count]=new Registration(); if(opt==1){ System.out.println("Enter Student Name"); objr[count].setRegName(scan.next()); } else if(opt==2){
System.out.println("Enter Course Name"); objr[count].setRegTitle(scan.next()); } else if(opt==3){
objr[count].register(objr[count].getRegName(),objr[count].getRegTitle()); count++; } else if(opt==4){ objr[count].print(); } else if(opt==5){