-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProduto.py
More file actions
32 lines (32 loc) · 905 Bytes
/
Copy pathProduto.py
File metadata and controls
32 lines (32 loc) · 905 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
#3)
class Produto:
#a)
def _init_(self, codigo, descricao, qtd, preco):
self.codigo = codigo
self.descricao = descricao
self.qtd = qtd
self.preco = preco
print("Inicialização pelo construtor")
#b)
def mostrar(self):
print("Codigo: %d" % self.codigo)
print("Descrição: %s" % self.descricao)
print("Quantidade: %d" % self.qtd)
print("Preço: %.2f" % self.preco)
#c)
def totall(self):
print("=")*30
return self.qtd * self.preco
#d)
print("=" *30)
cod = int(input("Digite o código: "))
print("=" *30)
desc = input("Digite a descrição: ")
print("=" *30)
qtd = int(input("Digitte a quantidade: "))
print("=" *30)
preco = float(input("Digite o preço: "))
print("=" *30)
prod = Produto(cod, desc, qtd, preco)
prod.mostrar()
print("Total: %.2f" % prod.totall())