question 11a write the class ingredient to


Question 1

1.(a) Write the class 'Ingredient' to contain the following:-

(i) Integer variable: ingredient_id
(ii) String variables: ingredient_name, type
(iii) double-precision variable: quantity
(iv) Set methodfor each of the variables
(v) Get method for each variable

(b) Write the class 'Vegetable' to contain following-

(i) Integer variable: vegetable_id
(ii) String variable: vegetable_name
(iii) double-precision variable: cost
(iv) Set method for each data member
(v) Get method for each data member

(c) Write the class 'Recipe' to include the following-

(i) Integer variable: recipe_id
(ii) String variables: recipe_name, preparation_procedure
(iii) double-precision variable: preparation_time
(iv) An object of type Ingredient
(v) An object of type Vegetable
(vi) set method for the data members- recipe_id, recipe_name, preparation_procedure and preparation_time
(vii) Get methods for the variables- recipe_id, recipe_name, preparation_procedure an preparation_time

(d) Write the class 'CookMeal' to perform the following-

(i) Generate an object of type 'Recipe'
(ii) Request user to enter value for each data member of 'Recipe' using the input dialog of JOptionPane.
(iii) Enter values for each data member of 'Ingredient' object contained in 'Recipe'
(iv) Enter values for each variable of 'Vegetable' object contained in 'Recipe'
(v) Show the values using the message dialog of JOptionPane

Question 2

(a) Make different between following Object-Oriented concepts using suitable examples-

(i) no-argument constructor v/s overloaded constructor
(ii) Public v/s private
(iii) Concrete class v/s abstract class
(iv) Single inheritance v/s multiple inheritance
(v) subclassing v/s polymorphism
(vi) Encapsulation v/s abstraction

(b)(i) describe purpose of the keyword 'super' in programs.
(ii) Describe how it is used in object-oriented programs using appropriate examples.

Request for Solution File

Ask an Expert for Answer!!
Software Engineering: question 11a write the class ingredient to
Reference No:- TGS0444320

Expected delivery within 24 Hours