Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Subject Marks In One D Array And Promotion

In this program Roll Number and marks on English, Mathematics, Physics, Chemistry of 'n' number of students are taken in separate 1 d arrays. Promotion is granted according to the following criterias:
The candidate must have passed in English and in at least any two subjects of Mathematics, Physics, Chemistry. Pass marks is 35.
 
import java.util.*;
class Promition
{
    Scanner sc=new Scanner(System.in);

    int n;
    int roll[];
    int eng[];
    int math[];
    int phy[];
    int chem[];
    int i,f;
    void take()
    {
System.out.print("\nHow many Students: ");
n=sc.nextInt();
roll=new int[n];
 eng=new int[n];
 math=new int[n];
 phy=new int[n];
chem=new int[n];
        for(i=0;i        {
            System.out.print("\nRoll Number of Student Number "+(i+1)+":");
            roll[i]=sc.nextInt();
            System.out.print("\nEnglish Marks:");
            eng[i]=sc.nextInt();
            System.out.print("\nMath Marks:");
            math[i]=sc.nextInt();
            System.out.print("\nPhysics Marks:");
            phy[i]=sc.nextInt();
            System.out.print("\nChemistry Marks:");
            chem[i]=sc.nextInt();
        }
        System.out.println("\nResult Sheet:");
         System.out.println("\nRoll  Eng  Math  Phy   Chem");
        for(i=0;i        {
            if(roll[i]            System.out.print("0"+roll[i]+"   ");
            else
            System.out.print(roll[i]+"   ");
            if(eng[i]            System.out.print("00"+eng[i]+"   ");
            else if (eng[i]            System.out.print("0"+eng[i]+"   ");
            else
            System.out.print(eng[i]+"   ");
            if(math[i]            System.out.print("00"+math[i]+"   ");
            else if (math[i]            System.out.print("0"+math[i]+"   ");
            else
            System.out.print(math[i]+"   ");
            if(phy[i]            System.out.print("00"+phy[i]+"   ");
            else if (phy[i]            System.out.print("0"+phy[i]+"   ");
            else
            System.out.print(phy[i]+"   ");
            if(chem[i]            System.out.print("00"+chem[i]+"   ");
            else if (chem[i]            System.out.print("0"+chem[i]+"   ");
            else
            System.out.print(chem[i]+"   ");            
            System.out.println();
           // System.out.print("\n"+roll[i]+" "+eng[i]+" "+math[i]+" "+phy[i]+" "+chem[i]);
        }
        for(i=0;i        {
            f=0;
            if(eng[i]>=35)
             {
                  if(math[i]>=35)
                 f++;
                 if(phy[i]>=35)
                 f++;
                 if(chem[i]>=35)
                 f++;
                }
                if(f>=2)
                System.out.println("\n "+roll[i]+": Promition is Granted...");
                else
                System.out.println("\n "+roll[i]+": Promition is not Granted...");
            }
        }
public static void main(String args[])
{
Promotion ob=new Promotion();
ob.take();
}
}    }


This post first appeared on Tutorial Site On Computer Programming Languages F, please read the originial post: here

Share the post

Subject Marks In One D Array And Promotion

×

Subscribe to Tutorial Site On Computer Programming Languages F

Get updates delivered right to your inbox!

Thank you for your subscription

×