008-004-006
Multiple Parameters Method: Total Price Calculator
Easy
Problem Description
Multiple Parameters method: Total Price Calculator
In this problem, you will create a program that defines a calculateTotal method accepting unit price, quantity, and tax rate as parameters, calculates the total price, and displays the result to standard output.
Learning Objective: Define methods with multiple parameters
Create a program that calculates the total price from three pieces of information: unit price, quantity, and tax rate. Pass multiple arguments to the calculateTotal method.
Input
Line 1: Unit price (integer)
Line 2: Quantity (integer)
Line 3: Tax rate (decimal, e.g., 0.1 is 10%)
Output
Unit price: [price] yen
Quantity: [quantity] items
Tax rate: [rate]
Total: [total] yen
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