Skip to content
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

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
124 changes: 124 additions & 0 deletions .idea/uiDesigner.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified out/production/DesafioMaquinaDeCafe/cafes/Acucar.class
Binary file not shown.
Binary file modified out/production/DesafioMaquinaDeCafe/cafes/Bebida.class
Binary file not shown.
Binary file modified out/production/DesafioMaquinaDeCafe/cafes/MaquinaDeCafe.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
16 changes: 15 additions & 1 deletion src/cafes/Acucar.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package cafes;
import java.util.ArrayList;

public enum Acucar {
Nivel0("nenhuma"),Nivel1("pouquíssima"),Nivel2("pouca"),Nivel3("normal"),Nivel4("muito"),Nivel5("bastante");
Nivel0("nenhuma"),Nivel1("pouquíssima"),Nivel2("pouca"),Nivel3("quantidade normal de"),Nivel4("muita"),Nivel5("bastante");

private String quantidadeDeAcucar;

Expand All @@ -12,4 +13,17 @@ private Acucar(String quantidade){
public String getQuantidadeDeAcucar() {
return this.quantidadeDeAcucar;
}

public static ArrayList<Acucar> getNiveisDeAcucar(){
ArrayList<Acucar> Niveis = new ArrayList<Acucar>();
Copy link
Collaborator

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


Niveis.add(Nivel0);
Niveis.add(Nivel1);
Niveis.add(Nivel2);
Niveis.add(Nivel3);
Niveis.add(Nivel4);
Niveis.add(Nivel5);

return Niveis;
}
}
4 changes: 2 additions & 2 deletions src/cafes/Bebida.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
public class Bebida {
private int id;
private String nome;
Receitas receita;
Receita receita;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

private double preco;
Copy link
Collaborator

Choose a reason for hiding this comment

The 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>();
Copy link
Collaborator

Choose a reason for hiding this comment

The 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, Receitas receita, double preco) {
public Bebida(int id, String nome, Receita receita, double preco) {
this.id = id;
this.nome = nome;
this.receita = receita;
Expand Down
Loading