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 4 commits
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
3 changes: 3 additions & 0 deletions .idea/.gitignore

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

6 changes: 6 additions & 0 deletions .idea/misc.xml

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

8 changes: 8 additions & 0 deletions .idea/modules.xml

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

10 changes: 10 additions & 0 deletions .idea/runConfigurations.xml

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

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.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

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

11 changes: 11 additions & 0 deletions DesafioMaquinaDeCafe.iml
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>
85 changes: 0 additions & 85 deletions README.md

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
29 changes: 29 additions & 0 deletions src/cafes/Acucar.java
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>();
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;
}
}
38 changes: 38 additions & 0 deletions src/cafes/Bebida.java
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;
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, 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;
}
}
Loading