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

Featured 250314 #7

Merged
merged 2 commits into from
Mar 14, 2025
Merged
Changes from all 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
6 changes: 6 additions & 0 deletions bankAccount/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>
1 change: 1 addition & 0 deletions bankAccount/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/bin/
17 changes: 17 additions & 0 deletions bankAccount/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>bankAccount</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
8 changes: 8 additions & 0 deletions bankAccount/src/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
*
*/
/**
*
*/
module bankAccount {
}
61 changes: 61 additions & 0 deletions bankAccount/src/program/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
package program;

import java.util.Locale;
import java.util.Scanner;

import utils.Program;

public class Main {

public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

Locale.setDefault(Locale.US);

Program program = new Program();

System.out.println("Enter account number: ");
program.setAccountNumber(sc.nextInt());

sc.nextLine(); //Limpa o buffer

System.out.println("Digite o seu nome: ")
;
program.setAccountName(sc.nextLine());

System.out.println("Quer fazer o depósito inicial (yes/no)?");
String accountQuestion = sc.nextLine();

if(accountQuestion.equals("yes")) {
System.out.println("Digite o depósito inicial: ");
program.setAccountValue(sc.nextDouble());

} else {
System.out.println("Você optou por não fazer o depósito inicial");

}


System.out.println("Account dat"
+ "a: ");
System.out.println("Account " + program.getAccountNumber() + " Holder: " + program.getAccountName() + ", Balance: $" + program.getAccountInicialDeposit());

System.out.println("Enter a deposit value: ");
program.setAccountDeposit(sc.nextDouble());

System.out.println("Updated account data: ");
System.out.println("Account " + program.getAccountNumber() + " Holder: " + program.getAccountName() + ", Balance: $" + program.AccountDepositValue());

System.out.println("Enter a withdraw value: ");
program.setAccountWithdraw(sc.nextDouble());

System.out.println("Updated account data: ");
System.out.println("Account " + program.getAccountNumber() + " Holder: " + program.getAccountName() + ", Balance: $" + program.AccountWithdrawValue());


sc.close();

}

}
82 changes: 82 additions & 0 deletions bankAccount/src/utils/Program.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
package utils;

public class Program {

private int accountNumber;
private String accountName;
private double setAccountValue;
private double accountDeposit;
private double accountWithdraw;

// CONSTRUCTOR
public Program() {
}

public Program(int accountNumber, String accountName, double setAccountValue, double accountDeposit,
double accountWithdraw) {
super();
this.accountNumber = accountNumber;
this.accountName = accountName;
this.setAccountValue = setAccountValue;
this.accountDeposit = accountDeposit;
this.accountWithdraw = accountWithdraw;
}

// GETTER AND SETTER

public int getAccountNumber() {
return accountNumber;
}

public void setAccountNumber(int accountNumber) {
this.accountNumber = accountNumber;
}

public String getAccountName() {
return accountName;
}

public void setAccountName(String accountName) {
this.accountName = accountName;
}

public double getAccountInicialDeposit() {
return setAccountValue;
}

public void setAccountValue(double setAccountValue) {
this.setAccountValue = setAccountValue;
}

public double getAccountDeposit() {
return accountDeposit;
}

public void setAccountDeposit(double accountDepoist) {
this.accountDeposit = accountDepoist;
}

public double getAccountWithdraw() {
return accountWithdraw;
}

public void setAccountWithdraw(double accountWithdraw) {
this.accountWithdraw = accountWithdraw;
}

// FUNCTIONS
public double AccountDepositValue() {
return this.setAccountValue + accountDeposit;
}

public double AccountWithdrawValue() {
return AccountDepositValue() - accountWithdraw - 5;
}







}
6 changes: 6 additions & 0 deletions bankAcoount_v2/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>
1 change: 1 addition & 0 deletions bankAcoount_v2/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/bin/
17 changes: 17 additions & 0 deletions bankAcoount_v2/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>bankAcoount_v2</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
64 changes: 64 additions & 0 deletions bankAcoount_v2/src/application/Program.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
package application;

import java.util.Locale;
import java.util.Scanner;

import entities.Account;

public class Program {

public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
Locale.setDefault(Locale.US);

Account account;

System.out.println("Enter account number: ");
int number = sc.nextInt();

System.out.println("Enter account name: ");
sc.nextLine();
String holder = sc.nextLine();

System.out.println("Is there an anitial deposit (y/n)? ");
char response = sc.next().charAt(0);

if (response == 'y') {
System.out.println("Enter initical deposit value: ");
double intialDeposit = sc.nextDouble();
account = new Account(number, holder, intialDeposit);
} else {
account = new Account(number, holder);
}

System.out.println();
System.out.println("Account data: ");
System.out.println(account);

System.out.println();
System.out.print("Enter a deposit value: ");
double depositValue = sc.nextDouble();
account.deposit(depositValue);

System.out.print("Updated account data: ");
System.out.println(account);

System.out.println();
System.out.print("Enter a withdraw value: ");
double withdrawValue = sc.nextDouble();
account.withdraw(withdrawValue);

System.out.print("Updated account data: ");
System.out.println(account);







sc.close();

}

}
60 changes: 60 additions & 0 deletions bankAcoount_v2/src/entities/Account.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package entities;

public class Account {

private int number;
private String holder;
private double balance;

// CONSTRUCTOR

public Account(int number, String holder) {
this.number = number;
this.holder = holder;
}

public Account(int number, String holder, double initialDeposit) {
this.number = number;
this.holder = holder;
deposit(initialDeposit);
}

// GETTER SETTER
public int getNumber() {
return number;
}

public String getHolder() {
return holder;
}

public void setHolder(String holder) {
this.holder = holder;
}

public double getBalance() {
return balance;
}

// FUNCIONS

public void deposit(double amount) {
balance += amount;
}

public void withdraw(double amount) {
balance -= amount + 5;
}

// TO STRING

public String toString() {
return "Account "
+ number
+ ", Holder: "
+ holder
+ ", Balance: $ "
+ String.format("%.2f", balance);
}

}
8 changes: 8 additions & 0 deletions bankAcoount_v2/src/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
*
*/
/**
*
*/
module bankAcoount_v2 {
}
7 changes: 2 additions & 5 deletions course/src/application/Program.java
Original file line number Diff line number Diff line change
@@ -16,13 +16,10 @@ public static void main(String[] args) {
System.out.println("Escreva a data do produto ");

System.out.print("Nome: ");
product.name = sc.nextLine();
product.setName(sc.nextLine());

System.out.print("Preço: ");
product.price = sc.nextDouble();

System.out.print("Quantidade no estoque: ");
product.quantity = sc.nextInt();
product.setPrice(sc.nextDouble());

System.out.println();
System.out.print("Dados do produto: " + product.toString());
41 changes: 38 additions & 3 deletions course/src/entities/Product.java
Original file line number Diff line number Diff line change
@@ -2,14 +2,49 @@

public class Product {

public String name;
public double price;
public int quantity;
private String name;
private double price;
private int quantity;

public Product() {
}

public Product(String name, double price, int quantity) {
this.name = name;
this.price = price;
this.quantity = quantity;
}

public Product(String name, double price) {
this.name = name;
this.price = price;
}

public double totalValueInStock() {
return price * quantity;
}


public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public double getPrice() {
return price;
}

public void setPrice(double price) {
this.price = price;
}

public int getQuantity() {
return quantity;
}

public void addProducts(int quantity) {
this.quantity = this.quantity + quantity;
}
6 changes: 6 additions & 0 deletions currencyDollar/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>
1 change: 1 addition & 0 deletions currencyDollar/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/bin/
17 changes: 17 additions & 0 deletions currencyDollar/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>currencyDollar</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
29 changes: 29 additions & 0 deletions currencyDollar/src/Project/main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package Project;

import java.util.Scanner;

import util.Convertor;

public class main {


public static void main(String[] args) {
Scanner sc = new Scanner(System.in);


System.out.println("Qual o valor do dollar?");
double valor = sc.nextDouble();

System.out.println("Quantos dolares vai comprar?");
double compra = sc.nextDouble();

double result = Convertor.conversor(valor, compra);
System.out.println("Valor a ser pago necessário R$" + result);




sc.close();
}

}
8 changes: 8 additions & 0 deletions currencyDollar/src/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
*
*/
/**
*
*/
module currencyDollar {
}
10 changes: 10 additions & 0 deletions currencyDollar/src/util/Convertor.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package util;

public class Convertor {
public static double IOF = 0.06;

public static double conversor(double x, double y) {
return x * y * (1.0 + IOF);
}

}
6 changes: 6 additions & 0 deletions medioEscolar/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>
1 change: 1 addition & 0 deletions medioEscolar/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/bin/
17 changes: 17 additions & 0 deletions medioEscolar/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>medioEscolar</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
44 changes: 44 additions & 0 deletions medioEscolar/src/application/Program.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package application;

import java.util.Scanner;

import entities.Notas;

public class Program {

public static void main(String[] args) {
Scanner sc = new Scanner(System.in);

Notas notas = new Notas();

System.out.println("Escreva o nome do aluno: ");
String nomeAluno = sc.nextLine();

System.out.println("Escreva a nota do primeiro trimestre (máx 30): ");
notas.primeiroTri = sc.nextInt();

System.out.println("Escreva a nota do segundo trimestre (máx 35): ");
notas.segundoTri = sc.nextInt();

System.out.println("Escreva a nota do terceiro trimestre (máx 35): ");
notas.terceiroTri = sc.nextInt();

System.out.println("Nota final = " + notas.notaTotal());

if (notas.calculoAno() == 1) {
System.out.println("Parabéns, você passou de ano!");
} else if (notas.calculoAno() == 2) {
System.out.println("Infelizmente você não passou.");
System.out.println("Faltando " + notas.calculoNotaFaltante() + " pontos");
} else {
System.out.println("Erro, tente novamente.");


}


sc.close();

}

}
25 changes: 25 additions & 0 deletions medioEscolar/src/entities/Notas.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package entities;

public class Notas {

public int primeiroTri;
public int segundoTri;
public int terceiroTri;


public int notaTotal() {
return primeiroTri + segundoTri + terceiroTri;
}

public int calculoAno() {
if(notaTotal() > 60) {
return 1;
}else {
return 2;

}
}
public int calculoNotaFaltante() {
return Math.abs(notaTotal() - 100);
}
}
8 changes: 8 additions & 0 deletions medioEscolar/src/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
*
*/
/**
*
*/
module medioEscolar {
}
30 changes: 29 additions & 1 deletion salario/src/application/Program.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,37 @@
package application;

import java.util.Locale;
import java.util.Scanner;

import entities.Calculo;

public class Program {

public static void main(String[] args) {
// TODO Auto-generated method stub
Locale.setDefault(Locale.US);
Scanner sc = new Scanner(System.in);

Calculo calculo = new Calculo();

System.out.println("Digite o nome do funcionário: ");
calculo.nameCalc = sc.nextLine();

System.out.println("Digite o salário bruto: ");
calculo.brutoCalc = sc.nextDouble();

System.out.println("Digite as taxas: ");
calculo.taxasCalc = sc.nextDouble();


System.out.println("Empregado: " + calculo.nameCalc + ", $ " + calculo.salarioLiquido());

System.out.println("Qual a porcentagem de aumento do salario?");
calculo.percentCalc = sc.nextDouble();

System.out.println("Dados atualizados: " + calculo.nameCalc + ", $ " + calculo.aumentoSalario());

sc.close();


}

15 changes: 15 additions & 0 deletions salario/src/entities/Calculo.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
package entities;

public class Calculo {

public String nameCalc;
public double brutoCalc;
public double taxasCalc;
public double percentCalc;

public double salarioLiquido() {
return brutoCalc - taxasCalc;
}

public double aumentoSalario(){
double fatorAumento = 1 + (percentCalc/100);
return salarioLiquido() * fatorAumento;
}


}