Advertisement
Guest User

Untitled

a guest
Feb 3rd, 2019
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1.  
  2. public class Obstkorb {
  3.  
  4. public Obstkorb(int anzahlObstsorten) {
  5. //Hier leg ich die anzahl der Früchte an die die jeweilige Obstsorte hat
  6. int[] arrayobstsorten = {anzahlObstsorten};
  7. for(int i = 0; i<arrayobstsorten.length-1; i++) {
  8. arrayobstsorten[i] = anzahlObstsorten -i;
  9. }
  10. //Hier leg ich den Preis fest für die jewelige Obstsorte
  11. int[] obstsortenpreis = {anzahlObstsorten};
  12. for(int j = 0; j<obstsortenpreis.length -1; j++) {
  13. if(j == 0) {
  14. obstsortenpreis[j] = (anzahlObstsorten - j) * 1;
  15. }
  16. obstsortenpreis[j] = (anzahlObstsorten - j) * j;
  17. }
  18. }
  19.  
  20.  
  21. public static int verkaufe(int sorte, int anzahl) {
  22. arrayobstsorten[sorte-1] = arrayobstsorten[sorte-1] - anzahl;
  23.  
  24.  
  25. }
  26.  
  27. public static int neuerPreis(int sorte, int preis) {
  28.  
  29.  
  30. }
  31.  
  32. public static void printUmsatz() {
  33.  
  34. }
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41. public static void main(String[]args) {
  42. Obstkorb k = new Obstkorb(20);
  43. }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement