ODL 115 COURSEWORK 1
Question 3
Write a program in Java which will parse and recognise (output "Accept") all and only expressions which conform to ONE of the sets of syntax rules designed for the previous question.
Answer
import java.util.*;
class num
{  public static void main ( String param [] ) throws Exception
{ input in = new input();
output out = new output();
out.writeln("Enter a Roman Numeral between i and c inclusive");
String numeral = in.readline();
if (numeral.equals("i"))
out.writeln("Yes, that is a valid Roman Numeral");
>              else
out.writeln("No, that's not a valid Roman Numeral");
in.close(); out.close();
}
}
Question 1
Question 2
To Top
Hosted by www.Geocities.ws

1