Giter Site home page Giter Site logo

java-snackbar's Introduction

Project Snack Bar:

A student that completes this project shows that they can:

  • use the Java Development Kit (JDK)
  • use and manipulate Java base data types
  • construct Java classes including instantiating and using Java Objects
  • use and manipulate Java base data types

Introduction

Variations on the Snack Bar Project have been part of Java Education since Java was created. So, we will do one. The point is to set up vending machines where a person buys snacks from those machines.

Instructions

Snack

Snack has fields (so knows)

  • id
  • name
  • quantity
  • cost
  • vending machine id

Snack has methods (so can)

  • set and get id
  • set and get name
  • set and get cost
  • set and get vending machine id
  • get quantity
  • add quantity when given how many to add
  • buy snack when given how many to buy
  • get total cost given a quantity

Vending Machine

Vending machine has fields (so knows)

  • id
  • name

Vending Machine has methods (so can)

  • set and get id
  • set and get name

Customer

Customer has id, name, cash on hand. Customer can add cash, buy given total cash used in purchase, get and set name, get cash on hand.

Instructions

  • Instantiate 2 customers

    • Jane with $45.25
    • Bob with $33.14
  • Instantiate 3 Vending Machines

    • Food
    • Drink
    • Office
  • Instantiate 5 snacks

    • In Vending Machine Food
      • 36 Chips at $1.75
      • 36 Chocolate Bar at $1.00
      • 30 Pretzel at $2.00
    • In Vending Machine Drink
      • 24 Soda at $2.50
      • 20 Water at $2.75
  • Processing

  1. Customer 1 buys 3 of snack 4. Print Customer 1 Cash on hand. Print quantity of snack 4.
  2. Customer 1 buys 1 of snack 3. Print Customer 1 Cash on hand. Print quantity of snack 3.
  3. Customer 2 buys 2 of snack 4. Print Customer 2 Cash on Hand. Print quantity of snack 4.
  4. Customer 1 finds $10. Print Customer 1 Cash on Hand.
  5. Customer 1 buys 1 of snack 2. Print Customer 1 Cash on Hand. Print quantity of snack 2.
  6. Add 12 more items to snack 3. Print quantity of snack 3.
  7. Customer 2 buys 3 of snack 3. Print Customer 2 Cash on hand. Print quantity of snack 3.
  • Stretch Goals

    • Display each snack with
      • Name
      • Vending Machine Name
      • Quantity on hand
      • Total cost of all of the quantities of this snack on hand

java-snackbar's People

Contributors

jrmmba8314 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.