This course will be retired on June 1, 2025.
Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Start a free Courses trial
to watch this video
Here's our checklist of features our program is going to need. Over the rest of the course, we'll learn the Ruby features we need to implement each one. Then we'll cross that feature off our list when we're done.
- Display welcome message
- Ask for quantity
- Calculate total
- Discount for large orders
The program needs to greet the user with the message "Welcome to the widget store!" Then it needs to ask them how many widgets they're ordering. It should wait for them to type in a quantity and press Enter. The program will need to store whatever quantity they enter in the computer's memory. Each widget costs $10, so the program should multiply the quantity by 10 to get the total cost. It should print out a message that includes the quantity the user typed in, and the total cost.
The store also wants to offer discounts for ordering a lot of widgets at once. So if a user orders 50 or more widgets, they should only be charged $9 per widget. And if a user orders 100 or more widgets, they should only be charged $8 per widget.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up