Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static double mtne;
- static int mex;
- static int mer;
- static int mp;
- static int debt;
- static int monthspent;
- static int ydebt;
- static int total;
- static double interest = 0.0;
- static double multiple = 0.0;
- static int start;
- static int count;
- private static Scanner reader;
- public static void main (String[] args) throws java.lang.Exception
- {
- reader = new Scanner(System.in);
- System.out.println("Enter simple interest paid per month; eg:10");
- interest = reader.nextDouble();
- System.out.println("Enter loan duration in years; eg:10");
- ydebt = reader.nextInt();
- System.out.println("Enter multiple you are buying businesses at; eg: 2.5 or 2");
- multiple = reader.nextDouble();
- System.out.println("Enter starting amount; eg:100000");
- start = reader.nextInt();
- total = (int) (1/(interest/100)*start);
- System.out.println("You can buy a business at " + total);
- count = 0;
- boolean run = true;
- while (run) {
- count++;
- debt = (int) (total - start + ((interest/100)*(total-start)));
- mex = (int) (count*(debt/(ydebt*12)));
- mer = count*(int) ((total/multiple) / 12);
- mp = mer - mex;
- System.out.println("Monthly profit is "+mp);
- System.out.println("Monthly earnings is "+mer);
- System.out.println("Monthly expenses is "+mex);
- mtne = (double)start/(double)mp;
- System.out.println("Expansions made = "+count);
- System.out.println("Days till next similar expansion: "+(int)(mtne*30));
- System.out.println("Enter 1 to skip till next similar expansion or 2 to exit");
- int check = reader.nextInt();
- if (check == 2)
- run = false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement