003-006-001
Cast Operator: Data Type Conversion
Easy
Problem Description
Cast Operator: Data Type Conversion
Learning Objective: Perform explicit type conversion using cast operators
Create a price calculation system. Use cast operators to convert between integers and decimals.
Input
Line 1: Product price (integer)
Line 2: Discount rate (integer, percent)
Output
Original: [price] yen
Discount: [rate]%
After discount: [result] yen
Test Cases
※ Output examples follow programming industry standards
Input:
1000 20
Expected Output:
Original: 1000 yen Discount: 20% After discount: 800 yen
Input:
500 10
Expected Output:
Original: 500 yen Discount: 10% After discount: 450 yen
Input:
100 0
Expected Output:
Original: 100 yen Discount: 0% After discount: 100 yen
❌ 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 6 free executions remaining
