004-002-003
Array Creation: Price List
Easy
Problem Description
Array Creation: Price List
Learning Objective: Learn how to create arrays with initial values
Create a program that inputs three product prices, stores them in an array, and calculates the total.
Input
Line 1: Price 1 (integer)
Line 2: Price 2 (integer)
Line 3: Price 3 (integer)
Output
Price 0: [price1]
Price 1: [price2]
Price 2: [price3]
Total: [total]
Test Cases
※ Output examples follow programming industry standards
Input:
100 200 300
Expected Output:
Price 0: 100 Price 1: 200 Price 2: 300 Total: 600
Input:
500 150 350
Expected Output:
Price 0: 500 Price 1: 150 Price 2: 350 Total: 1000
❌ Some tests failed
Your Solution
Current Mode:● My Code
99
1
2
3
4
5
6
7
8
9
10
›
⌄
⌄
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
// Write your code here
sc.close();
}
}
0 B / 5 MB
You have 9 free executions remaining
