fork download
  1. import java.util.Scanner;
  2. /*
  3.  * Jon Nelson
  4.  * Lab 3
  5.  * CSIS 112
  6.  
  7.  Pseudocode
  8.  create 3 test variables, test1, test2, test3 to store 3 test scores
  9.  create a variable called average to store the average
  10.  Display "enter a score for test 1"
  11.  Ask test1
  12.  Display "enter a score for test 2"
  13.  Ask test2
  14.  Display "enter a score for test 3"
  15.  Ask test3
  16.  Set average equal to test1 + test2 + test3 devided by 3
  17.  Display the three test scores and the average
  18.  */
  19.  
  20. public class lab3part1
  21. {
  22. public static void main(String[] args)
  23. {
  24. double test1, test2, test3, average;
  25.  
  26. Scanner keyboard = new Scanner(System.in);
  27.  
  28.  
  29. System.out.print("Enter score for Test 1: ");
  30. test1 = keyboard.nextDouble();
  31. System.out.print("Enter score for Test 2: ");
  32. test2 = keyboard.nextDouble();
  33. System.out.print("Enter score for Test 3: ");
  34. test3 = keyboard.nextDouble();
  35.  
  36. average = (test1 + test2 + test3)/3;
  37.  
  38. System.out.println("Your test scores are Test 1: "+test1+" Test 2: "+test2+" Test 3: "+
  39. test3+ " Your average is: "+ average);
  40. }
  41. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:20: error: class lab3part1 is public, should be declared in a file named lab3part1.java
public class lab3part1
       ^
1 error
stdout
Standard output is empty