Advertisement
jbonanno

house and car

Oct 1st, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.93 KB | None | 0 0
  1. #!/usr/local/bin/perl
  2. #Numeric values are assigned to the variables to represent the costs of a car, home, and the total money.
  3. $house = 150000;
  4. $car = 15000;
  5. $totalmoney = 300000;
  6. print "";
  7.  
  8. #Calculates and prints the total cost of the car and home.
  9. $total = $house + $car;
  10. print 'The cost of the house and car together is:$'. $total . "\n";
  11.  
  12. #Calculates and prints the amount of money left after the car and home is bought.
  13. $total = $totalmoney - $house - $car;
  14. print 'After you buy a house and car you have this much money left:$' . $total . "\n";
  15.  
  16. #Calculates and prints the number of cars you're able to buy with the money available.  
  17. $total = $totalmoney/$car;
  18. print 'You can have this many cars with your money:' . $total . "\n";
  19.  
  20. #Calculates and prints the number of homes you're able to buy with the money available.
  21. $total = $totalmoney/$house;
  22. print 'You can have this many homes with your money:' . $total . "\n";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement