APlusGrades

Not Rated (0)

$15/per page/Negotiable

About APlusGrades

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Accounting,Algebra See all
Accounting,Algebra,Applied Sciences,Architecture and Design,Art & Design,Biology,Business & Finance,Calculus,Chemistry,Communications,Computer Science,Economics,Engineering,English,Environmental science,Essay writing,Foreign Languages,Geography,Geology,Health & Medical,HR Management,Law,Management,Physics,Programming,Science,Statistics Hide all
Teaching Since: Jul 2017
Last Sign in: 273 Weeks Ago, 4 Days Ago
Questions Answered: 1850
Tutorials Posted: 1850

Education

  • Graduate in Biology and Nutrition, MBA Finance
    Florida State University
    Aug-2000 - Jul-2007

Experience

  • Ass. Relationship Manager
    Penn-Florida
    Mar-2009 - Feb-2016

Category > Programming Posted 21 Jul 2017 My Price 12.00

Write a JAVA program

Filename(s): DessertCafe.java

Public class: DessertCafePackage-visible class(es): Dessert, Cake, CookiePack, IceCream, Sundae

Write a JAVA program that manages the desserts that can be purchased at a dessert shop. The class DessertCafe is a driver class containing a main() method that will be used to test the other classes, all of which have package-level access. Thus, do not provide a visibility modifier for those classes when you define them insideDessertCafe.java.The abstract class Dessert contains data members name and cost. It also defines public methods StringgetName(), which returns the name of the dessert, and public method int getCost(). Implement both ofthese methods and the standard methods toString() (return the name and cost of the dessert concatenated ina String) and equals(Object) in the following subclasses:• The Cake class is derived from the Dessert class. A Cake object has a number of layers (int). Theprice of a cake is $15 + $2 per layer. For example, a 3-layer cake costs $21. The number of layers is passedas the parameter to the Cake constructor.• The CookiePack class is derived from the Dessert class. A CookiePack object has a number (int)indicating how many cookies are in the pack and a price per cookie in dollars (int) which are used todetermine its cost. For example, a 5-cookie pack at $2 per cookie = $10. The name/type of the cookies(e.g., Chocolate chip cookies) and these two integers are passed in as the parameters to the CookiePackconstructor.• The IceCream class is derived from the Dessert class. An IceCream object simply has a cost indollars (int). The starting value of this cost is passed as the parameter to the IceCream constructor.• The Sundae class is derived from the IceCream class. The cost of a Sundae is the cost of theIceCream plus the cost of the topping in dollars (int). The starting value of the topping’s cost is passedas a parameter to the Sundae constructor.Inside of your DessertCafe class write a main() method that defines an ArrayList of Dessert references:ArrayList desserts. Due to polymorphism you can store objects of any subclassof Dessert inside this ArrayList. Create two objects of every type of subclass of Dessert (i.e., Cake,CookiePack, IceCream and Sundae). Pick appropriate arguments (actual values) for each constructor whenyou construct each object. Add these objects in any order to the ArrayList. Finally, write a for-loop thatiterates over the ArrayList, printing the name and cost of every dessert item in the collection by calling thegetName() and getCost() methods.

Answers

Not Rated (0)
Status NEW Posted 21 Jul 2017 12:07 PM My Price 12.00

Hel-----------lo -----------Sir-----------/Ma-----------dam----------- Â-----------  -----------Tha-----------nk -----------you----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------acq-----------uis-----------iti-----------on -----------of -----------my -----------pos-----------ted----------- so-----------lut-----------ion-----------.Pl-----------eas-----------e p-----------ing----------- me----------- on----------- ch-----------at -----------I a-----------m Â----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I

Not Rated(0)