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
course content

Зміст курсу

Introduction to TypeScript

Introduction to TypeScript

1. TypeScript Fundamentals
2. Conditional Statements
3. Arrays
4. Loops
5. Functions

book
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.

123456789101112131415161718192021
let transactionType: string = "Transfer"; // You can change the operation type let commission: number; switch (transactionType) { case ___: ___ = 0.5; break; case ___: ___ = ___; break; case ___: ___ = ___; break; case ___: ___ = ___; break; ___: ___ = -1; // Handle unknown transaction types } console.log(`Commission for ${transactionType}: ${commission}%`);
copy

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

Як ми можемо покращити це?

Дякуємо за ваш відгук!

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

Запитати АІ

expand
ChatGPT

Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат

course content

Зміст курсу

Introduction to TypeScript

Introduction to TypeScript

1. TypeScript Fundamentals
2. Conditional Statements
3. Arrays
4. Loops
5. Functions

book
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.

123456789101112131415161718192021
let transactionType: string = "Transfer"; // You can change the operation type let commission: number; switch (transactionType) { case ___: ___ = 0.5; break; case ___: ___ = ___; break; case ___: ___ = ___; break; case ___: ___ = ___; break; ___: ___ = -1; // Handle unknown transaction types } console.log(`Commission for ${transactionType}: ${commission}%`);
copy

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

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 2. Розділ 7
Ми дуже хвилюємося, що щось пішло не так. Що трапилося?
some-alt