Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. package backpack;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class BowlingAverages
  6. {
  7.  
  8. public static void main(String[] args)
  9. {
  10. Scanner input = new Scanner(System.in);
  11. int game = 1;
  12. String name = "filler";
  13. int score = 0;
  14. double scoreCount = 0;
  15. int gameAverage = 5;
  16.  
  17. while (!name.equals("\n"))
  18. {
  19. System.out.println("Please enter the bowlers name:");
  20. System.out.println("To stop, just press 'enter'.");
  21. name = input.nextLine();
  22.  
  23.  
  24. for (game = 1; game <= 5; game++)
  25. {
  26. System.out.println("Please enter " + name + "'s score for game " + game );
  27. score = input.nextInt();
  28. scoreCount += score;
  29. }
  30. System.out.printf(name + "'s average score is %.2f", (scoreCount / gameAverage ));
  31. System.out.println("\n");
  32. } // while
  33.  
  34. }
  35.  
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement