Starting from:

$30

Assignment 2 SOLVED


Assignment 2
Total: 43 Points
General Instruction
• I recommend that you type your answers to exercise questions by using a word processor
(Microsoft word, LibreOffice writer, LATEX, etc.).
• 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 and js files via BeachBoard (Not email or in class).
1. (15 points) Chapter 2.6 – Exercise 2.1 (f): use the following expressions only
i. A character
ii. The empty string
iii. Parenthesis
iv. Concatenation
v. ‘or’
vi. Kleene star. (Please use superscript star symbols, ?
)
2. (28 points) Write a Java, C++, Python, JavaScript programs (without external library)
that determines whether a given stream of characters is a financial quantity or not.
i. The file names of the source codes should be Assn2.java, Assn2.cpp, Assn2.py,
and Assn2.js.
ii. The programs should read the input file name from the command-line arguments
passed to the program. (args[], argv[], sys.argv[], and process.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 Assn2.java; java Assn2 a2_input.txt
g++ Assn2.cpp -o Assn2; ./Assn2 a2_input.txt
python Assn2.py a2_input.txt
node Assn2.js a2_input.txt
vi. For MacOS, Linux users, you may need to run dos2unix to remove carriage
return symbols in the a2 input.txt.
vii. Expected output for the provided a2 input.txt.
CECS 424 Assignment 2 - Page 2 of 2
Matched: $**2,345.67
Not Matched: $0,123.45
Not Matched: $*1,23.56
Matched: $*1,234,567.90
Note. Your programs will be tested with a different test file.

More products