[plt-scheme] Re: HtDP > Chapter 2 > Exercise 2.3.3.
If you can see this message then posting on this group works.
On Jun 27, 8:59 am, Matthias Felleisen <matth... at ccs.neu.edu> wrote:
> So you're working on a problem that is mentioned *before* the idea of
> program design has been introduced into the book.
>
> 1. It's supposed to convince you that programming properly isn't
> easy, despite all the books on "programming idiots" and "dummies for
> programming" you can find in local book stores or mother's blogs for
> programming.
>
> 2. In the next edition, we won't be indirect. We'll just say what we
> said for 1.
>
> 3. For now, I recommend the following:
>
> -- forget Scheme
> -- write down a table like this:
>
> # of customers : 0 | 1 | 2 | 3 | 10 | 100 | 200 | n
> --------------------------------------------------------
> total profit : | | | | | | |
>
> Fill out all the slots for concrete numbers. Once you get the hang of
> it, fill out the entry for n. Then -- and only then -- translate into
> Scheme.
>
> The problem has very little to do with programming, but is all about
> learning to read problem statements. Holler if you have problems with
> the table.
>
> -- Matthias
>
> On Jun 26, 2008, at 6:30 PM,Mr.Watsonwrote:
>
>
>
> > Hello,
>
> > The problem says,
>
> > "An old-style movie theater has a simple profit function. Each
> > customer pays $5 per ticket. Every performance costs the theater $20,
> > plus $.50 per attendee. Develop the function total-profit. It consumes
> > the number of attendees (of a show) and produces how much income the
> > attendees produce."
>
> > I understand the problem but I cannot get it to work (not calculate
> > correctly) in DrScheme.
>
> > Here is my working progress:
>
> > (define(total-profit attendee)
> > (- 0
> > (- 20 0
> > (* 0.5 attendee)
> > (+ 0
> > (* 5 attendee)))))
>
> > Any ideas on what I am doing wrong? I might be miscalculating so tell
> > me if its right.
>
> > Thank you,
> > _________________________________________________
> > For list-related administrative tasks:
> > http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>
> _________________________________________________
> For list-related administrative tasks:
> http://list.cs.brown.edu/mailman/listinfo/plt-scheme