You are viewing our Forum Archives. To view or take place in current topics click here.

Was this a good calculator for a newbie?

Yes
0.00% (0 votes)
No
0.00% (0 votes)
Needs improvment
0.00% (0 votes)

Total Votes: 0

Rate my Calculator
Posted:

Rate my CalculatorPosted:

paapostolas
  • New Member
Status: Offline
Joined: Jul 15, 201113Year Member
Posts: 16
Reputation Power: 0
Status: Offline
Joined: Jul 15, 201113Year Member
Posts: 16
Reputation Power: 0
ok so i just started java on monday and i have made a calculator please rate it 1-10

[spoiler]double number2;
char opsymbol = ' ';
JOptionPane.showMessageDialog(null, "Welcome to Alex's Calculator", "Calculator");
JOperationpane.showMessageDialog(null," ")
number1 = Double.parseDouble(JOptionPane.showInputDialog(null, "Enter your first number"));
String operation = JOptionPane.showInputDialog(null, "Choose your operation \nAdd, Subtract, Multiply, or Divide");
number2 = Double.parseDouble(JOptionPane.showInputDialog(null, "Enter your second number"));

double result = 0;

if (operation.equalsIgnoreCase("Add")){
result = number1 + number2;
opsymbol = '+';

}
else if (operation.equalsIgnoreCase("Subtract")){
result = number1 - number2;
opsymbol = '-';
}
else if (operation.equalsIgnoreCase("Divide")){
result = number1 / number2;
opsymbol = '/';
}
else if (operation.equalsIgnoreCase("Multiply")){
result = number1 * number2;
opsymbol = '*';
}
JOptionPane.showMessageDialog(null, "Result: " + number1 + opsymbol + " " + number2 + " = " + result);
}
}
[/spoiler]
#2. Posted:
Etna
  • Prospect
Status: Offline
Joined: Jul 07, 201113Year Member
Posts: 643
Reputation Power: 32
Status: Offline
Joined: Jul 07, 201113Year Member
Posts: 643
Reputation Power: 32
I dont get it...someone help me!
#3. Posted:
paapostolas
  • New Member
Status: Offline
Joined: Jul 15, 201113Year Member
Posts: 16
Reputation Power: 0
Status: Offline
Joined: Jul 15, 201113Year Member
Posts: 16
Reputation Power: 0
-Etna- wrote I dont get it...someone help me!

its java. i just coded it today lol
Jump to:
You are viewing our Forum Archives. To view or take place in current topics click here.