forked from mahays0/CSSE376Lab2-UnitTesting
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHotel.cs
More file actions
37 lines (29 loc) · 693 Bytes
/
Hotel.cs
File metadata and controls
37 lines (29 loc) · 693 Bytes
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
using System;
namespace Expedia
{
public class Hotel : Booking
{
private int numberOfNightsToRent;
#region Booking implementation
public double getBasePrice ()
{
return 45 * numberOfNightsToRent;
}
#endregion
public Hotel (int nightsToRent)
{
if(nightsToRent <= 0)
throw new ArgumentOutOfRangeException("Nights to rent must be greater than zero!");
numberOfNightsToRent = nightsToRent;
}
public override bool Equals(object obj) {
if(obj is Hotel) {
return Equals(obj as Hotel);
}
return base.Equals(obj);
}
private bool Equals(Hotel obj) {
return obj.numberOfNightsToRent.Equals(this.numberOfNightsToRent);
}
}
}