Assignment #121 and High Score

Code

    /// Name: Mahima Choudhary
    /// Period: 6
    /// Program Name: High Score
    /// File Name: HighScore.java
    /// Date Finished: 5/11/2016
    
    import java.io.IOException;
    import java.io.PrintWriter;
    import java.util.Scanner;
    
    public class HighScore {
    
        public static void main(String[] args) {
            
            PrintWriter fileOut;
            String name;
            int highScore;
            
            Scanner k = new Scanner(System.in);
            
            System.out.println("Congrats, you got a high score!");
            System.out.print("\nPlease enter your score: ");
            highScore = k.nextInt();
            System.out.print("Plz enter your name: ");
            name = k.next();
            System.out.println();
            
            try{
                fileOut = new PrintWriter("score.txt");
                
            } catch(IOException e) {
                System.out.println("Sry, I can not open the file for editing.");
                fileOut = null;
                System.exit(1);
            }
            
            fileOut.println( name );
            fileOut.println( "High Score: " + highScore );
            
            fileOut.close();
        }
    }
    

Picture of the output

Assignment 121 Assignment 121