008-006-003
Method Return Value: Tax Calculation
Medium
Problem Description
Method Return Value: Tax Calculation
Learning Objective: Understand methods with return values
Create a program with a method that calculates tax-included price from price and tax rate.
Input
Line 1: Price (integer)
Line 2: Tax rate (decimal, e.g., 0.1 for 10%)
Output
Price: [price]
Tax rate: [rate]
Total: [tax-included price (integer part only)]
```java
## Example
Input:
```java
1000
0.1
```java
Output:
```java
Price: 1000
Tax rate: 0.1
Total: 1100
Test Cases
※ Output examples follow programming industry standards
Input:
1000 0.1
Expected Output:
Price: 1000 Tax rate: 0.1 Total: 1100
Input:
500 0.08
Expected Output:
Price: 500 Tax rate: 0.08 Total: 540
Input:
100 0.0
Expected Output:
Price: 100 Tax rate: 0.0 Total: 100
❌ 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
