After assembling current file in MARIE. If I'm prompted with an error, how can i spot which line the error is directed at?
Also I'm working on an assignment that requires me to input length and width from the user and output perimeter or area. So far here is what i have :
ORG 100
input length //take input length
store length //store length in location length1
output length //show value of length
input width //take input width
store width //store into location width
output width //show input width
load width
subt width One //(subtract one from w until 0)
store width
load a
add length // add l to area
store a
Skipcond 00d //(skip when width hits 0)
Jump 007 //
output area
halt
a, dec 0
b, dec 0
c, dec 0
end
I also wrote in java to make it more clear to understand
//find either perimeter or area of rectangle
import java.util.Scanner;
public class PerimeterOrArea{
public static void main(String[] args){
int length, width;
int perimeter, area;
String ch;
char character;
Scanner in = new Scanner(System.in);
System.out.println("Please enter length of rectangle: ");
length = in.nextInt();
System.out.println("Please enter width of rectangle: ");
width = in.nextInt();
area = length*width;
perimeter = 2*(length + width);
System.out.println("Please enter P to find perimeter of rectangle or A to find area of rectangle");
ch = in.next();
character = ch.charAt(0);
if(character == 'P')
System.out.println("The value of perimeter is : " + perimeter);
if(character == 'A')
System.out.println("The value of area is : " + area);
}
}
6 errors persist in MARIE code. Please help.