1
0

rename percentage -> totalPercentage

This commit is contained in:
Joel Baldauf
2020-12-08 14:03:27 +01:00
parent 77a51eb28b
commit f99dc5e78a
+7 -10
View File
@@ -1,14 +1,11 @@
import java.util.Scanner; import java.util.Scanner;
public class PunkteInNoten { public class PunkteInNoten {
// Array mit den IHK-Noten als Konstante. Das jeweilige Arrayfeld entspricht der Prozentanzahl // Array mit den IHK-Noten als Konstante. Das jeweilige Arrayfeld entspricht der Prozentanzahl
public static final double marksIHK[] = {6.0,6.0,6.0,6.0,6.0,6.0,5.9,5.9,5.9,5.9,5.9,5.9,5.8,5.8,5.8,5.8,5.8,5.7,5.7,5.7,5.7,5.7,5.7,5.6,5.6,5.6,5.6,5.6,5.6,5.5,5.4,5.4,5.3,5.3,5.2,5.2,5.1,5.1,5.0,5.0,5.0,4.9,4.9,4.8,4.8,4.7,4.7,4.6,4.6,4.5,4.4,4.4,4.3,4.3,4.2,4.1,4.1,4.0,4.0,3.9,3.9,3.8,3.7,3.7,3.6,3.6,3.5,3.4,3.3,3.3,3.2,3.1,3.1,3.0,2.9,2.9,2.8,2.7,2.7,2.6,2.5,2.4,2.3,2.2,2.1,2.0,2.0,1.9,1.8,1.7,1.6,1.5,1.4,1.4,1.3,1.3,1.2,1.2,1.1,1.1,1.0}; public static final double marksIHK[] = {6.0,6.0,6.0,6.0,6.0,6.0,5.9,5.9,5.9,5.9,5.9,5.9,5.8,5.8,5.8,5.8,5.8,5.7,5.7,5.7,5.7,5.7,5.7,5.6,5.6,5.6,5.6,5.6,5.6,5.5,5.4,5.4,5.3,5.3,5.2,5.2,5.1,5.1,5.0,5.0,5.0,4.9,4.9,4.8,4.8,4.7,4.7,4.6,4.6,4.5,4.4,4.4,4.3,4.3,4.2,4.1,4.1,4.0,4.0,3.9,3.9,3.8,3.7,3.7,3.6,3.6,3.5,3.4,3.3,3.3,3.2,3.1,3.1,3.0,2.9,2.9,2.8,2.7,2.7,2.6,2.5,2.4,2.3,2.2,2.1,2.0,2.0,1.9,1.8,1.7,1.6,1.5,1.4,1.4,1.3,1.3,1.2,1.2,1.1,1.1,1.0};
public static void main(String[] args) { public static void main(String[] args) {
double pointPercentage = 0; int pointPercentage = 0;
double markIHK = 0.0; double markIHK = 0.0;
// Scanner für Tastatureingaben // Scanner für Tastatureingaben
Scanner keyboard = new Scanner (System.in); Scanner keyboard = new Scanner (System.in);
@@ -17,16 +14,16 @@ public class PunkteInNoten {
System.out.print("maximale Punktanzahl: "); System.out.print("maximale Punktanzahl: ");
int maxPoints = keyboard.nextInt(); int maxPoints = keyboard.nextInt();
System.out.print("Wievielen Prozenten sollen die Punkte entsprechen?: "); System.out.print("Wievielen Prozenten sollen die Punkte entsprechen?: ");
int percentage = keyboard.nextInt(); int totalPercentage = keyboard.nextInt();
//For-Schleife für die Anzahl der Punkte //For-Schleife für die Anzahl der Punkte
for (int point=maxPoints; point>=0; point--) { for (int point=maxPoints; point>=0; point--) {
pointPercentage = ((double)point/(double)maxPoints)*(double)percentage; pointPercentage = (int) (((double)point/(double)maxPoints)*(double)totalPercentage);
markIHK = marksIHK[(int)pointPercentage]; markIHK = marksIHK[pointPercentage];
if (percentage == 100) if (totalPercentage == 100)
System.out.printf("%d Punkte %.0f%% -> IHK-Note %.1f -> ganze Note %.0f \n", point, pointPercentage, markIHK, markIHK); System.out.printf("%d Punkte %d%% -> IHK-Note %.1f -> ganze Note %.0f \n", point, pointPercentage, markIHK, markIHK);
else else
System.out.printf("%d Punkte %.0f%%\n", point, pointPercentage); System.out.printf("%d Punkte %d%%\n", point, pointPercentage);
} }
} }