SCHEME LANGUAGE Scheme program for a grocery store that will calculate the total price of a customer’s items, represente

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

SCHEME LANGUAGE Scheme program for a grocery store that will calculate the total price of a customer’s items, represente

Post by answerhappygod »

SCHEME LANGUAGE
Scheme program for a grocery store that will calculate the totalprice of a customer’s items, represented as a list. Recursively going through the list using those defines to calculatethe sum as below. Will that work and why? What should be corrected?
(define milk 2.99)(define chicken 7.99)(define carrots 1.99)(define add-cart (lambda(x) (if (empty? x) 0 (+ (car x) (add-cart(cdr x))))))(add-cart '(milk chicken carrots))
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply