import java.io.*; import java.text.*; public class test { static final double WEIGHT_T1=0.45; //weight of first test static final double WEIGHT_T2=0.55; //weight of second test public static void main(String args[]) throws IOException { String name; //Student's name double test1, test2; //Student's test scores BufferedReader in=new BufferedReader(new InputStreamReader(System.in)); //data entered from keyboard System.out.print("Please enter the student\'s name: "); // \' tells the computer to ignore ' and just print it name=in.readLine(); //read in name //read in test scores System.out.println("Please enter the two test scores: "); System.out.print(">"); //prompt test1=Double.valueOf(in.readLine().trim()).doubleValue(); System.out.print(">"); //prompt test2=Double.valueOf(in.readLine().trim()).doubleValue(); CalcPoints(name,test1,test2); //calculate grade } public static void CalcPoints(String name, double test1, double test2) { double total; total=test1*WEIGHT_T1+test2*WEIGHT_T2; System.out.println("Student: "+name+" earned "+ total+" points."); } }