44 lines
924 B
Plaintext
44 lines
924 B
Plaintext
|
package parkhaus;
|
||
|
|
||
|
public class Zahlen {
|
||
|
private String VISA;
|
||
|
public Zahlen(String VISA) {
|
||
|
this.VISA=VISA;
|
||
|
}
|
||
|
public String getVISA(){
|
||
|
return VISA;
|
||
|
}
|
||
|
public int PZ() {
|
||
|
int pz=0;
|
||
|
int gewichtung=1;
|
||
|
int quersumme=0;
|
||
|
for(int i=16;i>=0;i-- ) {
|
||
|
char ch=VISA.charAt(i);
|
||
|
quersumme+=((int)ch)*gewichtung;
|
||
|
|
||
|
if(gewichtung%2==0) {
|
||
|
gewichtung--;
|
||
|
}if(gewichtung%2!=0){
|
||
|
gewichtung++;
|
||
|
}
|
||
|
}
|
||
|
pz=10-(quersumme%10);
|
||
|
return pz;
|
||
|
}
|
||
|
public boolean bezahlt() throws InterruptedException {
|
||
|
System.out.println("Legen Sie die Karte ein.");
|
||
|
System.out.println(".");
|
||
|
Thread.sleep(1000);
|
||
|
System.out.println("..");
|
||
|
Thread.sleep(1000);
|
||
|
System.out.println("...");
|
||
|
Thread.sleep(1000);
|
||
|
System.out.println("....");
|
||
|
Thread.sleep(1000);
|
||
|
System.out.println(".....");
|
||
|
Thread.sleep(1000);
|
||
|
System.out.println("Kauf abgeschlossen Sie können die Karte nun entfernen.");
|
||
|
return true;
|
||
|
}
|
||
|
}
|