008-006-007
Using Method Return Values
Easy
Problem Description
Using Method Return Values
In this problem, you will implement the calculateTax method that computes a tax-inclusive price.
Learning Objective: Understand how to define methods with return values and use the return statement to send a value back to the caller
Specifications
Input
- Line 1: Price before tax (integer)
Output
- Tax-inclusive price (integer)
calculateTax Method
- Parameter:
int price(price before tax) - Return type:
int(tax-inclusive price, 10% tax rate, truncated) - Formula:
price * 110 / 100(integer arithmetic for truncation)
Examples
Input: 1000
Output: 1100
Input: 250
Output: 275
Input: 999
Output: 1098
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