-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Desafio atualizado #4
base: main
Are you sure you want to change the base?
Changes from 4 commits
2c42dfc
c159a70
5c5915b
9e3e75a
3de67d8
64b1369
5f7aad2
5b99054
766bb1a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<module type="JAVA_MODULE" version="4"> | ||
<component name="NewModuleRootManager" inherit-compiler-output="true"> | ||
<exclude-output /> | ||
<content url="file://$MODULE_DIR$"> | ||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /> | ||
</content> | ||
<orderEntry type="inheritedJdk" /> | ||
<orderEntry type="sourceFolder" forTests="false" /> | ||
</component> | ||
</module> |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package cafes; | ||
import java.util.ArrayList; | ||
|
||
public enum Acucar { | ||
Nivel0("nenhuma"),Nivel1("pouquíssima"),Nivel2("pouca"),Nivel3("quantidade normal de"),Nivel4("muita"),Nivel5("bastante"); | ||
|
||
private String quantidadeDeAcucar; | ||
|
||
private Acucar(String quantidade){ | ||
this.quantidadeDeAcucar = quantidade; | ||
} | ||
|
||
public String getQuantidadeDeAcucar() { | ||
return this.quantidadeDeAcucar; | ||
} | ||
|
||
public static ArrayList<Acucar> getNiveisDeAcucar(){ | ||
ArrayList<Acucar> Niveis = new ArrayList<Acucar>(); | ||
|
||
Niveis.add(Nivel0); | ||
Niveis.add(Nivel1); | ||
Niveis.add(Nivel2); | ||
Niveis.add(Nivel3); | ||
Niveis.add(Nivel4); | ||
Niveis.add(Nivel5); | ||
|
||
return Niveis; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package cafes; | ||
import java.util.ArrayList; | ||
|
||
public class Bebida { | ||
private int id; | ||
private String nome; | ||
Receita receita; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
private double preco; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. legal usar a classe BigDecimal do Java para valores que precisam de precisão decimal, como monetários |
||
private static ArrayList<Bebida> menu = new ArrayList<Bebida>(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pq a bebida tem um Menu? Consegue pensar em outra classe que representaria melhor essa relação tem um menu? |
||
|
||
public Bebida(){ | ||
|
||
} | ||
|
||
public Bebida(int id, String nome, Receita receita, double preco) { | ||
this.id = id; | ||
this.nome = nome; | ||
this.receita = receita; | ||
this.preco = preco; | ||
Bebida.menu.add(this); | ||
} | ||
|
||
public static ArrayList<Bebida> getMenu() { | ||
return menu; | ||
} | ||
|
||
public String getNome() { | ||
return nome; | ||
} | ||
|
||
public int getId() { | ||
return id; | ||
} | ||
|
||
public double getPreco() { | ||
return preco; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aqui vc tbm pode usar a interface List como retorno, assim se amanhã vc precisar mudar a implementação de ArrayList para outro tipo de List, só precisará mudar em um lugar