Advertisement
Guest User

Untitled

a guest
Nov 15th, 2019
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.68 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Rechner {
  4.  
  5. public static void main(String[] args) {
  6.  
  7. int tabelle[][] = new int [4][15];
  8. int gesamtproduktionMet=0, gesamtproduktionKris=0, gesamtproduktionDeut=0, maximaltemperatur, stundenPunkte, tagesPunkte;
  9.  
  10. System.out.println("Anzahl der Planeten eingeben: ");
  11.  
  12. Scanner eingabe = new Scanner(System.in); // Eingabe wird in Scanner eingelesen
  13.  
  14.  
  15. String anzahl = eingabe.nextLine(); // Scanner übergibt Eingabe an String
  16. int planetenanzahl = Integer.parseInt(anzahl); // String wird in Integervariable umgewandelt
  17.  
  18. System.out.println("Spielgeschwindigkeit eingeben: ");
  19.  
  20. String spielgeschwindigkeit = eingabe.nextLine(); // Scanner übergibt Eingabe an String
  21. int geschwindigkeit = Integer.parseInt(spielgeschwindigkeit); // String wird in Integervariable umgewandelt
  22.  
  23. int n = 0;
  24.  
  25. for(int i=0; i < planetenanzahl; i++){ // Schleife fragt für alle Planeten Minen und
  26. // Temperatur ab und schreibt sie ins Array
  27.  
  28. System.out.println("Planet " + (i+1) + ":");
  29. System.out.println("Metallmine:");
  30.  
  31. String umstaendlich = eingabe.nextLine(); // Scanner übergibt Eingabe an String
  32. tabelle[0][n] = Integer.parseInt(umstaendlich); // String wird in Integervariable umgewandelt
  33.  
  34.  
  35. System.out.println("Kristallmine:");
  36. String umstaendlicher = eingabe.nextLine(); // Scanner übergibt Eingabe an String
  37. tabelle[1][n] = Integer.parseInt(umstaendlicher); // String wird in Integervariable umgewandelt
  38.  
  39.  
  40. System.out.println("Deuteriumsynthetisierer:");
  41. String amUmstaendlichsten = eingabe.nextLine(); // Bla bla bla
  42. tabelle[2][n] = Integer.parseInt(amUmstaendlichsten); // Bla bla bla
  43.  
  44.  
  45. System.out.println("Temperatur:");
  46. String nochVieeelUmstaendlicher = eingabe.nextLine(); // Bla bla bla
  47. tabelle[3][n] = Integer.parseInt(nochVieeelUmstaendlicher); // Bla bla bla
  48.  
  49. n++;
  50.  
  51. }
  52.  
  53.  
  54. for(int i=n; i != 0; i--){ // Entnimmt die Minenstufen aus dem Array, legt Objekte für bis zu 15 Planeten an, fragt die Produktionsmengen der Objekte ab und übergibt diese an die Gesamtproduktion.
  55.  
  56. if(n==1) {
  57. Planet planet01;
  58. planet01 = new Planet(n, tabelle[0][n-1], tabelle[1][n-1], tabelle[2][n-1], tabelle[3][n-1]);
  59. gesamtproduktionMet = gesamtproduktionMet + planet01.produktionMet();
  60. gesamtproduktionKris = gesamtproduktionKris + planet01.produktionKris();
  61. gesamtproduktionDeut = gesamtproduktionDeut + planet01.produktionDeut();
  62. }
  63.  
  64. else if(n==2) {
  65. Planet planet02;
  66. planet02 = new Planet(n, tabelle[0][n-1], tabelle[1][n-1], tabelle[2][n-1], tabelle[3][n-1]);
  67. gesamtproduktionMet = gesamtproduktionMet + planet02.produktionMet();
  68. gesamtproduktionKris = gesamtproduktionKris + planet02.produktionKris();
  69. gesamtproduktionDeut = gesamtproduktionDeut + planet02.produktionDeut();
  70. }
  71.  
  72. else if(n==3) {
  73. Planet planet03;
  74. planet03 = new Planet(n, tabelle[0][n-1], tabelle[1][n-1], tabelle[2][n-1], tabelle[3][n-1]);
  75. gesamtproduktionMet = gesamtproduktionMet + planet03.produktionMet();
  76. gesamtproduktionKris = gesamtproduktionKris + planet03.produktionKris();
  77. gesamtproduktionDeut = gesamtproduktionDeut + planet03.produktionDeut();
  78. }
  79.  
  80. else if(n==4) {
  81. Planet planet04;
  82. planet04 = new Planet(n, tabelle[0][n-1], tabelle[1][n-1], tabelle[2][n-1], tabelle[3][n-1]);
  83. gesamtproduktionMet = gesamtproduktionMet + planet04.produktionMet();
  84. gesamtproduktionKris = gesamtproduktionKris + planet04.produktionKris();
  85. gesamtproduktionDeut = gesamtproduktionDeut + planet04.produktionDeut();
  86. }
  87.  
  88. else if(n==5) {
  89. Planet planet05;
  90. planet05 = new Planet(n, tabelle[0][n-1], tabelle[1][n-1], tabelle[2][n-1], tabelle[3][n-1]);
  91. gesamtproduktionMet = gesamtproduktionMet + planet05.produktionMet();
  92. gesamtproduktionKris = gesamtproduktionKris + planet05.produktionKris();
  93. gesamtproduktionDeut = gesamtproduktionDeut + planet05.produktionDeut();
  94. }
  95.  
  96. else if(n==6) {
  97. Planet planet06;
  98. planet06 = new Planet(n, tabelle[0][n-1], tabelle[1][n-1], tabelle[2][n-1], tabelle[3][n-1]);
  99. gesamtproduktionMet = gesamtproduktionMet + planet06.produktionMet();
  100. gesamtproduktionKris = gesamtproduktionKris + planet06.produktionKris();
  101. gesamtproduktionDeut = gesamtproduktionDeut + planet06.produktionDeut();
  102. }
  103.  
  104. else if(n==7) {
  105. Planet planet07;
  106. planet07 = new Planet(n, tabelle[0][n-1], tabelle[1][n-1], tabelle[2][n-1], tabelle[3][n-1]);
  107. gesamtproduktionMet = gesamtproduktionMet + planet07.produktionMet();
  108. gesamtproduktionKris = gesamtproduktionKris + planet07.produktionKris();
  109. gesamtproduktionDeut = gesamtproduktionDeut + planet07.produktionDeut();
  110. }
  111.  
  112. else if(n==8) {
  113. Planet planet08;
  114. planet08 = new Planet(n, tabelle[0][n-1], tabelle[1][n-1], tabelle[2][n-1], tabelle[3][n-1]);
  115. gesamtproduktionMet = gesamtproduktionMet + planet08.produktionMet();
  116. gesamtproduktionKris = gesamtproduktionKris + planet08.produktionKris();
  117. gesamtproduktionDeut = gesamtproduktionDeut + planet08.produktionDeut();
  118. }
  119.  
  120. else if(n==9) {
  121. Planet planet09;
  122. planet09 = new Planet(n, tabelle[0][n-1], tabelle[1][n-1], tabelle[2][n-1], tabelle[3][n-1]);
  123. gesamtproduktionMet = gesamtproduktionMet + planet09.produktionMet();
  124. gesamtproduktionKris = gesamtproduktionKris + planet09.produktionKris();
  125. gesamtproduktionDeut = gesamtproduktionDeut + planet09.produktionDeut();
  126. }
  127.  
  128. else if(n==10) {
  129. Planet planet10;
  130. planet10 = new Planet(n, tabelle[0][n-1], tabelle[1][n-1], tabelle[2][n-1], tabelle[3][n-1]);
  131. gesamtproduktionMet = gesamtproduktionMet + planet10.produktionMet();
  132. gesamtproduktionKris = gesamtproduktionKris + planet10.produktionKris();
  133. gesamtproduktionDeut = gesamtproduktionDeut + planet10.produktionDeut();
  134. }
  135.  
  136. else if(n==11) {
  137. Planet planet11;
  138. planet11 = new Planet(n, tabelle[0][n-1], tabelle[1][n-1], tabelle[2][n-1], tabelle[3][n-1]);
  139. gesamtproduktionMet = gesamtproduktionMet + planet11.produktionMet();
  140. gesamtproduktionKris = gesamtproduktionKris + planet11.produktionKris();
  141. gesamtproduktionDeut = gesamtproduktionDeut + planet11.produktionDeut();
  142. }
  143.  
  144. else if(n==12) {
  145. Planet planet12;
  146. planet12 = new Planet(n, tabelle[0][n-1], tabelle[1][n-1], tabelle[2][n-1], tabelle[3][n-1]);
  147. gesamtproduktionMet = gesamtproduktionMet + planet12.produktionMet();
  148. gesamtproduktionKris = gesamtproduktionKris + planet12.produktionKris();
  149. gesamtproduktionDeut = gesamtproduktionDeut + planet12.produktionDeut();
  150. }
  151.  
  152. else if(n==13) {
  153. Planet planet13;
  154. planet13 = new Planet(n, tabelle[0][n-1], tabelle[1][n-1], tabelle[2][n-1], tabelle[3][n-1]);
  155. gesamtproduktionMet = gesamtproduktionMet + planet13.produktionMet();
  156. gesamtproduktionKris = gesamtproduktionKris + planet13.produktionKris();
  157. gesamtproduktionDeut = gesamtproduktionDeut + planet13.produktionDeut();
  158. }
  159.  
  160. else if(n==14) {
  161. Planet planet14;
  162. planet14 = new Planet(n, tabelle[0][n-1], tabelle[1][n-1], tabelle[2][n-1], tabelle[3][n-1]);
  163. gesamtproduktionMet = gesamtproduktionMet + planet14.produktionMet();
  164. gesamtproduktionKris = gesamtproduktionKris + planet14.produktionKris();
  165. gesamtproduktionDeut = gesamtproduktionDeut + planet14.produktionDeut();
  166. }
  167.  
  168. else if(n==15) {
  169. Planet planet15;
  170. planet15 = new Planet(n, tabelle[0][n-1], tabelle[1][n-1], tabelle[2][n-1], tabelle[3][n-1]);
  171. gesamtproduktionMet = gesamtproduktionMet + planet15.produktionMet();
  172. gesamtproduktionKris = gesamtproduktionKris + planet15.produktionKris();
  173. gesamtproduktionDeut = gesamtproduktionDeut + planet15.produktionDeut();
  174. }
  175.  
  176. n--;
  177.  
  178. }
  179.  
  180.  
  181. stundenPunkte = ((gesamtproduktionMet + gesamtproduktionKris + gesamtproduktionDeut)*geschwindigkeit);
  182. tagesPunkte = stundenPunkte * 24;
  183.  
  184.  
  185. System.out.println("Die Gesamtproduktion pro Stunde beträgt: " + (gesamtproduktionMet)*geschwindigkeit + " Metall, " + (gesamtproduktionKris)*geschwindigkeit + " Kristall und " + (gesamtproduktionDeut)*geschwindigkeit + " Deuterium.");
  186.  
  187. System.out.println("Entspricht "+ (stundenPunkte / 1000) + " Punkten.");
  188.  
  189. System.out.println("Die Gesamtproduktion pro Tag beträgt: " + (((gesamtproduktionMet)*geschwindigkeit) * 24) + " Metall, " + ((gesamtproduktionKris)*geschwindigkeit) * 24 + " Kristall und " + ((gesamtproduktionDeut)*geschwindigkeit) * 24 + " Deuterium.");
  190.  
  191. System.out.println("Entspricht "+ (tagesPunkte / 1000) + " Punkten.");
  192.  
  193. }
  194.  
  195. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement