Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function tradeCommission (input) {
- let city = input.shift();
- let sells = +input.shift();
- let comission = 0;
- switch (city){
- case `Sofia` :
- if (sells >= 0 || sells <= 500) {
- commission = sells * 0.05
- } else if (sells > 500 || sells <= 1000) {
- commission = sells * 0.07
- } else if (sells > 1000 || sells <= 10000) {
- commission = sells * 0.08
- } else if (sells > 10000) {
- commission = sells * 0.12
- } break;
- case `Varna` :
- if (sells >= 0 || sells <= 500) {
- commission = sells * 0.045
- } else if (sells > 500 || sells <= 1000) {
- commission = sells * 0.075
- } else if (sells > 1000 || sells <= 10000) {
- commission = sells * 0.1
- } else if (sells > 10000) {
- commission = sells * 0.13
- } break;
- case `Plovdiv` :
- if (sells >= 0 || sells <= 500) {
- commission = sells * 0.055
- } else if (sells > 500 || sells <= 1000) {
- commission = sells * 0.08
- } else if (sells > 1000 || sells <= 10000) {
- commission = sells * 0.12
- } else if (sells > 10000) {
- commission = sells * 0.145
- } break;
- }
- console.log (comission.toFixed(2))
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement