You are on page 1of 6

/* Determine if a number is positive

Input= a number Process= if number is a positive number Output= Yes, the number is a positive number

*/

import javax.swing.JOptionPane;

public class Number1 {

public static void main(String args[]) {

int num;

num=Integer.parseInt(JOptionPane.showInputDialog("Enter a number: "));

if (num>=0){

JOptionPane.showMessageDialog(null, "Yes, " + num + " is a positive number");

}else{

JOptionPane.showMessageDialog(null, num + " is not a positive number");

/* Determine if a number is positive or negative

Input= a number

Process= if number is a positive or negative number

Output= The number is a positive number// The number is a negative number

*/

import javax.swing.JOptionPane;

public class Number2 {

public static void main(String args[]) {

int num;

num=Integer.parseInt(JOptionPane.showInputDialog("Enter a number: "));

if (num>=0){

JOptionPane.showMessageDialog(null, num + " is a positive number");

}else{

JOptionPane.showMessageDialog(null, num + " is a negative number");

}
/* Determine if a number is within range of 1-10

Input= a number Process= if a number is 1-10 Output= Yes, the number is within numbers 1-10

*/

import javax.swing.JOptionPane;

public class Number3 {

public static void main(String args[]) {

int num;

num=Integer.parseInt(JOptionPane.showInputDialog("Enter a number: "));

if (num >= 1 && num <=10){

JOptionPane.showMessageDialog(null, "Yes, " + num + " is a number within 1-10");

/* Determine if the salary of an employee will fall in one of the following categories:

(1,000-10,000: Contractual) (10,001-20000: Temporary) (20,001-50,000: Permanent)

Input- salary Process= if the salary will fall in Contractual, Temporary or Permanent

Output=Contractual, Temporary or Permanent */

import javax.swing.JOptionPane;

public class NumberFour {

public static void main(String args[]) {

int salary;

salary= Integer.parseInt(JOptionPane.showInputDialog("Enter a salary amount: "));

if (salary >=1000 && salary <= 10000){

JOptionPane.showMessageDialog(null, salary + " is Contractual");

} else if(salary >= 10001 && salary <= 20000){

JOptionPane.showMessageDialog(null, salary + " is Temporary");

} else if(salary >=20001 && salary <= 50000){

JOptionPane.showMessageDialog(null, salary + " is Permanent");

}
/**Determine the salary of a particular salary grade

Input=salary

Process=determine the particular grade of a salary

Output= Salary is Grade 1-33

*/

import javax.swing.JOptionPane;

public class Number5 {

public static void main(String args[]) {

int salary;

salary= Integer.parseInt(JOptionPane.showInputDialog("Enter a salary: "));

if (salary == 12517){

JOptionPane.showMessageDialog(null, salary + " is Grade 1");

}else if (salary == 13305){

JOptionPane.showMessageDialog(null, salary + " is Grade 2");

}else if (salary == 14125){

JOptionPane.showMessageDialog(null, salary + " is Grade 3");

}else if (salary == 14993){

JOptionPane.showMessageDialog(null, salary + " is Grade 4");

}else if (salary == 15909){

JOptionPane.showMessageDialog(null, salary + " is Grade 5");

}else if (salary == 16877){

JOptionPane.showMessageDialog(null, salary + " is Grade 6");

}else if (salary == 17899){

JOptionPane.showMessageDialog(null, salary + " is Grade 7");

}else if (salary == 18998){

JOptionPane.showMessageDialog(null, salary + " is Grade 8");

}else if (salary == 20340){

JOptionPane.showMessageDialog(null, salary + " is Grade 9");

}else if (salary == 22190){

JOptionPane.showMessageDialog(null, salary + " is Grade 10");

}else if (salary == 25439){

JOptionPane.showMessageDialog(null, salary + " is Grade 11");


}else if (salary == 27608){

JOptionPane.showMessageDialog(null, salary + " is Grade 12");

}else if (salary == 29798){

JOptionPane.showMessageDialog(null, salary + " is Grade 13");

}else if (salary == 32321){

JOptionPane.showMessageDialog(null, salary + " is Grade 14");

}else if (salary == 35097){

JOptionPane.showMessageDialog(null, salary + " is Grade 15");

}else if (salary == 38150){

JOptionPane.showMessageDialog(null, salary + " is Grade 16");

}else if (salary == 41508){

JOptionPane.showMessageDialog(null, salary + " is Grade 17");

}else if (salary == 45203){

JOptionPane.showMessageDialog(null, salary + " is Grade 18");

}else if (salary == 49835){

JOptionPane.showMessageDialog(null, salary + " is Grade 19");

}else if (salary == 55799){

JOptionPane.showMessageDialog(null, salary + " is Grade 20");

}else if (salary == 62449){

JOptionPane.showMessageDialog(null, salary + " is Grade 21");

}else if (salary == 69963){

JOptionPane.showMessageDialog(null, salary + " is Grade 22");

}else if (salary == 78455){

JOptionPane.showMessageDialog(null, salary + " is Grade 23");

}else if (salary == 88410){

JOptionPane.showMessageDialog(null, salary + " is Grade 24");

}else if (salary == 100788){

JOptionPane.showMessageDialog(null, salary + " is Grade 25");

}else if (salary == 113891){

JOptionPane.showMessageDialog(null, salary + " is Grade 26");

}else if (salary == 128696){

JOptionPane.showMessageDialog(null, salary + " is Grade 27");


}else if (salary == 145427){

JOptionPane.showMessageDialog(null, salary + " is Grade 28");

}else if (salary == 164332){

JOptionPane.showMessageDialog(null, salary + " is Grade 29");

}else if (salary == 185695){

JOptionPane.showMessageDialog(null, salary + " is Grade 30");

}else if (salary == 273278){

JOptionPane.showMessageDialog(null, salary + " is Grade 31");

}else if (salary == 325807){

JOptionPane.showMessageDialog(null, salary + " is Grade 32");

}else if (salary == 411382){

JOptionPane.showMessageDialog(null, salary + " is Grade 33");

/* Determine if a number is >100 or <100

Input= number

Process= If a number is less than or greater than 100

Output= Number is greater than 100 // Number is less than 100

*/

import javax.swing.JOptionPane;

public class Number6 {

public static void main(String args[]) {

int num;

num=Integer.parseInt(JOptionPane.showInputDialog("Enter a number: "));

if (num > 100){

JOptionPane.showMessageDialog(null, num + " is greater than 100");

}else if (num <100){

JOptionPane.showMessageDialog(null, num + " is less than 100");

}
/*Determine if a number is a bit number

*Input= number Process= Determine if number is a bit number Output= num is a bit number

*/

import javax.swing.JOptionPane;

public class Number7 {

public static void main(String args[]) {

int num;

num= Integer.parseInt(JOptionPane.showInputDialog("Enter a number: "));

if (num == 0 || num == 1 ){

JOptionPane.showMessageDialog(null, num + " is a bit number");

/* Determine the weight status of the given bmi

Input= bmi Process= is the bmi is underweight, normal, overweight, obese

Output= Underweight, Normal, Overweight, Obese */

import javax.swing.JOptionPane;

public class Number8 {

public static void main(String args[]) {

double bmi;

bmi= Double.parseDouble(JOptionPane.showInputDialog("Enter BMI: "));

if (bmi < 18.5){

JOptionPane.showMessageDialog(null, bmi + " is Underweight");

}else if (bmi >= 18.5 && bmi <= 24.9){

JOptionPane.showMessageDialog(null, bmi + " is Normal");

}else if (bmi >= 25.0 && bmi <=29.9){

JOptionPane.showMessageDialog(null, bmi + " is Overweight");

}else if (bmi >= 30.0){

JOptionPane.showMessageDialog(null, bmi + " is Obese");

You might also like