Call
(317)643-0663
for consultation
Experience Programming
.
Home
Pricing
About
Contact
Java Example
Simple Division Example
.
Back to Examples
package edu.iuk.division;
import javax.swing.JOptionPane;
public class Division {
public static void main(String[] args) {
//Jacob Morris
//Declare Variables
int firstNumber;
int secondNumber;
int Module;
//retrieve first number from user
firstNumber = Integer.parseInt(JOptionPane.showInputDialog(“Please enter the first number.”));
//retrieve second number
secondNumber = Integer.parseInt(JOptionPane.showInputDialog(“Please enter the second number.”));
//find leftover integers after dividing
Module =firstNumber % secondNumber;
//if perfect division
if (Module == 0){
JOptionPane.showMessageDialog(null, “the number is evenly divisible.”);
} else{
JOptionPane.showMessageDialog(null, “the number is not evenly divisible.”);
}
}
}
Back to Examples
Startup Discount
Small Business?
Contact us for an
Enormous
Discount!
Contact Us Today!