Advertisement
Guest User

Untitled

a guest
Mar 25th, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.65 KB | None | 0 0
  1. static double mtne;
  2. static int mex;
  3. static int mer;
  4. static int mp;
  5. static int debt;
  6. static int monthspent;
  7. static int ydebt;
  8. static int total;
  9. static double interest = 0.0;
  10. static double multiple = 0.0;
  11. static int start;
  12. static int count;
  13. private static Scanner reader;
  14. public static void main (String[] args) throws java.lang.Exception
  15. {
  16. reader = new Scanner(System.in);
  17. System.out.println("Enter simple interest paid per month; eg:10");
  18. interest = reader.nextDouble();
  19. System.out.println("Enter loan duration in years; eg:10");
  20. ydebt = reader.nextInt();
  21. System.out.println("Enter multiple you are buying businesses at; eg: 2.5 or 2");
  22. multiple = reader.nextDouble();
  23. System.out.println("Enter starting amount; eg:100000");
  24. start = reader.nextInt();
  25. total = (int) (1/(interest/100)*start);
  26. System.out.println("You can buy a business at " + total);
  27. count = 0;
  28. boolean run = true;
  29. while (run) {
  30. count++;
  31. debt = (int) (total - start + ((interest/100)*(total-start)));
  32. mex = (int) (count*(debt/(ydebt*12)));
  33. mer = count*(int) ((total/multiple) / 12);
  34. mp = mer - mex;
  35. System.out.println("Monthly profit is "+mp);
  36. System.out.println("Monthly earnings is "+mer);
  37. System.out.println("Monthly expenses is "+mex);
  38. mtne = (double)start/(double)mp;
  39. System.out.println("Expansions made = "+count);
  40. System.out.println("Days till next similar expansion: "+(int)(mtne*30));
  41. System.out.println("Enter 1 to skip till next similar expansion or 2 to exit");
  42. int check = reader.nextInt();
  43. if (check == 2)
  44. run = false;
  45.  
  46.  
  47.  
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement