[SOLVED] CS320 Homework #2-Objects and JavaScript

35.00 $

Category:
Click Category Button to View Your Next Assignment | Homework

You will receive the following solution file(s) instantly after successful payment:

zip file icon cs320-fund-of-software-engr-hw-2-main-nlqxhc.zip (240.9 KB)
Assignment Instructions Updated Recently? Submit Below and we will provide new Solution!
Submit New Instructions
🔒 Securely Powered by:
Secure Checkout
5/5 - (1 vote)

 

1. Introduction
Objects and JavaScript
   This assignment helps you review the concepts of object
orientated programming and also practice Javascript programming
skills. You have been given this scenario: You are a programmer
for Domino’s Pizza and have been asked to use Javascript to
develop a way for customers in Kenya to order from the local
Domino’s pizza stores. A sample menu is pictured below:
                                (This menu will be included as a
                                separate file for closer
                                examination)
2. Environment Setup
This assignment can be done in JSFiddle or your IDE. The
submission will be three *.js files that should run on JSFiddle
if copied over to it. Use that site to verify your code runs on
a neutral platform.

Homework #2 Due October 2nd, 2020

3. Design Phase 1: Menu
In this phase, you will design a class to represent menu items,
create 6 instances off the chosen menu, and use them to define
another class called Menu. Follow the instructions below:

1. Create a new Javascript file called “Phase 1.js”.

2. Create a class "MenuItem", with a constructor. The items
should have the properties of a pizza: name, ingredients, and
prices.
3. Create instances of MenuItems for the following items on the
menu: Regina, Hawaiian, Veggie, Zzesty Pepperoni Passion,
Chicken Bali, and BBQ Chicken (for some of the items ignore the
"extra mozzerella" and unique sauces for this assignment).
Use the console to examine the instances, and make sure they
represent their items correctly. This can be done by using the
console.log() command with those instances being passed in the
arguement.
4. Create a class "Menu", which provides access to one or more
MenuItem instances. It has: 1) an addMenuItem() method which can
add a MenuItem to the menu; 2) a findMenuItems(ingredient)
method which returns all the MenuItems that contain the
ingredient.
5. Create an instance of the Menu class, add the 6 MenuItem
instances to it, and use the findMenuItems() method to find the
items which are made with pineapples.
6. Press the "Save" button (or "Update" button if you have
pressed "Save" before) to create a URL to your code on JSFiddle.

Homework #2 Due October 2nd, 2020

4. Design Phase 2: Order
In this phase, you will implement the code to support customer
orders. Follow the instructions below:
1. Copy your "Phase1.js" *.js file and rename the copy as
"Phase2.js" (or just copy the contents into a new Javascript
file). If working on a JSFiddle account, you can fork your work
to create a second instance of it that will be separate from
that first phase. Make sure you either have an account or record
the URL of that instance to keep track of it.
2. Create a class "Pizza" to represent actual pizzas that the
customers want to order. (Hint: The constructor takes a MenuItem
instance, and a string representing the desired size of "Small",
"Medium", or "Large", as well as the crust "Hand Tossed” or
"Thin").
3. Create a class "Order" to represent a customer order, which
may contain one or more pizzas. The class has methods for adding
a pizza and calculating total cost.
4. Exercise your Order class by creating an instance, adding at
least two pizzas, and checking if the total cost is correct.
5. Press the "Update" button to create a URL to your code.

Homework #2 Due October 2nd, 2020

5. Design Phase 3: Inventory
In this phase, you will implement the code to support store
inventory for making pizzas. Follow the instructions below:
1. Repeat step 1 from part 4, but with "Phase2.js" and
"Phase3.js" instead. Same with JSFiddle and the fork function if
using that.
2. Create a class "Inventory" that holds the number of servings
available for each ingredient. Such as, there are 20 servings of
beef ham, 40 servings of pineapples, 12 servings of grilled
chicken, etc.
3. Create an instance of the Inventory class, and set the
inventory for the ingredients in our menu items: pinapples, beef
ham, mushrooms, mixed peppers, black olives, fresh tomatoes,
pepperoni, red chili, grilled chicken, and sweet corn.
4. Create a class "Store". A store is constructed with an
inventory instance which determines whether or not it has
sufficient ingredients to make a pizza. (NOTE: the servings of
each item needed for a pizza by size is: 3 for Large, 2 for
Medium, and 1 for Small)
5. Create a "placeOrder" method which accepts an Order instance
and attempts to fulfill it. It will return an array of all the
pizza instances it was able to make without running out of
ingredients. So, if the stores inventory does not have enough of
an ingredient, the pizza will not be made.
6. Call the placeOrder method with the instance of the order you
did at the end of Phase 2. One of these pizzas should have
enough ingredients to be made, and the other not. Have the
result of the placeOrder call print to the console.
7. Press the "Update" button to create a URL to your code.
  • cs320-fund-of-software-engr-hw-2-main-nlqxhc.zip