Well to start off...here is my code.
import java.io.*;
import java.util.*;
// my name
public class project12
{
static Scanner console = new Scanner(System.in);
Scanner inFile = new Scanner(new FileReader("f:\\JAVA\\projects\\receipts.txt"));
public static void main(String[] args)
{
int movies;
double price;
price=2.00;
double change, cash, tax, total;
System.out.println("Enter how many movies you are renting.");
movies = console.nextInt();
System.out.println("movies = " + movies);
price = movies * 2.00;
System.out.println("The movie price is " price ".");
tax = price * .08;
System.out.println("Tax: " +tax);
total = price + tax;
System.out.println("The Total with Tax is " total ".");
System.out.println("Cash Tendered: ");
cash = console.nextDouble();
change = (cash - total);
System.out.printf("Your change is %.2f", change);
if (change < 5)
{System.out.println("Thank You For Doing Buisness With US.");}
else if (change >=5)
{System.out.println("Thank You");}
else if (change >5);
{System.out.println("We Value Your Buisness Here At The Movie Shop");}
inFile.close();
}
}
This is the error i am recieving:
project12.java:53: non-static variable inFile cannot be referenced from a static context
inFile.close();
^
1 error
does anyone have an idea on how to fix this. i have been trying for quite a while to no avail.
if anyone can help it would be much appreciated.
-silence-