Challenge: Commission Calculator
You are developing a program for a bank that needs to calculate commission based on the transaction type. Your task is to write a switch
statement that will output the commission based on the type of incoming transaction.
Commission rates based on transaction type:
Payment
: 0.5%;Transfer
: 1.2%;Withdrawal
: 2.0%;Deposit
: 0.0% (no commission).
Replace ___
with the necessary code to compile it. Don't hesitate to check the hint and solution to understand the task better.
2. Inside the
case
block, assign the correct commission value to the variable for each type of operation. If the operation is unknown to you, the commission should be -1
.3. Don't forget about the
default
block.
Tudo estava claro?
Conteúdo do Curso
Introduction to TypeScript
Introduction to TypeScript
Challenge: Commission Calculator
You are developing a program for a bank that needs to calculate commission based on the transaction type. Your task is to write a switch
statement that will output the commission based on the type of incoming transaction.
Commission rates based on transaction type:
Payment
: 0.5%;Transfer
: 1.2%;Withdrawal
: 2.0%;Deposit
: 0.0% (no commission).
Replace ___
with the necessary code to compile it. Don't hesitate to check the hint and solution to understand the task better.
2. Inside the
case
block, assign the correct commission value to the variable for each type of operation. If the operation is unknown to you, the commission should be -1
.3. Don't forget about the
default
block.
Tudo estava claro?