-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain_exercicio.java
More file actions
74 lines (48 loc) · 2.19 KB
/
Copy pathMain_exercicio.java
File metadata and controls
74 lines (48 loc) · 2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import java.util.Scanner;
public class Main_exercicio {
public static void main(String[] args) {
// Scanner teclado = new Scanner(System.in);
// System.out.println("Digite seu nome ");
// String nome = teclado.nextLine();
//System.out.println("Digite seu Rg ou CPF: ");
//String Id = teclado.next();
//System.out.println("Digite seu telefone para contato : ");
//String tel = teclado.next();
// System.out.println("insira seu e-mail");
// String email = teclado.next();
// teclado.close();
// System.out.println("Nome:" + nome + "Cpf/RG: " + Id + "Telefone para contato: " + tel + "E-mail: " + email);
// Scanner teclado2 = new Scanner(System.in);
// System.out.print("digite o número: ");
// int numero1 = teclado2.nextInt();
// System.out.print("digite o número: ");
//int numero2 = teclado2.nextInt();
// teclado2.close();
// if (numero1 > numero2) {
// System.out.println("o maior é :" + numero1);
// } else if (numero1 < numero2) {
// System.out.println("o maior é : " + numero2);
// } else
// System.out.print("São iguais ");
Scanner teclado3= new Scanner(System.in);
System.out.print("Digite o nome do produto: ");
String name = teclado3.next();
System.out.println("quantidade no estoque: ");
int estoque= teclado3.nextInt();
System.out.print("digite o preço unitário: ");
int precos = teclado3.nextInt();
double total= estoque * precos ;
if(total > 500 ){
total = total * 0.85 ;
System.out.printf("Valor total com %s: ", total);}
else
System.out.print("o valor a ser pago é "+ total );
System.out.print("insira o valor necessário a ser pago: ");
double pagamento = teclado3.nextDouble();
teclado3.close();
if(pagamento>total) {
double troco = pagamento - total;
System.out.print("retire " + troco + "de troco ");
}
}
}