Skip to content

Instantly share code, notes, and snippets.

@folivetti
Created February 17, 2017 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save folivetti/0a1f6b301ae13814c2a4b33995a89436 to your computer and use it in GitHub Desktop.
Save folivetti/0a1f6b301ae13814c2a4b33995a89436 to your computer and use it in GitHub Desktop.
import java.io.IOException;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws IOException {
int cod1, cod2;
int unidades1, unidades2;
double custo1, custo2, total;
Scanner sc = new Scanner(System.in);
cod1 = sc.nextInt();
unidades1 = sc.nextInt();
custo1 = sc.nextDouble();
cod2 = sc.nextInt();
unidades2 = sc.nextInt();
custo2 = sc.nextDouble();
total = unidades1*custo1 + unidades2*custo2;
System.out.printf("VALOR A PAGAR: R$ %.2f\n", total);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment