Assignemnt #121 High Score

Code

     ///Name: Prooz Fereydouni
    ///Period: 7
    ///Project Name: High Score
    ///File Name: HS.java
    ///Date: 5/28/2016
    
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Scanner;

public class HS {

        public static void main(String[] args) {
        PrintWriter fileOut;
        Scanner kb = new Scanner(System.in);

        try{
            fileOut = new PrintWriter("score.txt");

        } catch(IOException e) {
            System.out.println("Sorry, I can't open the file 'receipt.txt' for editing.");
            System.out.println("Maybe the file exists and is read-only?");
            fileOut = null;
            System.exit(1);
        }
        
        System.out.println("You got a high score!!!");
        System.out.print("Please enter you score: ");
        int score = kb.nextInt();
        System.out.print("Please enter you name: ");
        String name = kb.next();
        System.out.println("Data stored into score.txt. Thank you play again.");
              

        fileOut.println( "Name: " + name);
        fileOut.println( "Score: " + score);

        fileOut.close();
    }
}
    

    

Picture of the output

assignment121