-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEx02.java
More file actions
34 lines (13 loc) · 737 Bytes
/
Ex02.java
File metadata and controls
34 lines (13 loc) · 737 Bytes
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
/* Lista 1- exercício 2
Faça um programa que receba a quantidade e o valor de dois produtos, no seguinte formato: quantidade1 valor1 quantidade2 valor2. O programa deve calcular esses valores seguindo a fórmula total = (quantidade1 x valor1) + (quantidade2 x valor2).
O valor total deve ser apresentado no final da execução. */
public class Ex02{
public static void main(String args[]){
int quantidade1 = Integer.parseInt(args[0]);
int valor1 = Integer.parseInt(args[1]);
int quantidade2 = Integer.parseInt(args[2]);
int valor2 = Integer.parseInt(args[3]);
int total = (quantidade1 * valor1) + (quantidade2 * valor2);
System.out.println("Total : "+total);
}
}