You are on page 1of 1

import javax.swing.

JOptionPane;
public class Problem1 {
public static void main (String args []) {

INPUT
int something;
something = Integer.parseInt(JOptionPane.showInputDialog("Enter something: "));

int thousand;
thousand = money/100000;

double something;
something = Double.parseDouble (JOptionPane.showInputDialog ("Enter amount of something: "));

String something;
something = JOptionPane.showInputDialog (Enter something.);

String something;
something = ();

int money1;
money1 = (int)(money*100); ---- TO TRANSFORM DOUBLE TO INTEGER

OPERATIONS
+, - , * , /, %

>, <, ==, >=, <=, !=

IF STATEMENTS FOR INTEGER + DOUBLE
if (INSERT CONDITION HERE) {
if (INSERT CONDITION HERE) {
System.out.println (Something);
} else if (INSERT CONDITION HERE) {
System.out.println (Something);
} else {
System.out.println (Something);
}
}

IF STATEMENTS FOR STRING
EX. Rock-Paper-Scissors
String player1;
player1 = JOptionPane.showInputDialog (Enter Player 1 throw (Rock/Paper/Scissors).);
if (player1.equals (Rock)) {
if (player1.euquals (player2)) {
System.out.println (TIE);
}
}

COMPOUND IF STATEMENTS
(&& - AND)
(|| - OR)
Ex. Grade conversion
int grade
if (grade >= 92){
System.out.println (1.00);
}
if ((grade <= 91) && (grade >= 88)) {
System.out.println (1.25)
}

You might also like