W.A.P. to print the marksheet of the student in the following manner Marksheet ------------------------------------ Name : Rahul Jain Roll No : 0205ca071101 College : IIIT Allahabad College ------------------------------------ Subject : Marks Sub1 : Sub2 : Sub3 : Sub4 : Sub5 : ------------------------------------- Total : Percent :

class Ms
 {
   int RollNo,Sub1,Sub2,Sub3,Sub4,Sub5,Total;
   String Name,College;
   double Percent;
   void markSheet()
    {
    Name=System.console().readLine("Enter the name of Student:");
    RollNo=Integer.parseInt(System.console().readLine("Enter the Rollno:"));
    College=System.console().readLine("Enter the name of Student's College:");
    Sub1=Integer.parseInt(System.console().readLine("Enter the no Sub1:"));
    Sub2=Integer.parseInt(System.console().readLine("Enter the no Sub2:"));
    Sub3=Integer.parseInt(System.console().readLine("Enter the no Sub3:"));
    Sub4=Integer.parseInt(System.console().readLine("Enter the no Sub4:"));
    Sub5=Integer.parseInt(System.console().readLine("Enter the no Sub5:"));
    }
   void printMarkSheet()
    {
    System.out.println("             Marksheet  ");
    System.out.println("-----------------------------------");
    System.out.println("Name    :"+Name);
    System.out.println("Roll No :"+RollNo);
    System.out.println("College :"+College);
    System.out.println("  ");
    System.out.println("  ");
    System.out.println("-----------------------------------");
    System.out.println("Sub1    :"+Sub1);
    System.out.println("Sub2    :"+Sub2);
    System.out.println("Sub3    :"+Sub3);
    System.out.println("Sub4    :"+Sub4);
    System.out.println("Sub5    :"+Sub5);
    System.out.println("-----------------------------------");
    Total=Sub1+Sub2+Sub3+Sub4+Sub5;
    System.out.println("Total   :"+Total);
    System.out.println("  ");
    System.out.println("  ");
    Percent=Total/5;
    System.out.println("Percent :"+Percent);
    }
  public static void main(String[] args)
    {
     Ms ab=new Ms();
     ab.markSheet();
     ab.printMarkSheet();
    }
}

3 comments: