Marklist in java program.
import java.util.Scanner;
public class MarkList
{
public void mList(int english,int hindi,int maths,int science,int history,int malayalam)
{
System.out.println("English :"+english + "Hindi : "+hindi + "Maths : "+maths + "Science : "+science + "History : "+history + "Malayalam : "+malayalam);
float sum;
sum= english+ hindi+ maths+ science+ history+ malayalam;
double percentage=sum/6;
System.out.println("percentage :="+percentage+"%");
}
public static void main(String[] args)
{
MarkList ml=new MarkList();
Scanner sc=new Scanner(System.in);
System.out.println("English:");
int english=sc.nextInt();
System.out.println("Hindi:");
int hindi=sc.nextInt();
System.out.println("Maths:");
int maths=sc.nextInt();
System.out.println("Science:");
int science=sc.nextInt();
System.out.println("History:");
int history=sc.nextInt();
System.out.println("Malayalam:");
int malayalam=sc.nextInt();
sc.close();
ml.mList(english, hindi , maths , science , history ,malayalam);
}
}
public class MarkList
{
public void mList(int english,int hindi,int maths,int science,int history,int malayalam)
{
System.out.println("English :"+english + "Hindi : "+hindi + "Maths : "+maths + "Science : "+science + "History : "+history + "Malayalam : "+malayalam);
float sum;
sum= english+ hindi+ maths+ science+ history+ malayalam;
double percentage=sum/6;
System.out.println("percentage :="+percentage+"%");
}
public static void main(String[] args)
{
MarkList ml=new MarkList();
Scanner sc=new Scanner(System.in);
System.out.println("English:");
int english=sc.nextInt();
System.out.println("Hindi:");
int hindi=sc.nextInt();
System.out.println("Maths:");
int maths=sc.nextInt();
System.out.println("Science:");
int science=sc.nextInt();
System.out.println("History:");
int history=sc.nextInt();
System.out.println("Malayalam:");
int malayalam=sc.nextInt();
sc.close();
ml.mList(english, hindi , maths , science , history ,malayalam);
}
}
No comments:
Post a Comment