Assignemnt #121 and High Score
Code
/// Name: Brian Phillips
/// Period 5
/// Program Name: High Score
/// File Name: hi.java
/// Date Finished: 5/30/2016
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Scanner;
class hi
{
public static void main (String [] args)
{
PrintWriter fileOut;
Scanner kb = new Scanner(System.in);
System.out.print("What is your high score: ");
double score = kb.nextDouble();
System.out.print("What is your name: ");
String name = kb.next();
try
{
fileOut = new PrintWriter("score.txt");
}
catch(IOException e)
{
fileOut=null;
System.exit(1);
}
fileOut.println("User " + name );
fileOut.println("Score " + score);
fileOut.close();
}
}
Picture of the output