Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Java
Posted by: Gabriel Silva
Added: Mar 4, 2018 3:19 AM
Views: 20
Tags: no tags
  1. package javaapplication1;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class JavaApplication1 {
  6.  
  7.     public static void main(String[] args) {
  8.  
  9.         Scanner scan = new Scanner(System.in);
  10.                
  11.                 System.out.println("Informe o valor que deseja cambiar: ");
  12.                 double real = scan.nextDouble();
  13.                
  14.                 System.out.println("Informe a cotação atual do dolar: ");
  15.                 double dolar = scan.nextDouble();
  16.                
  17.                 double cambio = real / dolar;
  18.                
  19.                 System.out.println("O valor da troca é de:" + "US$ " + cambio);
  20.                
  21.         }
  22. }