008-006-003
Method Return Value: Tax Calculation
Medium
Problem Description
method Return Value: Tax Calculation
Learning Objective: Understand methods with return values
In this problem, you will create a program that defines a method accepting a price (integer) and a tax rate (decimal) as arguments, returning the tax-included price as an integer, and displays the result to standard output.
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
Ready to Try Running Code?
Log in to access the code editor and execute your solutions for this problem.
Don't have an account?
Sign Up