forked from Denisolt/CSCI-160
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChargeAccountValidation.java
More file actions
42 lines (41 loc) · 1.21 KB
/
ChargeAccountValidation.java
File metadata and controls
42 lines (41 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import java.util.Scanner;
/* Denisolt Shakhbulatov
* 11/03/2015
_______________________________
+ ChargeAccountValidation +
+______________________________
+ -int[]accnumbers +
+______________________________
+ +isValid():void +
_______________________________
*/
public class ChargeAccountValidation
{
int[] accnumbers = {11111, 22222, 33333, 44444, 55555, 66666, 77777, 88888, 99999, 10101, 20202, 30303, 40404, 50505, 60606, 70707, 80808, 90909};
public static void main(String [] arg)
{
ChargeAccountValidation tx = new ChargeAccountValidation();
System.out.print("Enter a charge account number: ");
Scanner kb = new Scanner(System.in);
int inputVal = kb.nextInt();
tx.isValid(inputVal);
}
public boolean isValid(int inputVal)
{
boolean isTrue = true;
for (int index = 0; index < accnumbers.length; index++)
{
if (accnumbers[index]!=inputVal)
{
isTrue = false;
System.out.print(isTrue);
}
else
{
isTrue = true;
System.out.print(isTrue);
}
}
return isTrue;
}
}