Question: Programming Assignment #4 Assignment Objective This programming assignment will utilize Object Oriented principles to develop an application called DessertShop. Stage 1: Develop Abstract Parent class




Programming Assignment #4 Assignment Objective This programming assignment will utilize Object Oriented principles to develop an application called DessertShop. Stage 1: Develop Abstract Parent class and sub-classes using Inheritance The objective of the first stage of the project is to develop the proper implementation of an abstract parent class (Dessertltem) and the necessary derived classes (Candy, Cookie, and IceCream) implementing Inheritance. The user will develop the Dessert Shop application with the details below. Stage 1: Task(s) Class Definitions Define the Desserttem abstract superclass from which specific types of Dessertitem's can be derived. This abstract class contains only one instance variable, name. This class must contain a default Constructor. This class must contain a constructor which can be used to pass in the name of the item This class must contain the getName() method to retrieve the name instance variable This class must contain the setName() method to set the name instance variable The class must contain an abstract method, getCost(), which is not defined in this class because determining the costs varies based on the type of the item. The Dessertshop application must contain a number of derived classes. The Candy class must be derived from the Dessertitem class. The Candy class contains only two instance variables: weight and pricePerPound. A Candy item has a weight and a price per pound which is used to determine its cost. For example, 2.30 lbs of fudge @ 0.89/Ib. = 205 cents. The cost must be rounded to the nearest cent. The Cookie class must be derived from the Dessertltem class. The Cookie class contains only two instance variables: itemCount and pricePerDozen. A Cookie item has a number and a price per dozen which are used to determine its cost. For example, 4 cookies @ 399 cents / dozen = 133 cents. The cost must be rounded to the nearest cent. The IceCream class must be derived from the Dessertltem class. The IceCream class contains only three instance variables: numberOfScoops, pricePerScoop and topping Price. The IceCream cost is determined by adding the topping Price to the total Ice Cream cost. The cost must be rounded to the nearest cent. Each class must contain constructors, which call the constructor of the superclass. Each class must implement a toString() method to provide a formatted output of the item and the price. The toString() must use the derived getCost() method to properly calculate the individual prices. 1 | Page
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
