Advertisement
Guest User

main class

a guest
Mar 7th, 2014
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.02 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3.  
  4. public class PPRechner {
  5. public static void main(String[] args) {
  6.  
  7. @SuppressWarnings("resource")
  8. Scanner s = new Scanner(System.in);
  9.  
  10. int menu, tage, faktor, wochen, hauptgebaeude, kaserne, stall, werkstatt, schmiede, adelshof, markt, holzfaeller, lehmgrube, eisenmine, bauernhof, speicher, wall, holz = 0, lehm = 0, eisen = 0;
  11. double pp = 0, pp1, pp2, pp3, pp4, pp5;
  12.  
  13.  
  14. System.out.println("Willkommen beim Die Staemme Premium Punkte Rechner!");
  15. System.out.println("**************************************************");
  16. System.out.println("Tippe 1 fuer den einfachen PP -> Geld Konverter");
  17. System.out.println("Tippe 2 fuer den Feature Rechner");
  18. System.out.println("Tippe 3 fuer den -20 % Baukosten Rechner");
  19.  
  20. menu = s.nextInt();
  21. switch (menu) {
  22. /*Menu 1*/ case 1: {
  23.  
  24. System.out.println("Um wieviel Premium Punkte geht es?");
  25. pp = s.nextDouble();
  26.  
  27. pp1 = pp / 200 * 3.99;
  28. pp2 = pp / 600 * 9.99;
  29. pp3 = pp / 1500 * 19.99;
  30. pp4 = pp / 5000 * 49.99;
  31. pp5 = pp / 8500 * 79.99;
  32.  
  33. System.out.println("// " + pp + " Premium Punkte kosten:");
  34. System.out.println("// " + pp1 + " Euro bei 3,99 Euro Käufen");
  35. System.out.println("// " + pp2 + " Euro bei 9,99 Euro Käufen");
  36. System.out.println("// " + pp3 + " Euro bei 19.99 Euro Käufen");
  37. System.out.println("// " + pp4 + " Euro bei 49,99 Euro Käufen");
  38. System.out.println("// " + pp5 + " Euro bei 79,99 Euro Käufen");
  39.  
  40. break;
  41. }
  42.  
  43. /*Menu 2*/ case 2: {
  44.  
  45. System.out.println("Moechtest du den Premium-Account aktivieren?");
  46. String antwort1 = s.next();
  47. String ja = "ja";
  48.  
  49. if (antwort1.equalsIgnoreCase(ja)) {
  50.  
  51. System.out.println("Fuer welchen Zeitraum? (3, 7, 14 oder 30 Tage)?");
  52.  
  53. tage = s.nextInt();
  54. if (tage == 3) {
  55. pp+=30;
  56. } else if (tage == 7) {
  57. pp+=60;
  58. pp+=30;
  59. } else if (tage == 14) {
  60. pp+=100;
  61. } else if (tage == 30) {
  62. pp+=200;
  63. }
  64.  
  65. }
  66.  
  67. System.out.println("Moechtestest du den Farm-Assistenten aktivieren?");
  68. String antwort2 = s.next();
  69.  
  70. if (antwort2.equalsIgnoreCase(ja)) {
  71.  
  72. System.out.println("Fuer welchen Zeitraum? (7 oder 30 Tage)?");
  73.  
  74. tage = s.nextInt();
  75. if (tage==7) {
  76. pp+=10;
  77. } else if (tage == 30) {
  78. pp+=30;
  79. }
  80.  
  81. }
  82.  
  83. System.out.println("Moechtest du die +20 % schnellere Rohstoffproduktion aktivieren");
  84. String antwort3 = s.next();
  85.  
  86. if (antwort3.equalsIgnoreCase(ja)) {
  87.  
  88. System.out.println("Fuer wieviele Rohstoffquellen möchtest du dies aktivieren? (1, 2 oder 3)?");
  89.  
  90. tage = s.nextInt();
  91.  
  92. System.out.println("Fuer wieviel Wochen soll ich dir die Kosten berechnen?");
  93. wochen = s.nextInt();
  94.  
  95. faktor = tage * 40 * wochen;
  96. pp+= faktor;
  97.  
  98. }
  99. pp1 = pp / 200 * 3.99;
  100. pp2 = pp / 600 * 9.99;
  101. pp3 = pp / 1500 * 19.99;
  102. pp4 = pp / 5000 * 49.99;
  103. pp5 = pp / 8500 * 79.99;
  104.  
  105. System.out.println("Das berechnet sich auf insgesamt " + pp + " Premium Punkte. \n");
  106. System.out.println("// " + pp + " Premium Punkte kosten:");
  107. System.out.println("// " + pp1 + " Euro bei 3,99 Euro Käufen");
  108. System.out.println("// " + pp2 + " Euro bei 9,99 Euro Käufen");
  109. System.out.println("// " + pp3 + " Euro bei 19.99 Euro Käufen");
  110. System.out.println("// " + pp4 + " Euro bei 49,99 Euro Käufen");
  111. System.out.println("// " + pp5 + " Euro bei 79,99 Euro Käufen");
  112.  
  113. break;
  114. }
  115.  
  116. /*Menu 3*/ case 3: {
  117.  
  118. System.out.println("Bitte trage die Stufe des Gebaeudes auf deinem Dorf ein!");
  119. System.out.println("#######################################################");
  120.  
  121. System.out.println("Hauptgebaeude?");
  122. hauptgebaeude = s.nextInt();
  123. System.out.println("Kaserne?");
  124. kaserne = s.nextInt();
  125. System.out.println("Stall?");
  126. stall = s.nextInt();
  127. System.out.println("Werkstatt?");
  128. werkstatt = s.nextInt();
  129. System.out.println("Schmiede?");
  130. schmiede = s.nextInt();
  131. System.out.println("Adelshof?");
  132. adelshof = s.nextInt();
  133. System.out.println("Marktplatz?");
  134. markt = s.nextInt();
  135. System.out.println("Holzfaeller?");
  136. holzfaeller = s.nextInt();
  137. System.out.println("Lehmgrube?");
  138. lehmgrube = s.nextInt();
  139. System.out.println("Eisenmine?");
  140. eisenmine = s.nextInt();
  141. System.out.println("Bauernhof?");
  142. bauernhof = s.nextInt();
  143. System.out.println("Speicher?");
  144. speicher = s.nextInt();
  145. System.out.println("Wall?");
  146. wall= s.nextInt();
  147.  
  148. Menu3Ressi instanzDrei = new Menu3Ressi(hauptgebaeude, kaserne, stall, werkstatt, schmiede, adelshof, markt, holzfaeller, lehmgrube, eisenmine, bauernhof, speicher, wall, holz, lehm, eisen);
  149. System.out.println(instanzDrei.berechnung());
  150.  
  151. break;
  152. }
  153.  
  154.  
  155. default: {
  156. System.out.println("Du musst mit 1, 2 oder 3 antworten.");
  157. break;
  158. }
  159. }
  160. }
  161. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement