Advertisement
Stelios_Gakis

Seminar_2/Task_7

Sep 28th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.65 KB | None | 0 0
  1. public class Task_7 {
  2.  
  3.     public static void main(String[] args) {
  4.  
  5.         Task_7 myMain = new Task_7();
  6.  
  7.         int people = 1;
  8.         int money = 0;
  9.  
  10.         System.out.printf("Step     New people      Total money shared%n");
  11.         System.out.printf("-------------------------------------------%n");
  12.  
  13.         for (int i = 0; i < 9; i++) {
  14.             int oldMoney = money;
  15.             people = myMain.people(people);
  16.             money = people + oldMoney;
  17.             System.out.printf(" %d       %d      --->      %d%n", i+1, people, money);
  18.         }
  19.     }
  20.    
  21.     private int people(int people) {
  22.        return people * 5;
  23.     }
  24.  
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement