Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Challenge: Commission Calculator | Conditional Statements
Introduction to TypeScript

Challenge: Commission CalculatorChallenge: 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.

1. In each case, you need to write the string name of the operation, the list of which you can see in the task description.
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.

Все було зрозуміло?

Секція 2. Розділ 7
course content

Зміст курсу

Introduction to TypeScript

Challenge: Commission CalculatorChallenge: 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.

1. In each case, you need to write the string name of the operation, the list of which you can see in the task description.
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.

Все було зрозуміло?

Секція 2. Розділ 7
some-alt