Answered step by step
Verified Expert Solution
Question
1 Approved Answer
A HighScore.java 3 X HighScore.java > HighScore public class HighScore { //methods (s) for reading and validating //user input and creating a new DataType
A HighScore.java 3 X HighScore.java > HighScore public class HighScore { //methods (s) for reading and validating //user input and creating a new DataType //this is the reading GameScore Method 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 } //calling the method to read the detials from the user //and assigns results to information Run | Debug public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.println("Enter score information: "); GameScore gameScore = readGameScore(); System.out.println("You entered: "); System.out.println (gameScore); } GameScore.java //printing the game score information public static GameScore readGameScore() { GameScore gameScore; Scanner in = new Scanner(System.in); System.out.print("Enter player name: "); String playername = in.nextLine(); System.out.print("Enter game ID: "); int gameId = in.nextInt (); } int score =-1; while (score < 0) { } System.out.print("Enter score: "); score = in.nextInt (); if (score < 0) { System.out.println("Score must be positive value"); } gameScore = new GameScore (playername, gameId, score); return gameScore;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started