Home / testclass
Page options

testclass


 import java.util.*;


    class student{
     int id;
     String name;
     String surName;
     public void setName(String n){
      name = n;
     }
       public String getName(){
       return name;
     }
      public void setSurName(String a){
      surName = a;
     }
      public String getSurName(){
      return surName;
     }
    
      public void setId(Integer b){
      id = b;
      } 
       public Integer getId(){
       return id;
       }
     }
   
     class teacher{
  
      String namet;
      String surNamet;
      public void setNamet(String c){
      namet = c;
     }
     public String getNamet(){
     return namet;
    }
    public void setSurNamet(String d){
    surNamet = d;
     }
     public String getSurNamet(){
     return surNamet;
     }
     
    }
   
     class subject{
      String subjName;
       int subjNo;
     
     public void setSubjName(String e){
      subjName = e;
     }
     public String getSubjName(){
     return subjName;
     }
     public void setSubjNo(Integer f){
      subjNo = f;
     }
     public Integer getSubjNo(){
     return subjNo;
     }
    }
   public class ongorn {
 
   public static void main(String args[]){
     System.out.println();
     System.out.println(" +++++++++++++++ main menu +++++++++++++++");
     System.out.println("1. class student");
     System.out.println("2. class teacher ");
     System.out.println("3. class subject");
     System.out.println("4. exit");
     System.out.println("++++++++++++++++++++++++++++++++++++++++++");
     System.out.println();
    
     int menu=0,x=1,y=0,i=0,j=0,p=0,k=0;
    
     while(true){
        System.out.print("choose menu  :");
        menu=new Scanner(System.in).nextInt();
      switch(menu){
        case 1 : {
           System.out.print("  input number of student:");
           x=new Scanner(System.in).nextInt();
           for(y=0;y<=(x-1);y++){
      student obj1;
      obj1 =new student();
      System.out.print("Input Name :");
      String n =new Scanner(System.in).nextLine();
      obj1.setName(n);
    
      System.out.print("Input SurName :");
      String a =new Scanner(System.in).nextLine();
      obj1.setSurName(a);
     
     
       System.out.print("Input ID :");
       int b =new Scanner(System.in).nextInt();
     obj1.setId(b);
     System.out.println(obj1.getName());
        System.out.println(obj1.getSurName());
     System.out.println(obj1.getId());
     
           }
           break;

        }
        case 2 :{
         System.out.print("intput number of teacher :");
         i=new Scanner(System.in).nextInt();
         for(j=0;j<=(i-1);j++){
     teacher obj2;
     obj2 = new teacher();
     System.out.print("Input Teacher's name :");
     String c =new Scanner(System.in).nextLine();
     obj2.setNamet(c);
     
     System.out.print("Input Teacher's surname :");
     String d=new Scanner(System.in).nextLine();
     obj2.setSurNamet(d);
     
     System.out.println(obj2.getNamet());
     System.out.println(obj2.getSurNamet());
            }
            break;
       }
      
       case 3 :{
        System.out.print("input number of subjects :");
        k = new Scanner(System.in).nextInt();
        for(p=0;p<=(k-1);p++){
         subject obj3;
         obj3 = new subject();
             System.out.print("Input Subject's Name :");
          String e=new Scanner(System.in).nextLine();
          obj3.setSubjName(e);
          System.out.print("Input Subject Id :");
          int f =new Scanner(System.in).nextInt();
          obj3.setSubjNo(f);
                System.out.println(obj3.getSubjName());
                System.out.println(obj3.getSubjNo());
        }
        break;
       }
      
       case 4 :  {
           System.out.println("exit");
           System.out.println("+++++++++++++++++++++++");
           System.exit(0);
             break;
          }

    
     }
    }
    }
    }   


    Post a comment

    Your Name or E-mail ID (mandatory)

     

    Note: Your comment will be published after approval of the owner.

    No Attachments Found. Click here to upload new file.




     RSS of this page

    Author: boombalaka   Version: 1.0   Last Edited By: boombalaka   Modified: 04 Oct 2008