Can someone give me a simple coding/alternatives than the one I use because I think mine is just too long..

import java.io.*;

public class MidtermGrade

{	public static void main(String arg[]) throws IOException
{	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

int qz1,qz2,qz3,as1,as2,wexm,hoexm;

double aveqz=0,aveas=0,aveexm=0,clstnd=0,mdtrm=0;
System.out.print("******************************\n");
System.out.print("Enter Quiz1: ");	qz1=Integer.parseInt(br.readLine());
System.out.print("Enter Quiz2: ");	qz2=Integer.parseInt(br.readLine());
System.out.print("Enter Quiz3: ");	qz3=Integer.parseInt(br.readLine());
aveqz=getAverageQuiz(aveqz,qz1,qz2,qz3);
System.out.print("******************************\n");
System.out.print("Enter Assignment1: ");	as1=Integer.parseInt(br.readLine());
System.out.print("Enter Assignment2: ");	as2=Integer.parseInt(br.readLine());
aveas=getAverageAssignment(aveas,as1,as2);
System.out.print("******************************\n");
System.out.print("Enter Written Exam:  "); wexm=Integer.parseInt(br.readLine());
System.out.print("Enter Hands On Exam: "); hoexm=Integer.parseInt(br.readLine());
aveexm=getAverageExam(aveexm,wexm,hoexm);
System.out.print("******************************\n");
clstnd=getClassstanding(clstnd,aveqz,aveas);
System.out.print("******************************\n");
mdtrm=getMidtermGrade(mdtrm,clstnd,aveexm);
System.out.print("******************************\n");	
}

public static double getAverageQuiz(double aveqz,int qz1,int qz2,int qz3)
{ aveqz=(qz1+qz2+qz3)/3;
  System.out.println("Computed Average: "+aveqz);
  return aveqz;
}

public static double getAverageAssignment(double aveas,int as1,int as2)
{ aveas=(as1+as2)/2;
  System.out.println("Computed Average: "+aveas);
  return aveas;
}

public static double getAverageExam(double aveexm,int wexm,int hoexm)
{ aveexm=(wexm+hoexm)/2;
  System.out.println("Computed Average: "+aveexm);
  return aveexm;
}

public static double getClassstanding(double clstnd,double aveqz,double aveas)
{ clstnd=(aveqz*0.6)+(aveas*0.4);
  System.out.println("Class Standing:   "+clstnd);
  return clstnd;
}

public static double getMidtermGrade(double mdtrm,double clstnd,double aveexm)
{ mdtrm=(clstnd*0.5)+(aveexm*0.5);
  System.out.println("Midterm Grade:    "+mdtrm);
  return mdtrm;
} }
This article has been dead for over six months. Start a new discussion instead.