calculateprice 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/CalculatePrice.rb +31 -0
- metadata +43 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 635c5050d859d8ef63aff65ea3b02303efaf4c52b0e30d2a7f70fa17b2b9fc3f
|
4
|
+
data.tar.gz: 654f2025aa2ee18383e85fc539703460d34de867883165c0371fde3a22b81013
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: eaf8549c6ec915f9ea4119a4a0f3030d34859faeeaf0c9c8bccdadecb5b5edb0636caa429ad04ed45b1e23b8daa861fbfa26c78539574f891d6a4b5a0b4ca8c9
|
7
|
+
data.tar.gz: a9115f00cebbc26f8715b853c6aa69476c965477dc0ce159609300338818b740b4b20b9952c005d01d5ebc55554422d3d52518bf1d9f47e062acd15a7c69a509
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'singleton'
|
2
|
+
|
3
|
+
class CalculatePrice
|
4
|
+
include Singleton
|
5
|
+
|
6
|
+
def self.calculate_price(lot, duration)
|
7
|
+
|
8
|
+
if lot == "basketball"
|
9
|
+
hourlyRate = 12
|
10
|
+
elsif lot == "football"
|
11
|
+
hourlyRate = 10
|
12
|
+
elsif lot == "squash"
|
13
|
+
hourlyRate = 9
|
14
|
+
elsif lot == "tennis"
|
15
|
+
hourlyRate = 7.5
|
16
|
+
elsif lot == "golf"
|
17
|
+
hourlyRate = 10
|
18
|
+
elsif lot == "gym"
|
19
|
+
hourlyRate = 6.5
|
20
|
+
elsif lot == "swimming pool"
|
21
|
+
hourlyRate = 5
|
22
|
+
end
|
23
|
+
|
24
|
+
finalPrice = duration*hourlyRate
|
25
|
+
|
26
|
+
return finalPrice
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
metadata
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: calculateprice
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- rostifur23
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-03-29 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: A simple gem
|
14
|
+
email: ross.delaney23@gmail.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/CalculatePrice.rb
|
20
|
+
homepage: http://rubygems.org/gems/calculateprice
|
21
|
+
licenses: []
|
22
|
+
metadata: {}
|
23
|
+
post_install_message:
|
24
|
+
rdoc_options: []
|
25
|
+
require_paths:
|
26
|
+
- lib
|
27
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
28
|
+
requirements:
|
29
|
+
- - ">="
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: '0'
|
32
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
33
|
+
requirements:
|
34
|
+
- - ">="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '0'
|
37
|
+
requirements: []
|
38
|
+
rubyforge_project:
|
39
|
+
rubygems_version: 2.7.6
|
40
|
+
signing_key:
|
41
|
+
specification_version: 4
|
42
|
+
summary: Calculates the price of a booking in a sports facility
|
43
|
+
test_files: []
|