-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.rb
42 lines (34 loc) · 785 Bytes
/
main.rb
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
require './person'
require './rental'
require './book'
require './app'
class App
def initialize
@run = Library.new
end
def menu
choices = ['1 - List all book',
'2 - List all People',
'3 - Create a person',
'4 - Create a book',
'5 - Create a rental',
'6 - List all rentals for a given person id',
'7 - Exit']
choices.each { |choice| puts choice.to_s }
end
def start
puts 'Welcome to the School Library App!'
puts "\n"
puts 'Please choose an option by entering a number: '
loop do
menu
user_choose = gets.chomp.to_i
@run.choose(user_choose)
end
puts 'Thank you for using the app!'
end
end
def main
App.new.start
end
main