// ITI 1120 // Name: Diana Inkpen, Student# 123456 //import java.io.*; /** * This program computes the average of three costs (for three books). */ class MarkResult { public static void main (String[] args) { // DECLARE VARIABLES/DATA DICTIONARY int first; // GIVEN three numbers out of 25 double second; // GIVEN double third; // GIVEN double average; // RESULT: average mark out of 100 // PRINT OUT IDENTIFICATION INFORMATION System.out.println(); System.out.println("ITI 1120 Example"); System.out.println("Name: Diana Inkpen, Student# 123456"); System.out.println(); // READ IN GIVENS System.out.println( "Please enter three numbers:" ); first = ITI1120.readInt( ); second = ITI1120.readDouble( ); third = ITI1120.readDouble( ); // CALLS THE ALGORITHM average = markResult(first, second, third); // PRINT OUT RESULTS AND MODIFIEDS System.out.println( "The average is " + average); } /** * This method computes the average of three numbers. */ public static double markResult ( int score1, double score2, double score3) { // VARABLE DECLARATIONS double sum; // intermediate double avgOutOf25; // intermediate double avgPct; // RESULT //BODY OF THE ALGORITHM sum = score1 + score2 + score3; avgOutOf25 = sum / 3; avgPct = avgOutOf25 * 4; // RETURN RESULTS return avgPct; } }