This is a VERY basic program to calculate the area of a circle, triangle, or quadrilateral. The interface we run the program on is STOP, so we can only use numbers to run the program once it is compiled. This is the reason there aren't any strings or anything like that. On to my problem, when I compile this code, I get the following error:
Compile Error--parser failed. token: ( msg: [14,10] expecting: 'true', 'false', 'read', '!', '-', decimal integer literal, identifier
This is the first time I go to calculate the area, and I can't figure out why it's not working. All my previous coding has been in C++, so is the equation written incorrectly for JAVA?
int A, b, h, l, w, r;
int x = 0;
{
while (x != 5)
{
x = read();
if (x == 1)
{
r = read();
A = (22 * r * r) / 7;
write (A);
}
if (x == 3)
{
b = read();
h = read();
A = (b * h) / 2;
write (A);
}
if (x == 4)
{
l = read();
w = read();
A = l * w;
write (A);
}
}
}