010-002-006

Method Overloading: Tax Calculation

Easy

Problem Description

Method Overloading: Tax Calculation

Learning Objective: Use method overloading with different parameter counts in practical scenarios

Create 3 types of calculateTax methods. Define 1-parameter version (price only), 2-parameter version (price x quantity), and 3-parameter version (price x quantity - discount).

Method Definitions

  1. CalculateTax(int price): Tax on single price (price x 0.1)
  2. CalculateTax(int price, int quantity): Tax on total amount
  3. CalculateTax(int price, int quantity, double discountRate): Tax after discount

Output

[tax1]
[tax2]
[tax3]

Test Cases

※ Output examples follow programming industry standards

Input:
Expected Output:
100
500
400
Input:
Expected Output:
100
500
400
Input:
Expected Output:
100
500
400
❌ Some tests failed
❌ エラー発生

Your Solution

Current Mode: My Code
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