From the course: Programming Foundations: Discrete Mathematics
Unlock the full course today
Join today to access over 24,400 courses taught by industry experts.
Challenge: Model a lunch order
From the course: Programming Foundations: Discrete Mathematics
Challenge: Model a lunch order
- [Voiceover] Okay. This is our last programming challenge in this section. In this challenge, I'm gonna use SML, the Standard Machine Language, but you're welcome to use any functional programming language of your choice. In this challenge, I want you to create datatypes that use lists. This feature of functional programming languages is very powerful. In this example, we're going to create datatypes that contain all the values need to make a sandwich. This might be helpful if you're working on an application for a restaurant. We'll create datatypes specifically for the types of bread, types of cheese, types of meat, and types of condiments. Next, we'll create a datatype called Entree that is a sandwich made of bread, cheese, one or more meats, and one or more condiments. That's where the lists come into play. Finally, create a variable called Lunch that contains your order. If you have any trouble with this challenge, go back through the videos for this section. Okay, go give it a…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.