![]() |
|
#1
|
|||
|
|||
Simple Calculator ApplicationSALAM SIR,
HOW ARE YOU SIR?Hey whats up? I'm a new Java student and I am lost, can anyone help me?PLEASE HELP ME ABOUT HOW CAN MADE SIMPLE CALCULATOR APPLICATION IN JAVA?PLEASE YOU GIVE ME TUTORIALS ABOUT SIMPLE CALCULATOR APPLICATION AND SOURCES CODE. MY ENGLISH LANGUAGE IS VERY WEAK.MY WEBSITE ADDRESS IS www.geocities.com THANKS SIR |
|
#2
|
||||
|
||||
Re: Please You Give Me Tutorials About Simple Calculator Application And Sources Code.hi mohammed.
Welcome to the GIDForums. Please read the Guidelines before posting.. Ok. here is how you write a program in java: JAVA Code:
where, 1. JAVA Code:
2. JAVA Code:
3. JAVA Code:
4. JAVA Code:
6. JAVA Code:
7. JAVA Code:
How to get input from the user? //1. import the java.io package needed for BufferedReader, InputStreamReader, etc. JAVA Code:
// 2. Create an InputStreamReader using the standard input stream. JAVA Code:
// 3. Create a BufferedReader using the InputStreamReader created. JAVA Code:
// 4. Use the BufferedReader to read a line of text from the user. JAVA Code:
//5.Use the Integer class to parse the string of characters into an integer. JAVA Code:
What if the user types letters instead of digits? The parseInt method declares that it may throw a NumberFormatException. Exceptions indicate that an error occurred in a program. A programmer can write code to recover from an exception and continue program execution instead of abnormally terminating the program. You can catch the NumberFormatException using the try and catch statements.. You can find more about exceptions in this link so here is a sample program to get input from the user and print the value: JAVA Code:
Now on to creating a calculator application: What should we do? 1. Get two inputs from the user say a and b. 2. Display a menu to the user like: Quote:
so this is a sample calculator application: JAVA Code:
You can know more about java from learning this tutorial Bye, Paramesh |
Recent GIDBlog
Observations of Iraq by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The