-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCotacaoReal.java
37 lines (19 loc) · 979 Bytes
/
CotacaoReal.java
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
package primeiro_projeto;
import java.util.Scanner;
import java.io.PrintStream;
import java.io.UnsupportedEncodingException;
public class CotacaoReal {
public static void main(String[] args) throws UnsupportedEncodingException {
System.setOut(new PrintStream(System.out,true,"UTF-8"));
Scanner sc = new Scanner(System.in);
System.out.println("Informe o valor da cotação do Dollar: ");
double cotacao = sc.nextDouble();
System.out.println("Informe a quantidade de dollares que deseja converter: ");
double dollar = sc.nextDouble();
sc.close();
//Processamento dos dados
double reais = dollar*cotacao;
String teste = String.format("%.2f",reais);
System.out.println("Você possui: " + dollar + " dollares, que são equivalentes a: " + teste + " reais");
}
}