Assignment #120 and Receipt

Code

    ///Name: Tim Gibson
    ///Period: 6
    ///Project Name: Programs that Write to Files
    ///File Name: Receipt.java
    ///Date Finished: 1/14/16
        
    import java.io.IOException;
    import java.io.PrintWriter;
    import java.util.Scanner;
    
    public class Receipt {
    
        public static void main(String[] args) {
    
            PrintWriter fileOut;
    
            Scanner kb = new Scanner(System.in);
            
            try{
                fileOut = new PrintWriter("receipt.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);
            }
            double ppg = 2.11;
            int g;
            System.out.print("How many gallons of gas would you like to purchase? ");
            g = kb.nextInt();
            
            double t = g * ppg;
    
            fileOut.println( "Price Per Gallon: " + ppg + "\n Gallons: " + g + "\n Total Cost: " + t ); 
    
            fileOut.close();
        }
    }
                        
    

Picture of the output

120