Due Date: Wednesday Feb 15/Thursday Feb 16.
This project should be your and only your work. Please do not discuss this with any of your classmates. If you need help contact TAs or the instructor.
For Project1 we will implement a specialized calculator that performs very basic mathematical functions.
It should provide the following basic functions:
1) Addition 2) Subtraction 3) Multiplication 4) Division 5) Modulo operator
All the functions should accept 2 numbers to perform operation on and return the result. Please select the return values and parameters so that your functions return proper values for both integers and whole numbers.
For all the operations assume you will be using mathematical expression: parameter1 op parameter2 (op = mathematical operator)
1) The addition method should work only if both parameters are positive. It should display an error message if either of the parameter is negative
2) The subtraction method should only work if the first parameter is greater than the second parameter else display an error message
3) The multiplication method should work only for integers not
for whole numbers. In case a number has decimal place it should
report an error message.( If you did this it is great! I am
impressed... You can get a 5 points extra credit)...
However for people who are having trouble with this, you can just return product of two numbers. Don't worry about checking for integers and decimals.
4) The division method should check and report the division by zero error.
All the methods should print the result to the screen. Make your message meaningful.
Please document your code
You must document your code to get a full credit.
Program Compilation
Your program must compile and run.
Pledge
Every program submission for this class must include an Honor Code
pledge. Specifically, you must always include the following pledge statement in the header comment for
your program:
/****************************************************************************
*
* On my honor:
*
* - I have not discussed the Java language code in my program with
* anyone other than my instructor or the
teaching assistants
* assigned to this course.
*
* - I have not used Java language code obtained from another
student,
* or any other unauthorized source,
either modified or unmodified.
*
* - If any Java language code or documentation used in my program
* was obtained from another source, such as a text book or course
* notes, that has been clearly noted with a proper citation in
* the comments of my program.
*
* - I have not designed this program in such a way as to defeat or
* interfere with the normal operation of the Curator System.
*
* Your Name
* Your PID
****************************************************************************/
Failure to include this pledge in a submission is a violation of
the Honor Code.