Advertisement
PaolaD

Untitled

Sep 3rd, 2020
1,807
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scheme 0.94 KB | None | 0 0
  1. ;;Autor: Paola Andrea Domínguez Vélez
  2. ;;Fecha: 3/09/2020
  3. ;;Contrato: número -> número
  4. ;;Proposito calcular los cargos que retorna la tarjeta de crédito univalle-melo ofrecida por la Universidad.
  5.  
  6. ;;Definición:
  7. (define (retorna-credito total_gastos)
  8.   (cond
  9.     [(and (> total_gastos 0) (<= total_gastos 1000))
  10.      (* 0.025 total_gastos)
  11.      ]
  12.     [(and (> total_gastos 1000) (<= total_gastos 3000))
  13.      (+ (* 0.05 (- total_gastos 1000)) (* 0.025 1000))
  14.      ]
  15.     [(and (> total_gastos 3000) (<= total_gastos 10000))
  16.      (+ (* 0.075 (- total_gastos 3000)) (* 0.05 2000) (* 0.025 1000))
  17.      ]
  18.     [(and (> total_gastos 10000) (<= total_gastos 20000))
  19.      (+ (* 0.085 (- total_gastos 10000)) (* 0.075 7000) (* 0.05 2000) (* 0.025 1000))
  20.      ]
  21.     [(> total_gastos 20000)
  22.      (+ (* 0.1 (- total_gastos 20000))(* 0.085 10000) (* 0.075 7000) (* 0.05 2000) (* 0.025 1000))
  23.      ]
  24.     [else "Error"]
  25.     ))
  26.  
  27.  
  28. (retorna-credito 11500)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement