|
Project #1 |
CMSC 131 |
|
Due: Friday September 26 at 11:00 pm |
Object-Oriented Programming I |
|
Type of project: Open |
Fall 2008 |
Checking the Math Grader’s Work
Objective
This project will allow you to practice variables, strings, input/output facilities, conditional statements, logical operators, and the Eclipse IDE.
Overview
You will write a simple application that can be used to determine if the person who grades the math quiz is giving appropriate comments. The input lines consist of a mathematical equation followed by a one line comment from the grader. Your goal is read these two lines of input and determine if the comment from the grader was appropriate for the equation typed.
This project is considered "open". Please visit the course web page for information regarding the open/closed policy for projects of this course.
Specifications
There are two lines to the input. The first line contains a mathematical statement and the second line contains the comment from the grader. Both lines should be typed in as input, but there will be no prompt displayed for either line.
The kind of arithmetic equations allowed will include integer addition, subtraction, multiplication and division. (Note: integer division as defined in java – an integer result of integer division with no remainder.) The format of the equation will be
integer operator integer = integer
In the input, there will be at least one space after each item in this equation. If the integer is negative, there will be no space between the minus and the numeral (i.e. the value -45 is valid but – 45 will not appear in the input. In other words, when it says “integer” in the input format shown, you may assume it is a valid integer.
The only operators allowed are +, -, * and /. If any other character appears in that place of the input format shown above, the only output must be
ERROR - invalid operation
No more input should be read after you determine that the operation is invalid.
The place where the equals sign is shown in the input format above, must be an equals sign. If any other character appears in that place, the only output must be
ERROR - not equality
No more input should be read after you determine that the equals sign did not appear in the correct position.
For the second line of the input, the only valid grader comments are
correct
incorrect bigger
incorrect smaller
The correct means that the mathematical equation given is true statement. The incorrect means that the mathematical equation does not represent a true statement. The word bigger means that the answer portion of the equation would need to be larger in value in order for the equation to represent a true statement. The word smaller means that the answer portion of the equation would need to be smaller in value in order for the equation to represent a true statement.
If anything other than correct or incorrect appears as the first word on that line, the only output should be
ERROR
- Invalid Grader Comment
No more input should be read after you determine that the first word on the grader comment line is invalid.
If anything other than bigger or smaller appears after the word incorrect on that line, the only output should be
ERROR - Invalid Grader Comment
No more input should be read after you determine that the second word on the grader comment line is invalid.
If (and only if) you have determined that both the mathematical statement and the grader comment is valid, then you must determine if the grader gave a comment that correctly corresponds with the mathematical statement given. The output in this case will always show the operator immediately followed by a colon followed by either the comment Graded Correctly or the comment Graded Incorrectly. (Look at examples given below, and remember that this “correct” and “incorrect” do not refer to the equation being true or not – it only refers to if the problem was graded correctly.)
Getting Started
In order to help you get started, we have defined an ArithmeticQuiz class with a main( ) method in a file named ArithmeticQuiz.java. This file can be retrieved by checking out the project called Fall08Proj1 from the CVS repository. Remember that you must have set up your repository in order to check out and submit projects. (Refer to Project #0 for more specific instructions.) After checking out the project, switch over to Java perspective to open the source-code file and begin working on it.
If you write the project from scratch, without checking out the "Fall08Proj1" files from your CVS repository, you will not be able to submit your work.
Requirements
The following examples show how your program should behave. Note that items in italics represent the things that are entered by the user. Keep in mind these are just examples and not the only scenarios that your program is expected to handle.
Example 1:
1
+ 3 = 4
correct
+:
Graded Correctly
Example 2:
4
* 3 = 1
incorrect smaller
*:
Graded Incorrectly
Example 3:
11
/ 3 = 4
correct
/:
Graded Incorrectly
Example 4:
11
% 3 = 2
correct
ERROR
- invalid operation
Example 5:
1
+ 2 < 4
correct
ERROR
- not equality
Example 6:
1
+ 9 = 4
incorrect larger
ERROR -
Invalid Grader Comment
Example 7:
100
+ 100 = 10
incorrect bigger
+: Graded
Correctly
Submission
Submit your project from Eclipse by right-clicking the project folder and selecting "submit". You may submit as many times as you want -- we we only grade your most recent submission. After you have submitted your project, you should visit the submit server. There you can obtain limited feedback about how well your project is performing. The number of times you can run our tests on your project (before the due date) is limited. The earlier you begin working on the project, the more opportunities you will have to see how your project performs on our tests before the due date!
Grading
There are two public tests (corresponding to example 1 and example 2 above) and seven release tests which will be run on your project. Together, these tests will dictate 90% of the grade on the project. The remaining 10% will be based on your use of correct programming style.