-
Notifications
You must be signed in to change notification settings - Fork 0
/
ConstructionCompanyProgram
56 lines (47 loc) · 1.77 KB
/
ConstructionCompanyProgram
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
## Assignment: Project 01.
## Nicolas Sims ([email protected])
## 09.14.2015.01
## Purpose: Design the logic for a program for the River Falls Homes Construction Company.
use 5.14.1;
use warnings;
my ($lotNumber, $numberBedrooms, $numberBathrooms, $numberCars, $totalCost);
use constant BASE_PRICE => 50000;
use constant BED_PRICE => 17000;
use constant BATH_PRICE => 12500;
use constant CAR_PRICE => 6000;
sub main {
setLotNumber();
setNumberBedrooms();
setNumberBathrooms();
setNumberCars();
setTotalCost();
}
main();
sub setLotNumber {
print "\nWelcome to the River Falls Homes Construction Company Lot Design Terminal. \nTo start off, would you please enter which lot number you are interested in? \n\n";
chomp ($lotNumber = <STDIN>);
print "\nThank you. \n";
}
sub setNumberBedrooms {
print "\nNext, would you please enter how many bedrooms you require in your house? \n\n";
chomp ($numberBedrooms = <STDIN>);
print "\nThank you. \n";
}
sub setNumberBathrooms {
print "\nNext, would you please enter how many bathrooms you require in your house? \n\n";
chomp ($numberBathrooms = <STDIN>);
print "\nThank you. \n";
}
sub setNumberCars {
print "\nNext, would you please enter how many cars you require to fit in your garage? \n\n";
chomp ($numberCars = <STDIN>);
print "\nThank you. \n";
}
sub setTotalCost {
my ($bedPrice, $bathPrice, $carPrice);
$bedPrice = $numberBedrooms * BED_PRICE;
$bathPrice = $numberBathrooms * BATH_PRICE;
$carPrice = $numberCars * CAR_PRICE;
$totalCost = $bathPrice + $bedPrice + $carPrice + BASE_PRICE;
print "\nYour new home will be on lot number $lotNumber. \nThe total cost of your new home will be \$$totalCost. Thank you, and come again! \n\n";
}