Lab - SIN validation ..
807598Oct 5 2006 — edited Oct 10 2006Can maybe someone show me an example on how to do it?
i need to
1. prompt for SIN
2. The calculation from the even-numbered digits
3. total derived from the first 8 digits
4. calculated check digit
5. the message indicating correct or incorrect SIN
6. End of program message
here is an example need help..
*/
import java.util.Scanner;
public static class lab1
{
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
int sin = 0;
int num0, num1, num2, num3, num4, num5, num6, num7, num8;
int count = 0;
int second, fourth, sixth, eighth;
System.out.println("Please enter a sin number: ");
sin = input.nextInt();
count = int.length(sin);
while (count > 8 || count < 8)
{
System.out.println("Valid Input");
System.out.println("Please enter a sin number: ");
sin = input.nextInt();
}
num0 = input.next().charAt(0);
num1 = input.next().charAt(1);
num2 = input.next().charAt(2);
num3 = input.next().charAt(3);
num4 = input.next().charAt(4);
num5 = input.next().charAt(5);
num6 = input.next().charAt(6);
num7 = input.next().charAt(7);
num8 = input.next().charAt(8);
second = num2 * 2;
fourth = num4 * 2;
sixth = num6 * 2;
eighth = num8 * 2;
}
}
Message was edited by:
Cupcake