1
+ """9.1 – Restaurante: Crie uma classe chamada Restaurant. O método __init__() de Restaurant deve armazenar dois
2
+ atributos: restaurant_name e cuisine_type. Crie um método chamado describe_restaurant() que mostre essas duas
3
+ informações, e um método de nome open_restaurant() que exiba uma mensagem informando que o restaurante está aberto.
4
+ Crie uma instância chamada restaurant a partir de sua classe. Mostre os dois atributos individualmente e, em seguida,
5
+ chame os dois métodos. """
6
+
7
+
8
+ class Restaurant ():
9
+ def __init__ (self , restaurant_name , cuisine_type ):
10
+ self .restaurant_name = restaurant_name
11
+ self .cuisine_type = cuisine_type
12
+
13
+ def describe_restaurant (self ):
14
+ print (f'O restaurante { self .restaurant_name } possui culinária { self .cuisine_type } .' )
15
+
16
+ def open_restaurant (self ):
17
+ print ('O restaurante está aberto!' )
18
+
19
+
20
+ restaurante = Restaurant ('Amadeus' , 'Síria' )
21
+ print (restaurante .restaurant_name )
22
+ print (restaurante .cuisine_type )
23
+ restaurante .describe_restaurant ()
24
+ restaurante .open_restaurant ()
25
+
26
+ """9.2 – Três restaurantes: Comece com a classe do Exercício 9.1. Crie três instâncias diferentes da classe e chame
27
+ describe_restaurant() para cada instância. """
28
+
29
+ restaurante_matriz = Restaurant ('Baora' , 'Sul-Africana' )
30
+ restaurante_filial_01 = Restaurant ('Amon' , 'Egípcia' )
31
+ restaurante_filial_02 = Restaurant ('Zulu' , 'da Costa do Marfim' )
32
+
33
+ restaurante_matriz .describe_restaurant ()
34
+ restaurante_filial_01 .describe_restaurant ()
35
+ restaurante_filial_02 .describe_restaurant ()
36
+
37
+ """9.3 – Usuários: Crie uma classe chamada User. Crie dois atributos de nomes first_name e last_name e, então,
38
+ crie vários outros atributos normalmente armazenados em um perfil de usuário. Escreva um método de nome
39
+ describe_user() que apresente um resumo das informações do usuário. Escreva outro método chamado greet_user() que
40
+ mostre uma saudação personalizada ao usuário. Crie várias instâncias que representem diferentes usuários e chame os
41
+ dois métodos para cada usuário. """
42
+
43
+
44
+ class User ():
45
+ def __init__ (self , first_name , last_name , user_name , departament ):
46
+ self .first_name = first_name
47
+ self .last_name = last_name
48
+ self .user_name = user_name
49
+ self .departament = departament
50
+
51
+ def describe_user (self ):
52
+ print (f'{ self .first_name } { self .last_name } , seu nome de usuário é { self .user_name } e seu departa'
53
+ f'mento é { self .departament } .' )
54
+
55
+ def greet_user (self ):
56
+ print (f'Bem-vindo { self .user_name } !' )
57
+
58
+
59
+ usuario = User ('Hugo' , 'Gusmão' , 'hugonbgg' , 'Engenharia' )
60
+ print (usuario .user_name , usuario .last_name , usuario .user_name , usuario .departament )
61
+ usuario .describe_user ()
62
+ usuario .greet_user ()
0 commit comments