Hello Stack Overflow.
I have a problem with my code. The goal is to create a text-based calculator that reads an input file and processes the equations. The first number tells the program how many lines are there. I think I set up that part right, count is the number of lines. Here's what I got so far.
Scanner equationScan;
int count;
double a=0;
double b=0;
double calc1;
equationScan = new Scanner(new File("calculator.txt"));
count = equationScan.nextInt();
while(count > 0)
{
String line = equationScan.nextLine();
if(line.equals("sin"))
{
a = equationScan.nextDouble(); *Error shows up here. Req: variable Found: value
Math.sin(a)= calc1;
}
}
The goal is a number of 'if' statements for the program to follow. I understand that part, but I can't get past this error. The first line of the text file reads an integer and I'm trying to see the second line of the file that reads sin of a double and to calculate that and store it. Help would be greatly appreciated!