package test1spr16q4; import java.util.Scanner; /** * @author jcmtiernan */ public class Test1Spr16Q4 { public static void main(String[] args) { int judgeCount = 0; int projNumber = -1; int projAreaByCode = 0; double finalScore = 0.0; Scanner input = new Scanner(System.in); System.out.println("Please enter the following items of data as " + "positive integers:"); System.out.println("Project Number space Project Area space Number of " + "Judges for this project and presentation"); System.out.println("Ex: 1576 18 4 would mean project number 1576 in " + "project area 18 with 4 judges"); System.out.print("Your data is: "); projNumber = input.nextInt(); projAreaByCode = input.nextInt(); judgeCount = input.nextInt(); System.out.println("Project Number "+projNumber+" in Area "+ projAreaByCode+" has "+judgeCount+" judges."); System.out.println(); finalScore = scoring(judgeCount); System.out.printf("The final score for project %d is %6.2f\n", projNumber,finalScore); } public static double scoring(int judgeNum) { int projScore = 0; int presScore = 0; int judgeCount = judgeNum; Scanner input = new Scanner(System.in); System.out.println("For each judge, enter the requested information"); while (judgeNum > 0) { if ((judgeCount - judgeNum +1) == 1) { System.out.println("Enter your data as Project Score space " + "Presentation Score where each score is on a 100 " + "point scale"); } System.out.print("Please enter the project score and presentation" + " score from judge "+(judgeCount - judgeNum +1)+": "); projScore += input.nextInt(); presScore += input.nextInt(); judgeNum--; } return ((projScore/(double)judgeCount) * .6) + ((presScore/(double)judgeCount) * .4); } }