CECS 524 Assignment 3

Original price was: $35.00.Current price is: $30.00.

5/5 - (3 votes)

CECS 524
Assignment 3
Total: 36 Points
General Instruction
• I absolutely recommend that you type your answers to exercise questions by using
• If your programs could not be executed on a command line environment, zero grade
will be given for the programs.
• Submit PDF, java, cpp, py files via BeachBoard (Not email or in class).
1. (15 points) Write regular expression to capture the hexadecimal floating-point values.
A hexadecimal floating-point value has an optional fractional portion (beginning with a
dot) and a mandatory exponent (beginning with P or p). There may be digits to the
left of the dot, the right of the dot, or both, and the exponent itself is given in decimal
(contains only the digits 0-9), with an optional leading + or – sign. A hexadecimal
floating-point value may end with an optional F or f (indicating “float”-single precision)
or L or l (indicating “long”-double precision).
i. A character
ii. The empty string
iii. Parenthesis
iv. Concatenation
v. ‘or’
vi. Kleene star. (Please use superscript star symbols, ?
2. (21 points) Write a Java, C++, and Python programs (without external library) that
determines whether a given stream of characters is a hexadecimal floating-point value
or not.
i. The file names of the source codes should be, Assn3.cpp,
ii. The programs should read the input file name from the command-line arguments
passed to the program. (args[], argv[], sys.argv[]).
iii. The program should read each line from an input file and print out its evaluation.
iv. You can use any regular expression which is allowed in the programming languages.
v. Execution commands should be:
javac; java Assn3 a3_input.txt
g++ Assn3.cpp -o Assn3; ./Assn3 a3_input.txt
python a3_input.txt
CECS 524 Assignment 3 – Page 2 of 2
vi. Expected output for the provided a3 input.txt.
Matched: 0x1p+1
Not Matched: 0x1p+8.8
Not Matched: 1a.0p-6
Matched: 0x1.b7p-1
Note. Your programs will be tested with a different test file.

Scroll to Top