Java program to find student total mark Average & Percentage of mark using Method

Java program to find student total mark Average  & Percentage of mark using Method


This Java program allows users to enter five different values for five subjects. And then, this Java program finds the Total, Average, and Percentage of those Five Subjects.

Using Method

import java.util.Scanner;
class Student
{
      int Total(int w,int x,int y,int z,int a){
      return w+x+y+z;
}
       double Avg(int a,int b,int c,int d,int e){
        return (a+b+c+d)/4.0;
}
       double per(int a1,int b1,int c1,int d1,int e1)
{
       return (a+b+c+d/4)*100
}

public static void main(String args[]){
Student e=new Student();
Scanner sc=new Scanner(System.in);

System.out.println("Enter the name with his four subject marks.");

String name=sc.nextLine();
int p=sc.nextInt();
int q=sc.nextInt();
int r=sc.nextInt();
int s=sc.nextInt();
int t=sc.nextInt();

System.out.println(name);
System.out.println("Total is "+e.Total(p,q,r,s,t));
System.out.println("Average is "+e.Avg(p,q,r,s,t));
System.out.println("Average is "+e.per(p,q,r,s,t));

}
}



Comments

Popular posts from this blog

Java Program for shop Bill to Calculate total amount of product with discount

RCM|Consequences of imbalanced Nutrition|WHO share daily need

Learn Data structures and algorithms concepts free online with certificate