+PayBack
This commit is contained in:
parent
76fcedd923
commit
d7dd860789
@ -6,30 +6,16 @@
|
||||
<item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
|
||||
<item name="LOCAL_ROOT" type="e8cecc67:BranchNodeDescriptor" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
|
||||
<item name="REMOTE_ROOT" type="e8cecc67:BranchNodeDescriptor" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
|
||||
<item name="REMOTE_ROOT" type="e8cecc67:BranchNodeDescriptor" />
|
||||
<item name="GROUP_NODE:origin" type="e8cecc67:BranchNodeDescriptor" />
|
||||
</path>
|
||||
</expand>
|
||||
<select>
|
||||
<path>
|
||||
<item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
|
||||
<item name="LOCAL_ROOT" type="e8cecc67:BranchNodeDescriptor" />
|
||||
<item name="BRANCH:master" type="e8cecc67:BranchNodeDescriptor" />
|
||||
</path>
|
||||
</select>
|
||||
<select />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="86f42963-ed9f-4d18-9c81-a4cf18fa27c4" name="Default Changelist" comment="+Jasmins Version EinkaufwagenNummer">
|
||||
<change afterPath="$PROJECT_DIR$/src/com/company/BundeswehrPruefnummern.java" afterDir="false" />
|
||||
<list default="true" id="86f42963-ed9f-4d18-9c81-a4cf18fa27c4" name="Default Changelist" comment="+PayBack">
|
||||
<change afterPath="$PROJECT_DIR$/src/com/company/MultiplicationQuiz.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/src/com/company/mainAusgabe.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/out/production/JAVA-Aufgaben/com/company/EinkaufswagenNummer.class" beforeDir="false" afterPath="$PROJECT_DIR$/out/production/JAVA-Aufgaben/com/company/EinkaufswagenNummer.class" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/com/company/EinkaufswagenNummer.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/com/company/EinkaufswagenNummer.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/com/company/BundeswehrPruefnummern.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/com/company/BundeswehrPruefnummern.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/com/company/PayBack_LOL.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/com/company/PayBack_LOL.java" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
@ -55,7 +41,7 @@
|
||||
<component name="PropertiesComponent">
|
||||
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
|
||||
</component>
|
||||
<component name="RunManager" selected="Application.BundeswehrPruefnummern">
|
||||
<component name="RunManager" selected="Application.mainAusgabe">
|
||||
<configuration name="BundeswehrPruefnummern" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
|
||||
<option name="MAIN_CLASS_NAME" value="com.company.BundeswehrPruefnummern" />
|
||||
<module name="JAVA-Aufgaben" />
|
||||
@ -95,8 +81,43 @@
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="Fernbedinung" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
|
||||
<option name="MAIN_CLASS_NAME" value="com.company.Fernbedinung" />
|
||||
<module name="JAVA-Aufgaben" />
|
||||
<extension name="coverage">
|
||||
<pattern>
|
||||
<option name="PATTERN" value="com.company.*" />
|
||||
<option name="ENABLED" value="true" />
|
||||
</pattern>
|
||||
</extension>
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="mainAusgabe" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
|
||||
<option name="MAIN_CLASS_NAME" value="com.company.mainAusgabe" />
|
||||
<module name="JAVA-Aufgaben" />
|
||||
<extension name="coverage">
|
||||
<pattern>
|
||||
<option name="PATTERN" value="com.company.*" />
|
||||
<option name="ENABLED" value="true" />
|
||||
</pattern>
|
||||
</extension>
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<list>
|
||||
<item itemvalue="Application.BundeswehrPruefnummern" />
|
||||
<item itemvalue="Application.EinkaufswagenNummer" />
|
||||
<item itemvalue="Application.EinkaufwagenNummerJasminFehler" />
|
||||
<item itemvalue="Application.Fernbedinung" />
|
||||
<item itemvalue="Application.mainAusgabe" />
|
||||
</list>
|
||||
<recent_temporary>
|
||||
<list>
|
||||
<item itemvalue="Application.mainAusgabe" />
|
||||
<item itemvalue="Application.Fernbedinung" />
|
||||
<item itemvalue="Application.BundeswehrPruefnummern" />
|
||||
<item itemvalue="Application.EinkaufswagenNummer" />
|
||||
<item itemvalue="Application.EinkaufwagenNummerJasminFehler" />
|
||||
@ -166,21 +187,25 @@
|
||||
<option name="LAST_COMMIT_MESSAGE" value="+Jasmins Version EinkaufwagenNummer" />
|
||||
</component>
|
||||
<component name="WindowStateProjectService">
|
||||
<state width="1877" height="186" key="GridCell.Tab.0.bottom" timestamp="1605033112583">
|
||||
<state width="1877" height="243" key="GridCell.Tab.0.bottom" timestamp="1606298379087">
|
||||
<screen x="0" y="0" width="1920" height="1040" />
|
||||
</state>
|
||||
<state width="1877" height="243" key="GridCell.Tab.0.bottom/0.0.1920.1040@0.0.1920.1040" timestamp="1606298379087" />
|
||||
<state width="1877" height="186" key="GridCell.Tab.0.bottom/3840.0.1920.1040/1920.0.1920.1040/0.0.1920.1040@0.0.1920.1040" timestamp="1605033112583" />
|
||||
<state width="1877" height="186" key="GridCell.Tab.0.center" timestamp="1605033112583">
|
||||
<state width="1877" height="243" key="GridCell.Tab.0.center" timestamp="1606298379087">
|
||||
<screen x="0" y="0" width="1920" height="1040" />
|
||||
</state>
|
||||
<state width="1877" height="243" key="GridCell.Tab.0.center/0.0.1920.1040@0.0.1920.1040" timestamp="1606298379087" />
|
||||
<state width="1877" height="186" key="GridCell.Tab.0.center/3840.0.1920.1040/1920.0.1920.1040/0.0.1920.1040@0.0.1920.1040" timestamp="1605033112583" />
|
||||
<state width="1877" height="186" key="GridCell.Tab.0.left" timestamp="1605033112583">
|
||||
<state width="1877" height="243" key="GridCell.Tab.0.left" timestamp="1606298379086">
|
||||
<screen x="0" y="0" width="1920" height="1040" />
|
||||
</state>
|
||||
<state width="1877" height="243" key="GridCell.Tab.0.left/0.0.1920.1040@0.0.1920.1040" timestamp="1606298379086" />
|
||||
<state width="1877" height="186" key="GridCell.Tab.0.left/3840.0.1920.1040/1920.0.1920.1040/0.0.1920.1040@0.0.1920.1040" timestamp="1605033112583" />
|
||||
<state width="1877" height="186" key="GridCell.Tab.0.right" timestamp="1605033112583">
|
||||
<state width="1877" height="243" key="GridCell.Tab.0.right" timestamp="1606298379087">
|
||||
<screen x="0" y="0" width="1920" height="1040" />
|
||||
</state>
|
||||
<state width="1877" height="243" key="GridCell.Tab.0.right/0.0.1920.1040@0.0.1920.1040" timestamp="1606298379087" />
|
||||
<state width="1877" height="186" key="GridCell.Tab.0.right/3840.0.1920.1040/1920.0.1920.1040/0.0.1920.1040@0.0.1920.1040" timestamp="1605033112583" />
|
||||
<state width="1877" height="262" key="GridCell.Tab.1.bottom" timestamp="1605022562079">
|
||||
<screen x="0" y="0" width="1920" height="1040" />
|
||||
|
20
src/com/company/MultiplicationQuiz.java
Normal file
20
src/com/company/MultiplicationQuiz.java
Normal file
@ -0,0 +1,20 @@
|
||||
package com.company;
|
||||
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
public class MultiplicationQuiz {
|
||||
|
||||
private int aufgabeZahl1 = 0;
|
||||
private int aufgabeZahl2 = 0;
|
||||
|
||||
public String getExercise(){
|
||||
aufgabeZahl1 = ThreadLocalRandom.current().nextInt(1, 21);
|
||||
aufgabeZahl2 = ThreadLocalRandom.current().nextInt(1, 21);
|
||||
|
||||
return aufgabeZahl1+" * "+aufgabeZahl2+" = ?";
|
||||
}
|
||||
|
||||
public int getResult(){
|
||||
return aufgabeZahl1 * aufgabeZahl2;
|
||||
}
|
||||
}
|
@ -11,7 +11,7 @@ public class PayBack_LOL {
|
||||
public static void Eingabe(){
|
||||
Scanner scanner = new Scanner(System.in);
|
||||
|
||||
System.out.println("Bitte geben sie die Kennnummer ein: 3083423103187694");
|
||||
System.out.println("Bitte geben sie die PayBack Nummer ein: z.B. 3083423103187694");
|
||||
String wagenNummer = scanner.nextLine().replace("-", "");
|
||||
|
||||
while (wagenNummer.length() != 16) {
|
||||
@ -23,12 +23,20 @@ public class PayBack_LOL {
|
||||
ausgabe(korrektheit);
|
||||
}
|
||||
|
||||
public static boolean pruefungNummer(String nummer){
|
||||
int gewichtung = 0;
|
||||
int gewichtung2 = 0;
|
||||
for (int i = 0; i < nummer.length() - 1; i++) {
|
||||
char stelle = nummer.charAt(i);
|
||||
gewichtung = Character.getNumericValue(stelle) * (i % 2 == 0 ? 2 : 1);
|
||||
public static boolean pruefungNummer(String PayBackNummer){
|
||||
|
||||
String[] prifaex = {"079", "306", "307", "310", "376", "024", "503", "504", "002", "006", "007", "032", "391", "423", "424", "383", "505", "506", "384"};
|
||||
String[] unternehmen = {"Amazon", "DEA", "DEA", "DEA", "DM-Drogerie", "Galeria Kaufhof", "Lufthansa", "Lufthansa", "real", "real", "real", "real", "real", "Visa", "Visa", "AOL", "Obi", "Obi", "Palmers"};
|
||||
for(int i = 0; i < prifaex.length; i++ ){
|
||||
if(PayBackNummer.substring(6, 9).equals(prifaex[i])){
|
||||
System.out.println("Die PayPack Nummer gehört zu dem Unternehmen " + unternehmen[i]);
|
||||
}
|
||||
}
|
||||
|
||||
int quersumme = 0;
|
||||
for (int i = 0; i < PayBackNummer.length() - 1; i++) {
|
||||
char stelle = PayBackNummer.charAt(i);
|
||||
int gewichtung = Character.getNumericValue(stelle) * (i % 2 == 0 ? 2 : 1);
|
||||
|
||||
int quer, h, rest;
|
||||
quer = 0;
|
||||
@ -38,12 +46,12 @@ public class PayBack_LOL {
|
||||
quer = quer + rest;
|
||||
gewichtung = gewichtung / 10;
|
||||
}
|
||||
gewichtung2 = gewichtung2 + quer;
|
||||
quersumme += quer;
|
||||
}
|
||||
int PruefziffEntfernen = nummer.charAt(nummer.length() - 1);
|
||||
int PayBackNummerOhnePruefziffer = PayBackNummer.charAt(PayBackNummer.length() - 1);
|
||||
|
||||
int pruefziffer = Character.getNumericValue(PruefziffEntfernen);
|
||||
int PruefzifferBerechnet = 10 - gewichtung2 % 10;
|
||||
int pruefziffer = Character.getNumericValue(PayBackNummerOhnePruefziffer);
|
||||
int PruefzifferBerechnet = 10 - quersumme % 10;
|
||||
|
||||
System.out.println("Die Pruefziffer lautet: " + PruefzifferBerechnet);
|
||||
|
||||
|
29
src/com/company/mainAusgabe.java
Normal file
29
src/com/company/mainAusgabe.java
Normal file
@ -0,0 +1,29 @@
|
||||
package com.company;
|
||||
import java.util.Scanner;
|
||||
|
||||
public class mainAusgabe {
|
||||
|
||||
public static void main(String[] args){
|
||||
|
||||
MultiplicationQuiz mq = new MultiplicationQuiz();
|
||||
Scanner scanner = new Scanner(System.in);
|
||||
int programmEnde = 0;
|
||||
while (programmEnde == 0) {
|
||||
System.out.println("Wie ist das Ergebniss von:");
|
||||
System.out.println(mq.getExercise());
|
||||
String ergebnissEingabe = scanner.nextLine().replace("-", "");
|
||||
|
||||
if (!ergebnissEingabe.equals("x")) {
|
||||
int ergebniss = Integer.parseInt(ergebnissEingabe);
|
||||
int ergebnissRichtig = mq.getResult();
|
||||
if (ergebnissRichtig == ergebniss) {
|
||||
System.out.println("Ihr Ergebniss ist Richtig");
|
||||
} else {
|
||||
System.out.println("Ihr Ergebniss ist falsch. Die richtige Lösung wäre: " + ergebnissRichtig);
|
||||
}
|
||||
}else{
|
||||
programmEnde = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user