Last active
September 1, 2022 19:20
-
-
Save renan778/a9104d54ac63240ba5d3c37a2c820952 to your computer and use it in GitHub Desktop.
Calculos (Logica de Programação - Java)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Locale; | |
import java.util.Scanner; | |
public class calculos { | |
public static void main(String[] args){ | |
Locale.setDefault(Locale.us); | |
Scanner sc = new Scanner(System.in); | |
double width = sc.nextDouble(); | |
double length = sc.nextDouble(); | |
double squareMeter = sc.nextDouble(); | |
double size = width * length; | |
double price = size * squareMeter; | |
System.out.printf("The land area is %.2fm, the price of the land is R$%.2f%n", size, price); | |
sc.close(); | |
} | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Locale; | |
import java.util.Scanner; | |
public class Exerc2 { | |
public static void main(String[] args){ | |
Locale.setDefault(Locale.US); | |
double pi = 3.14159; | |
System.out.println("Qual seria o Raio do círculo ?"); | |
Scanner sc = new Scanner(System.in); | |
double raio = sc.nextDouble(); | |
double area = pi * Math.pow(raio, 2); | |
System.out.printf("O raio do seu círculo é %.2f e a aréa do círculo é %.4f%n", raio, area); | |
sc.close(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Locale; | |
import java.util.Scanner; | |
public class Exerc3 { | |
public static void main(String[] args){ | |
Locale.setDefault(Locale.US); | |
System.out.println("Logo abaixo coloque 4 valores inteiros para saber a diferença =) "); | |
Scanner sc = new Scanner(System.in); | |
int a = sc.nextInt(); | |
int b = sc.nextInt(); | |
int c = sc.nextInt(); | |
int d = sc.nextInt(); | |
int calculo = a * b - c * d; | |
System.out.printf("A diferença entre os valores é de %d%n", calculo); | |
sc.close(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Locale; | |
import java.util.Scanner; | |
public class Exerc4 { | |
public static void main(String[] args){ | |
Locale.setDefault(Locale.US); | |
Scanner sc = new Scanner(System.in); | |
System.out.println("Qual seu ID - "); | |
int id = sc.nextInt(); | |
System.out.println("Quantas horas você trabalha - "); | |
double ht = sc.nextDouble(); | |
System.out.println("Quanto vale sua hora trabalhada - "); | |
double ct = sc.nextDouble(); | |
double salario = ht * ct; | |
System.out.println("ID - " + id); | |
System.out.println("HORAS TRABALHADAS - " + ht); | |
System.out.printf("Seu ID é %d e o seu salário é de R$%.2f%n", id, salario); | |
sc.close(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Locale; | |
import java.util.Scanner; | |
public class Exerc5 { | |
public static void main(String[] args){ | |
Locale.setDefault(Locale.US); | |
Scanner sc = new Scanner(System.in); | |
System.out.println("ID da peça 1 - "); | |
int id1 = sc.nextInt(); | |
System.out.println("Numero da peça 1 - "); | |
int num1 = sc.nextInt(); | |
System.out.println("Valor de cada peça R$"); | |
double unitario1 = sc.nextDouble(); | |
System.out.println("ID da peça 2 - "); | |
int id2 = sc.nextInt(); | |
System.out.println("Numero da peça 2 - "); | |
int num2 = sc.nextInt(); | |
System.out.println("Valor de cada peça R$"); | |
double unitario2 = sc.nextDouble(); | |
double teste = num1 * unitario1; | |
double teste2 = num2 * unitario2; | |
double soma = teste + teste2; | |
System.out.printf("O valor a se pagar no produto é de R$%.2f%n", soma); | |
sc.close(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment