Skip to content

amandaguan-ag/pizza

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Pizza Parlor

By Amanda Guan

Description

This is a webpage that allows the user to create a pizza order (pizza size and toppings) and see how much it will cost based on their selections.

Lesson learnt

  • I structured the application data with JavaScript objects created with constructor functions.
  • I added functionality to Pizza objects by creating getBasePrice, getToppingsPrice, and calculatePrice methods to the object's prototype.
  • To ensure that the application is efficient and effective, I implemented the 'separation of concerns' principle to create JavaScript functions that focus on doing just one thing.
  • Additionally, I used event delegation to attach an event listener to a parent element that fires for a child element, which enhances the application's functionality and user experience.

link to Github Page

amandaguan-ag.github.io/pizza/

Technologies Used

  • HTML
  • CSS
  • bootstrap
  • Javascript

Setup/Installation Requirements

  • Clone this repository to your desktop
  • Navigate to the top level of the directory
  • Open index.html

Known Bugs

  • No known bugs

License

Copyright (c) 2023, Amanda GUan

Contact Information

Amanda Guan ag.amandaguan@gmail.com

TDD:

Describe: Pizza()

Test: "It should return a Pizza object with three properties for buyer name, size and toppings"
Code: const pizza = new Pizza("Bob", "medium", 3);
Expected Output: Pizza { customerName: "Bob", pizzaSize: "medium", orderToppings: 3 }

Describe: Pizza.prototype.getBasePrice()

Test 1: "It should return base price for extra-large pizza"
Code: const pizza = new Pizza("Bob", "extra-large", 3); const result = pizza.getBasePrice();
Expected Output:10

Test 2: "It should return base price for large pizza"
Code: const pizza = new Pizza("Bob", "large", 3); const result = pizza.getBasePrice();
Expected Output:8

Test 3: "It should return base price for medium pizza"
Code: const pizza = new Pizza("Bob", "medium", 3); const result = pizza.getBasePrice();
Expected Output:6

Test 4: "It should return base price for small pizza"
Code: const pizza = new Pizza("Bob", "small", 3); const result = pizza.getBasePrice();
Expected Output:4

Describe: Pizza.prototype.getToppingsPrice()

Test 1: "It should return toppings price for 4 toppings"
Code: const pizza = new Pizza("Bob", "medium", 4); const result = pizza.getToppingsPrice();
Expected Output:4

Test 2: "It should return toppings price for 3 toppings" Code: const pizza = new Pizza("Bob", "medium", 3); const result = pizza.getToppingsPrice(); Expected Output:3

Test 3: "It should return toppings price for 2 toppings" Code: const pizza = new Pizza("Bob", "medium", 2); const result = pizza.getToppingsPrice(); Expected Output:2

Test 4: "It should return toppings price for 1 toppings" Code: const pizza = new Pizza("Bob", "medium", 1); const result = pizza.getToppingsPrice(); Expected Output:1

Test 5: "It should return toppings price for 0 toppings" Code: const pizza = new Pizza("Bob", "medium", 0); const result = pizza.getToppingsPrice(); Expected Output:0

Describe: Pizza.prototype.calculatePrice()

Test: "It should calculate the total price of a pizza"
Code: const pizza = new Pizza("Bob", "medium", 4); const result = pizza.calculatePrice();
Expected Output:10