Advertisement
JuanFelipeArango28

Untitled

Sep 3rd, 2020
1,589
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scheme 1.12 KB | None | 0 0
  1. ;Autor: Juan Felipe Arango Guzman
  2. ;Fecha: 03-09-2020
  3. ;Contrato: retorno-credito: numero -> numero
  4. ;Proposito: Calcular el recargo que se cobrara a una persona por el uso de la tarjeta univalle-melo
  5. ;Ejemplos:
  6. ;Definiciones:
  7.  
  8. (define (retorno-credito gastostotal)
  9.   (cond
  10.     [(not (number? gastostotal))
  11.      (error "La entrada debe ser un numero")]
  12.     [(< gastostotal 0)
  13.      (error "La entrada no puede ser menor que cero")]
  14.     [(and (>= gastostotal 0) (<= gastostotal 1000))
  15.      (* 0.025 gastostotal)]
  16.     [(and (> gastostotal 1000) (<= gastostotal 3000))
  17.      (+ (* 0.025 1000)
  18.         (* 0.05 (- gastostotal 1000)))]
  19.     [(and (> gastostotal 3000) (<= gastostotal 10000))
  20.      (+ (* 0.025 1000)
  21.         (* 0.05 2000)
  22.         (* 0.075 (- gastostotal 3000)))]
  23.     [(and (> gastostotal 10000) (<= gastostotal 20000))
  24.      (+ (* 0.025 1000)
  25.         (* 0.05 2000)
  26.         (* 0.075 10000)
  27.         (* 0.085 (- gastostotal 10000)))]
  28.     [(> gastostotal 20000)
  29.      (+ (* 0.025 1000)
  30.         (* 0.05 2000)
  31.         (* 0.075 10000)
  32.         (* 0.085 20000)
  33.         (* 0.1 (- gastostotal 20000))
  34.         )]
  35.     )
  36.   )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement