008-003-005

Method Calling Method: Calculation Processing

Easy

Problem Description

method Calling method: Calculation Processing

In this problem, you will create a program that calculates the sum of two integers using calcTotal, calls calcTotal from within calcWithTax to compute the tax-included price, and displays the results to standard output.

Learning Objective: Understand how to call one method from another method

Overview

Create a calcTotal method that calculates the sum and a calcWithTax method that calculates the price including tax. The calcWithTax method calls calcTotal internally.

Specifications

  • calcTotal(int a, int b): returns a + b
  • calcWithTax(int a, int b): multiplies calcTotal result by 1.1 and returns as integer

Input

Two integers are provided

Output Format

Total: 150
With Tax: 165

Test Cases

※ Output examples follow programming industry standards

Input:
100
50
Expected Output:
Total: 150
With Tax: 165
Input:
200
300
Expected Output:
Total: 500
With Tax: 550
Input:
50
50
Expected Output:
Total: 100
With Tax: 110
Input:
0
0
Expected Output:
Total: 0
With Tax: 0
❌ 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