Question
Write a program call Food Recipe Variables 1. Name - the name of the food 2. Carolies - this is a positive whole number greater
Write a program call Food Recipe
Variables
1. Name - the name of the food
2. Carolies - this is a positive whole number greater or equal to 0
3. Ingredients - This is an array of String that correspond to the ingredient in the food
Constructors
1. A default constructor set the name and sequence to some default value. Default number of ingredients is 15
2. A parameterized constructor that takes in a name, calories, and an array of ingredients which assign the instance values as long as they are valid
Accessor and Mutator
1. MAKE SURE TO CHECK FOR VALID VALUES!
Methods
1. A method printinfo which return nothing and print the name, number of calories, and the ingredients
2. A methods equals which take in another instance of Food and chech if it has the same name, number of calories, and the same ingredients (order does mater). it should return true or false if the two are equals.
3. A static methods sameIngredients whick takes in two String arrays of ingredients and returns true only if both array are equal size and both array have the same ingredients in order.
--------------------------------------------------------------------------------------------
Write a class of Burger which inherits from Food. This American Burger adds an additional instance variable "primaryMeat". Write a default constructor and a parameterized constructor (check for errors). Override the printInfo method so that it also print out all the of the contestant's name.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started