Hands-on Activity Using Data to Optimize Your Vending Machine

Quick Look

Grade Level: 9 (8-10)

Time Required: 1 hours 45 minutes

(two 50-minute class periods)

Expendable Cost/Group: US $0.00

Group Size: 28

Activity Dependency: None

Subject Areas: Problem Solving, Reasoning and Proof, Science and Technology

NGSS Performance Expectations:

NGSS Three Dimensional Triangle

Engineers think about optimizing all their designs. How can we use a vending machine as a case study for optimization?
Engineers think about optimizing all their designs. How can we use a vending machine as a case study for optimization?
Copyright © Christina Hartman, Utah State University


Using concepts of optimization and trade-offs, students must stock a vending machine with popular drinks so they can earn maximum profits to fundraise for a club. Students collect data to determine the most popular drinks among their peers and are presented with a scenario where they need to make an adjustment to their selection. They’re given real-world examples of optimizing in engineering to illustrate the importance of collecting data to improve design-making.
This engineering curriculum aligns to Next Generation Science Standards (NGSS).

Engineering Connection

Real-world engineers use optimization to ensure that they’re not wasting resources or time, which ultimately leads to wasted money. Optimization is an important real-world practice among all types of engineers, in the public and private sectors. Along these lines, trade-offs must be made in order to achieve the best possible results. Students are also introduced to the concept of criteria and constraints, which is key across engineering disciplines. Bonus – learn how a vending machine works!

Learning Objectives

After this activity, students should be able to:

  • Understand and explain the concepts of optimizing, criteria, and constraints.
  • Optimize simple processes.
  • Evaluate data and improve data collection methodologies.
  • Identify criteria and constraints for processes and devices.

Educational Standards

Each TeachEngineering lesson or activity is correlated to one or more K-12 science, technology, engineering or math (STEM) educational standards.

All 100,000+ K-12 STEM standards covered in TeachEngineering are collected, maintained and packaged by the Achievement Standards Network (ASN), a project of D2L (www.achievementstandards.org).

In the ASN, standards are hierarchically structured: first by source; e.g., by state; within source by type; e.g., science or mathematics; within type by subtype, then by grade, etc.

NGSS Performance Expectation

HS-ETS1-2. Design a solution to a complex real-world problem by breaking it down into smaller, more manageable problems that can be solved through engineering. (Grades 9 - 12)

Do you agree with this alignment?

Click to view other curriculum aligned to this Performance Expectation
This activity focuses on the following Three Dimensional Learning aspects of NGSS:
Science & Engineering Practices Disciplinary Core Ideas Crosscutting Concepts
Design a solution to a complex real-world problem, based on scientific knowledge, student-generated sources of evidence, prioritized criteria, and tradeoff considerations.

Alignment agreement:

Criteria may need to be broken down into simpler ones that can be approached systematically, and decisions about the priority of certain criteria over others (trade-offs) may be needed.

Alignment agreement:

NGSS Performance Expectation

HS-ETS1-3. Evaluate a solution to a complex real-world problem based on prioritized criteria and trade-offs that account for a range of constraints, including cost, safety, reliability, and aesthetics, as well as possible social, cultural, and environmental impacts. (Grades 9 - 12)

Do you agree with this alignment?

Click to view other curriculum aligned to this Performance Expectation
This activity focuses on the following Three Dimensional Learning aspects of NGSS:
Science & Engineering Practices Disciplinary Core Ideas Crosscutting Concepts
Evaluate a solution to a complex real-world problem, based on scientific knowledge, student-generated sources of evidence, prioritized criteria, and tradeoff considerations.

Alignment agreement:

Analyze data using tools, technologies, and/or models (e.g., computational, mathematical) in order to make valid and reliable scientific claims or determine an optimal design solution.

Alignment agreement:

When evaluating solutions it is important to take into account a range of constraints including cost, safety, reliability and aesthetics and to consider social, cultural and environmental impacts.

Alignment agreement:

New technologies can have deep impacts on society and the environment, including some that were not anticipated. Analysis of costs and benefits is a critical aspect of decisions about technology.

Alignment agreement:

  • Synthesize data and analyze trends to make decisions about technological products, systems, or processes. (Grades 9 - 12) More Details

    View aligned curriculum

    Do you agree with this alignment?

Suggest an alignment not listed above

Materials List

The class needs:

Worksheets and Attachments

Visit [www.teachengineering.org/activities/view/usu-2586-data-optimize-vending-machine] to print or download.

Pre-Req Knowledge

Experience using vending machines.

An understanding of fundraising is also helpful.


Imagine you need to fundraise for your school. If you haven’t considered one, vending machines are a great option. They allow you to earn money without even being there! But in order to maximize your profits, you’ll need to optimize your vending machine. Optimization is the process of determining the most effective or favorable solution. To make this decision, often requires trade-offs. A trade-off is a decision that involves diminishing or losing one quality, quantity, or property of a solution in return for gaining other aspects. A trade-off occurs when you need to choose between two or more alternatives. It’s basically a compromise where one thing is gained while something else is given up.

In this case with our vending machine, we need to ensure we are offering the most popular drinks to our customers (other students). But we want to sell the drinks that make the most money. The example is similar to how real engineers optimize products and systems to save time and resources, while balancing trade-offs, so their companies can earn a profit while saving consumers money.



Students don’t need much background in order to participate in this activity. Experience using a vending machine is a plus. This activity is optimized as an online/remote activity.

Best practices for survey creation and distribution

  1. Keep the survey short. If respondents see that that the questionnaire consists of multiple pages, they’ll be more inclined to leave several questions unanswered or not finish the survey.
  2. Ask clear and direct questions. Respondents won’t know how to fill out a survey if they don’t understand what’s being asked of them
  3. Focus on asking closed-ended questions. Open-ended questions (also known as free-response questions) require more effort and time to answer than closed-ended questions.
  4. Keep survey questions neutral. Do not put an opinion into survey questions (or ask a “leading question”) that can influence respondents to answer in a way that doesn’t reflect how they really feel. For example: “We think our customer service representatives are really awesome. How awesome do you think they are?” vs. “How helpful or unhelpful do you find our customer service representatives to be?”
  5. Keep a balanced set of answer choices – Give respondents a way to provide honest and thoughtful feedback. Writing good survey questions involve using an objective tone. This means adopting a balanced set of answer options, like the following:
    1. Very helpful
    2. Helpful
    3. Neither helpful nor unhelpful
    4. Unhelpful
    5. Very unhelpful
  6. Don’t ask for two things at once - Confusing respondents is equally as bad as influencing their answers. In both cases, they’ll choose an answer that doesn’t reflect their true opinions and preferences. Example: “How would you rate our customer service and product reliability?” Customer service and product reliability are two separate topics. Including both in the same question can push the respondent to either evaluate one or to skip the question altogether. A fix would be “How would you rate our customer service?” And… “How would you rate our product’s reliability?”
  7. Do a test drive - As a survey creator, there’s no worse feeling than finding mistakes in your survey once it’s already sent (https://www.surveymonkey.com/curiosity/fix-broken-survey-already-sent). Prevent the situation from happening to you by sharing your survey with colleagues, friends, and others in advance. (https://help.surveymonkey.com/articles/en_US/kb/Can-I-test-my-survey-before-it-goes-live) Remember: a pair of fresh eyes can be all it takes to spot mistakes in your survey.

Before the Activity

With the Students

Part 1: One Class Period

  • Use the Part I of the PowerPoint Presentation to walk through today’s activity. (Don’t move on to Part II.)
  • Read each slide aloud and give students time to discuss the prompts on the slides.
  • Work as a class to put together the survey. Take student suggestions and provide feedback as needed.  For example: “Cans of water are very expensive. Will people be willing to pay more for water than soda?” “Do we really need three different flavors of La Croix?” “That drink only comes in bottles, it may not fit.”
  • In class, outside of class or as homework, ask students to have their friends fill out the survey. Give each student a target that makes sense for your school’s population (for example, each student surveys three people.) Note: Make sure students know not to have the same people fill out the survey multiple times.

A photo of a vending machine with front graphics that say “MEGABOTS 2993”.
How could you optimize a vending machine?
Copyright © Christina Hartman, Utah State University

Part 2: ½-1 Class Period

  • Compile student survey results and take a look at the survey results. Discuss the drinks that will be put in the machine – any surprises?
  • Use the Part II of the PowerPoint Presentation Discuss ways the survey could be improved to produce more valid results.
  • Examine the Popular Drink Information Chart to gain some insight into the factors you’ll need to consider to make a more ethical vending machine that the principal will approve of. Students are free to decide for themselves how to best balance profit with sustainability and nutrition. The class can also use copies of the chart to add and subtract data based on other food items or beverages, as needed.
  • Either use the rest of class to have students work on their Final Assessment or have them take home as homework.


constraints: Limitations or framework a design must work around.

criteria: Elements a design must have.

data: Facts and statistics collected for reference or analysis.

optimization: Make the best or most effective use of (a situation, opportunity, or resource).

trade-off: A situational decision that involves diminishing or losing one quality, quantity, or property of a set or design in return for gains in other aspects.


Pre-Activity Assessment

Questions for the class:

  • Do students understand the reason for fundraising for teams and clubs?
  • Do they understand how a vending machine works?

Note: Asking these questions informally and gauging student response should be sufficient.

Activity Embedded (Formative) Assessment

Ensure that all students work to get responses to the survey the class designs, try to get students engaged in the class discussions prompted in the PowerPoint and gauge their responses. Be sure to see PowerPoint notes for possible discussion points.

Post-Activity (Summative) Assessment

Have students complete the essay outlined in the Final Assessment slide of the PowerPoint Presentation (Slide #14). Their individual responses will demonstrate what they learned from the activity as a whole.

Investigating Questions

What is the best way to create and disseminate a survey to get the most useful results?

What criteria and constraints should vending machine owners consider?

How can a vending machine be optimized to make the most money?

What trade-offs should vending machine owners consider to balance sustainability, nutrition, and profitability?

Troubleshooting Tips

If you choose not to use the Google Form for your survey, you’ll need to think of another method. This activity will work well with a paper survey that you print off yourself and hand out to students using the Google Form and PowerPoint as examples.

Activity Extensions

Optimizing and criteria/constraints are both broad engineering principles that will easily tie into future design units.

Provide more drink options such as cold coffee, Vitamin Water, Gatorade, etc. with their nutritional value, etc. in the Excel table.

Give each drink a price such that students must weigh earning maximum profit while serving healthier drinks that may or may not be recycled.

Activity Scaling

This activity should work as-is in the grades listed.

Please note: If distributing the survey to students outside the class isn’t possible, have students in the class take the survey on their own once they’ve created it.


Get the inside scoop on all things TeachEngineering such as new site features, curriculum updates, video releases, and more by signing up for our newsletter!
PS: We do not share personal information or emails with anyone.

More Curriculum Like This

High School Lesson
All about Linear Programming

Students learn about linear programming (also called linear optimization) to solve engineering design problems. They apply this information to solve two practice engineering design problems related to optimizing materials and cost by graphing inequalities, determining coordinates and equations from ...

Middle School Lesson
Show Me the Money

Students learn about the major factors that comprise the design and construction cost of a modern bridge. Students learn about the components that go into estimating the total cost, including expenses for site investigation, design, materials, equipment, labor and construction oversight, as well as ...


Corporation., T. M. (0AD). Toyota Production System: Vision & Philosophy: Company. Toyota Motor Corporation Official Global Website. https://global.toyota/en/company/vision-and-philosophy/production-system/.

Leblanc, Rick. “The Decomposition of Waste in Landfills.” The Balance SMB, January 16, 2021. https://www.thebalancesmb.com/how-long-does-it-take-garbage-to-decompose-2878033

The Mag. “Frederick Winslow Taylor, the Patron Saint of the Shovel.” Mental Floss, April 27, 2015. https://www.mentalfloss.com/article/63341/frederick-winslow-taylor-patron-saint-shovel.


© 2021 by Regents of the University of Colorado; original © 2021 Utah State University


Christina Hartman; Amy A. Wilson-Lopez; Angie Minichiello; Theresa Green; Landon Ashcroft

Supporting Program

Learning from Engineers to Develop a Model of Disciplinary Literacy, College of Engineering, Utah State University


This material was developed based upon work supported by the National Science Foundation under grant no. EEC 1664228—Learning from Engineers to Develop a Model of Disciplinary Literacy in the College of Engineering, Utah State University. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the authors and do not necessarily reflect the views of the National Science Foundation.

Last modified: July 18, 2023

Free K-12 standards-aligned STEM curriculum for educators everywhere.
Find more at TeachEngineering.org