hi,
i dont know how to solve it can you help me please???
Create a java program that will do the following:

# read 3 inputs from the keyboard

• two input numbers each being a single digit (0…9)
• one character representing one of five operations : + (addition), - (subtraction), * (multiplication), / (division), and ^ (exponentiation)
b) output the description of the operation in plain English as well as the numeric results

Example1, if the two digits are 5 and 3 and the operation was * then the output should be

``````five multiplied by three is 15
``````

Note, the result is given as a number, not a word.

Example2, if the two numbers are 2 and 9 and the operation is – then the output should be

`````` two minus nine is -7
``````

Hint: to perform the exponentiation, use the pow method of the Math class.

Example3, if the two numbers are 5 and 2, and the operation is ^, then the output should be

``````    five to the power two is 25
``````

Example4, if the two numbers are 5 and 9, and the operation is / then the output should be

``````five divided by nine is 0.55555556
``````

For division, you cannot divide by 0, and you should therefore test whether the second number is 0; if it is then you should output a message saying you cannot divide by 0.
Example5, if the two numbers are 5 and 0, and the operation is / then the output should be

``````Division by zero is not allowed
``````

Both input numbers must be single digits between0..9.
Example6, If the user enters 25 and 3 and the operation is + then the output should be

``````Invalid number; only single digits allowed.
``````

and thanxx

3
Contributors
2
Replies
9
Views
4 Years
Discussion Span
Last Post by JamesCherrill

Let see your code and WE will help YOU to correct it. We are NOT doing this for you. The instructions you posted are MORE than enough to get started, so get started.

There are lots of people here who will freely give their time to help you become the best Java programmer you can be. There's nobody here who is interested in helping you cheat or doing your homework for you.

DaniWeb Member Rules (which you agreed to when you signed up) include:
"Do provide evidence of having done some work yourself if posting questions from school or work assignments"
http://www.daniweb.com/community/rules

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.