Ice-cream

This is a warmup exercise. It is not compulsory, and may be completed individually or with your lab partner.

Create and open a new file called icecream.c for this exercise.

$ gedit icecream.c &

Matilda wants to buy some ice-cream, but she only has $10. Write a program so that she can input how many scoops of ice-cream she wants and how much each scoop costs and it will let her know if she has enough money. Your program should behave as follows:

$ dcc -o icecream icecream.c
$ ./icecream
How many scoops? 5
How many dollars does each scoop cost? 1
You have enough money!
$ ./icecream
How many scoops? 5
How many dollars does each scoop cost? 3
Oh no, you don't have enough money :(

You can assume that Matilda will only give you positive integers.

To run some simple automated tests:

$ 1511 autotest icecream

To run Styl-o-matic:

$ 1511 stylomatic icecream.c
Looks good!

You’ll get advice if you need to make changes to your code.

Submit your work with the give command, like so:

$ give cs1511 wk02_icecream

Or, if you are working from home, upload the relevant file(s) to the wk02_icecream activity on Give Online.