I'm trying to create program that allows you to enter a 12 digit number, e.g. xxxxxxxxxxxy... then it asks you to verify the number (but this time you only enter the first 11 digits of the same number) e.g. xxxxxxxxxxx. Then it will take the last digit of the first entry and put it together with at the end of the second entry so it can give you the full 12 digit number.
If the numbers match it will tell you the ticket is valid.. if not it will tell you the ticket is invalid.
Alright this is the code... When i compile it i get 14 errors:
import javax.swing.JOptionPane; import javax.swing.JFrame; public Validation { public static void main(String[] args) throws Exception { //Declaration of strings String inputOne; String inputTwo; //Declaration of long numbers long ticket; long confirm; //Declaration of integers int remainder = ticket%10; inputOne=JOptionPane.showInputDialog("Please enter the ticket number: "); inputTwo=JOptionPane.showInputDialog("Please confirm the ticket number: "); ticket=long.parseLong(inputOne); confirm=long.parseLong(inputTwo); if ((confirm+remainder)==ticket) { JOptionPane.showMessageDialog(null, "The ticket number you just entered is valid", JOptionPane.INFORMATION_MESSAGE); } else { JOptionPane.showMessageDialog(null, "The ticket number you just entered is invalid", JOptionPane.INFORMATION_MESSAGE); } { System.exit(0); } } }