master
tmn 4 years ago
parent 07b81120d8
commit 949eff497d

@ -6,29 +6,14 @@
<item name="ROOT" type="e8cecc67:BranchNodeDescriptor" /> <item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
<item name="LOCAL_ROOT" type="e8cecc67:BranchNodeDescriptor" /> <item name="LOCAL_ROOT" type="e8cecc67:BranchNodeDescriptor" />
</path> </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> </expand>
<select> <select />
<path>
<item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
<item name="LOCAL_ROOT" type="e8cecc67:BranchNodeDescriptor" />
<item name="BRANCH:master" type="e8cecc67:BranchNodeDescriptor" />
</path>
</select>
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="86f42963-ed9f-4d18-9c81-a4cf18fa27c4" name="Default Changelist" comment="+Jasmins Version EinkaufwagenNummer"> <list default="true" id="86f42963-ed9f-4d18-9c81-a4cf18fa27c4" name="Default Changelist" comment="test">
<change afterPath="$PROJECT_DIR$/src/com/company/BundeswehrPruefnummern.java" afterDir="false" /> <change afterPath="$PROJECT_DIR$/src/com/company/PayBack_LOL.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" 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/BundeswehrPruefnummern.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/com/company/BundeswehrPruefnummern.java" 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/EinkaufswagenNummer.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/com/company/EinkaufswagenNummer.java" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
@ -55,7 +40,7 @@
<component name="PropertiesComponent"> <component name="PropertiesComponent">
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" /> <property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
</component> </component>
<component name="RunManager" selected="Application.BundeswehrPruefnummern"> <component name="RunManager" selected="Application.EinkaufswagenNummer">
<configuration name="BundeswehrPruefnummern" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true"> <configuration name="BundeswehrPruefnummern" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="com.company.BundeswehrPruefnummern" /> <option name="MAIN_CLASS_NAME" value="com.company.BundeswehrPruefnummern" />
<module name="JAVA-Aufgaben" /> <module name="JAVA-Aufgaben" />
@ -95,10 +80,15 @@
<option name="Make" enabled="true" /> <option name="Make" enabled="true" />
</method> </method>
</configuration> </configuration>
<list>
<item itemvalue="Application.BundeswehrPruefnummern" />
<item itemvalue="Application.EinkaufswagenNummer" />
<item itemvalue="Application.EinkaufwagenNummerJasminFehler" />
</list>
<recent_temporary> <recent_temporary>
<list> <list>
<item itemvalue="Application.BundeswehrPruefnummern" />
<item itemvalue="Application.EinkaufswagenNummer" /> <item itemvalue="Application.EinkaufswagenNummer" />
<item itemvalue="Application.BundeswehrPruefnummern" />
<item itemvalue="Application.EinkaufwagenNummerJasminFehler" /> <item itemvalue="Application.EinkaufwagenNummerJasminFehler" />
</list> </list>
</recent_temporary> </recent_temporary>
@ -166,37 +156,53 @@
<option name="LAST_COMMIT_MESSAGE" value="+Jasmins Version EinkaufwagenNummer" /> <option name="LAST_COMMIT_MESSAGE" value="+Jasmins Version EinkaufwagenNummer" />
</component> </component>
<component name="WindowStateProjectService"> <component name="WindowStateProjectService">
<state width="1877" height="186" key="GridCell.Tab.0.bottom" timestamp="1605033112583"> <state x="690" y="267" key="#com.intellij.refactoring.typeMigration.ui.FailedConversionsDialog" timestamp="1605684382606">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state x="690" y="267" key="#com.intellij.refactoring.typeMigration.ui.FailedConversionsDialog/0.0.1920.1040@0.0.1920.1040" timestamp="1605684382606" />
<state width="1877" height="282" key="GridCell.Tab.0.bottom" timestamp="1605685855270">
<screen x="0" y="0" width="1920" height="1040" /> <screen x="0" y="0" width="1920" height="1040" />
</state> </state>
<state width="1877" height="282" key="GridCell.Tab.0.bottom/0.0.1920.1040/0.-1080.1920.1040@0.0.1920.1040" timestamp="1605077469838" />
<state width="1877" height="282" key="GridCell.Tab.0.bottom/0.0.1920.1040@0.0.1920.1040" timestamp="1605685855270" />
<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.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="282" key="GridCell.Tab.0.center" timestamp="1605685855270">
<screen x="0" y="0" width="1920" height="1040" /> <screen x="0" y="0" width="1920" height="1040" />
</state> </state>
<state width="1877" height="282" key="GridCell.Tab.0.center/0.0.1920.1040/0.-1080.1920.1040@0.0.1920.1040" timestamp="1605077469838" />
<state width="1877" height="282" key="GridCell.Tab.0.center/0.0.1920.1040@0.0.1920.1040" timestamp="1605685855270" />
<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.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="282" key="GridCell.Tab.0.left" timestamp="1605685855269">
<screen x="0" y="0" width="1920" height="1040" /> <screen x="0" y="0" width="1920" height="1040" />
</state> </state>
<state width="1877" height="282" key="GridCell.Tab.0.left/0.0.1920.1040/0.-1080.1920.1040@0.0.1920.1040" timestamp="1605077469837" />
<state width="1877" height="282" key="GridCell.Tab.0.left/0.0.1920.1040@0.0.1920.1040" timestamp="1605685855269" />
<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.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="282" key="GridCell.Tab.0.right" timestamp="1605685855270">
<screen x="0" y="0" width="1920" height="1040" /> <screen x="0" y="0" width="1920" height="1040" />
</state> </state>
<state width="1877" height="282" key="GridCell.Tab.0.right/0.0.1920.1040/0.-1080.1920.1040@0.0.1920.1040" timestamp="1605077469838" />
<state width="1877" height="282" key="GridCell.Tab.0.right/0.0.1920.1040@0.0.1920.1040" timestamp="1605685855270" />
<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="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"> <state width="1877" height="347" key="GridCell.Tab.1.bottom" timestamp="1605685796652">
<screen x="0" y="0" width="1920" height="1040" /> <screen x="0" y="0" width="1920" height="1040" />
</state> </state>
<state width="1877" height="347" key="GridCell.Tab.1.bottom/0.0.1920.1040@0.0.1920.1040" timestamp="1605685796652" />
<state width="1877" height="262" key="GridCell.Tab.1.bottom/3840.0.1920.1040/1920.0.1920.1040/0.0.1920.1040@0.0.1920.1040" timestamp="1605022562079" /> <state width="1877" height="262" key="GridCell.Tab.1.bottom/3840.0.1920.1040/1920.0.1920.1040/0.0.1920.1040@0.0.1920.1040" timestamp="1605022562079" />
<state width="1877" height="262" key="GridCell.Tab.1.center" timestamp="1605022562079"> <state width="1877" height="347" key="GridCell.Tab.1.center" timestamp="1605685796652">
<screen x="0" y="0" width="1920" height="1040" /> <screen x="0" y="0" width="1920" height="1040" />
</state> </state>
<state width="1877" height="347" key="GridCell.Tab.1.center/0.0.1920.1040@0.0.1920.1040" timestamp="1605685796652" />
<state width="1877" height="262" key="GridCell.Tab.1.center/3840.0.1920.1040/1920.0.1920.1040/0.0.1920.1040@0.0.1920.1040" timestamp="1605022562079" /> <state width="1877" height="262" key="GridCell.Tab.1.center/3840.0.1920.1040/1920.0.1920.1040/0.0.1920.1040@0.0.1920.1040" timestamp="1605022562079" />
<state width="1877" height="262" key="GridCell.Tab.1.left" timestamp="1605022562079"> <state width="1877" height="347" key="GridCell.Tab.1.left" timestamp="1605685796652">
<screen x="0" y="0" width="1920" height="1040" /> <screen x="0" y="0" width="1920" height="1040" />
</state> </state>
<state width="1877" height="347" key="GridCell.Tab.1.left/0.0.1920.1040@0.0.1920.1040" timestamp="1605685796652" />
<state width="1877" height="262" key="GridCell.Tab.1.left/3840.0.1920.1040/1920.0.1920.1040/0.0.1920.1040@0.0.1920.1040" timestamp="1605022562079" /> <state width="1877" height="262" key="GridCell.Tab.1.left/3840.0.1920.1040/1920.0.1920.1040/0.0.1920.1040@0.0.1920.1040" timestamp="1605022562079" />
<state width="1877" height="262" key="GridCell.Tab.1.right" timestamp="1605022562079"> <state width="1877" height="347" key="GridCell.Tab.1.right" timestamp="1605685796652">
<screen x="0" y="0" width="1920" height="1040" /> <screen x="0" y="0" width="1920" height="1040" />
</state> </state>
<state width="1877" height="347" key="GridCell.Tab.1.right/0.0.1920.1040@0.0.1920.1040" timestamp="1605685796652" />
<state width="1877" height="262" key="GridCell.Tab.1.right/3840.0.1920.1040/1920.0.1920.1040/0.0.1920.1040@0.0.1920.1040" timestamp="1605022562079" /> <state width="1877" height="262" key="GridCell.Tab.1.right/3840.0.1920.1040/1920.0.1920.1040/0.0.1920.1040@0.0.1920.1040" timestamp="1605022562079" />
<state x="686" y="240" key="RollbackChangesDialog" timestamp="1605007609774"> <state x="686" y="240" key="RollbackChangesDialog" timestamp="1605007609774">
<screen x="0" y="0" width="1920" height="1040" /> <screen x="0" y="0" width="1920" height="1040" />
@ -219,4 +225,15 @@
</state> </state>
<state x="682" y="431" key="vcs.readOnlyHandler.ReadOnlyStatusDialog/3840.0.1920.1040/1920.0.1920.1040/0.0.1920.1040@0.0.1920.1040" timestamp="1604905992254" /> <state x="682" y="431" key="vcs.readOnlyHandler.ReadOnlyStatusDialog/3840.0.1920.1040/1920.0.1920.1040/0.0.1920.1040@0.0.1920.1040" timestamp="1604905992254" />
</component> </component>
<component name="XDebuggerManager">
<breakpoint-manager>
<breakpoints>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/src/com/company/EinkaufswagenNummer.java</url>
<line>34</line>
<option name="timeStamp" value="8" />
</line-breakpoint>
</breakpoints>
</breakpoint-manager>
</component>
</project> </project>

@ -0,0 +1,75 @@
package com.company;
import java.util.Scanner;
public class PayBack_LOL {
public static void main(String[] args) {
Eingabe();
}
public static void Eingabe(){
Scanner scanner = new Scanner(System.in);
System.out.println("Bitte geben sie die Kennnummer ein: 3083423103187694");
String wagenNummer = scanner.nextLine().replace("-", "");
while (wagenNummer.length() != 16) {
System.out.println("Die Nummer muss 16 Stellen lang sein. Bitte erneut eingeben");
wagenNummer = scanner.nextLine().replace("-", "");
}
boolean korrektheit = pruefungNummer(wagenNummer);
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);
int quer, h, rest;
quer = 0;
h = gewichtung;
while (gewichtung > 0) {
rest = gewichtung % 10;
quer = quer + rest;
gewichtung = gewichtung / 10;
}
gewichtung2 = gewichtung2 + quer;
}
int PruefziffEntfernen = nummer.charAt(nummer.length() - 1);
int pruefziffer = Character.getNumericValue(PruefziffEntfernen);
int PruefzifferBerechnet = 10 - gewichtung2 % 10;
System.out.println("Die Pruefziffer lautet: " + PruefzifferBerechnet);
boolean korrektheit = false;
if (PruefzifferBerechnet != pruefziffer){
korrektheit = false;
} else {
korrektheit = true;
}
return(korrektheit);
}
public static void ausgabe(boolean korrektheit){
Scanner scanner = new Scanner(System.in);
if (korrektheit != true) {
System.out.println("Die Kennnummer ist nicht korrekt oder ungültig!");
} else {
System.out.println("Kennnummer is gültig!");
}
System.out.println("Wollen Sie eine weitere Nummer pruefen? Wenn ja bitte mit y bestätigen. Wenn nich kann das Programm mit N beendet werden.");
String weiter = scanner.nextLine().replace("-", "");
if(weiter.equals("y")) {
Eingabe();
}
}
}
Loading…
Cancel
Save