Advertisement
Guest User

Untitled

a guest
Jul 19th, 2018
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. #!/usr/bin/perl
  2.  
  3. use strict;
  4.  
  5. print "What's your retirement goal number?\n";
  6. my $retirement_goal = <stdin>;
  7.  
  8. print "What's your net worth?\n";
  9. my $net_worth = <STDIN>;
  10.  
  11. print "How many years untl you retire?\n";
  12. my $years_until_retirement = <STDIN>;
  13.  
  14. my $daily_amount = $retirement_goal / 365;
  15.  
  16. print "You have " . int($net_worth / $daily_amount) . " days of retirement covered\n";
  17. print "Or " . int(($net_worth * .04) / 365) . " dollars a day to spend if you retired today\n";
  18. print "Every " . int($daily_amount / (1 + .07)**$years_until_retirement) . " dollars deposited today gets you another day of retirement assuming 7% interest\n";
  19. print "Every " . int($daily_amount / (1 + .15)**$years_until_retirement) . " dollars deposited today gets you another day of retirement assuming 15% interest\n";
  20. print "Or " . int(($daily_amount / (1 + .07)**$years_until_retirement) / 24) . " dollars deposited gets you another hour\n";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement