Need help with a
java project I need to do. Here is the project specifications :
"""Create a console calculator applicaion that:
* Takes one command line argument: your name and surname. When the
program starts, display the date and time with a welcome message for the
user.
* Display all the available options to the user. Your calculator must include
the arithmetic operations as well as at least five scientific operations of the
Math class.
-Your program must also have the ability to round a number and
truncate it.
-When you multiply by 2,
you should not use the '*' operator to perform the
operation.
-Your program must also be able to reverse the sign of a number.
* Include sufficient error checking in your program to ensure that the user
only enters valid input. Make use of the
String; Character, and other
wrapper classes to help you.
* Your program must be able to do conversions between decimal, octal and
hex numbers.
* Make use of a menu. You should give the user the option to end the
program when entering a certain option.
* When the program exits, display a message for the user, stating the
current time, and calculate and display how long the user used your
program.
* Make use of helper classes where possible.
* Use the SDK to run your program."""
I am stuck at the moment and don't know how to correct this problem.
I have created a method ' hexadecimalEquivalent(); ' (among others...) which if the user chooses, it converts the numbers he/she provided as input to the hexadecimal equivalent, my ' octalEquivalent(); ' method works but I get an error message that states " Exception in
thread "main" java.lang.NumberFormatException: For input string: "b"
at java.lang.NumberFormatException.forInputString(Unknown Source)
at java.lang.Long.parseLong(Unknown Source)
at java.lang.Long.parseLong(Unknown Source)
at org.Java.Instructor.Project.hexadecimalEquivalent1(Project.java:86)
at org.Java.Instructor.Project.Calculator(Project.java:271)
at org.Java.Instructor.Project.main(Project.java:329)
"
Can anyone please help me.
Here is the code that I have done so far for my Project.class:
Your help will be much appreciated.
Thanks
Edit by mw: Formatted code (which was originally posted as a single line.
).
[ November 16, 2008: Message edited by: marc weber ]