1.1 The class Cupcake has the following attributes: Name – example: vanilla, red velvet Code – example: CV123 Price per piece a) Write a complete class called Cupcake with the following methods: i....


Java - OOP


1.1<br>The class Cupcake has the following attributes:<br>Name – example: vanilla, red velvet<br>Code – example: CV123<br>Price per piece<br>a) Write a complete class called Cupcake with the following methods:<br>i. Default/Normal/Copy constructors<br>ii. Mutator method for all data members<br>iii. Accessor methods for all data members<br>iv. tostring () method to return the objects' information<br>v. priceInDozen (): a method that will return the price of the cupcake.<br>Discount will be calculated based on the last character of the code.<br>Otherwise no discount will be given. The discount rate for each code are as<br>follows:<br>Character<br>Rate<br>'1'<br>5%<br>8%<br>'2'<br>'3'<br>10%<br>Example: discount for a dozen of cupcakes with code CV123 is 10%<br>b) Write an application class called CupcakeApp to perform the following:<br>i.<br>Declare and create an array of cupcake objects and store the data onto<br>array. The size of array will be entered by the user.<br>ii.<br>Calculate and display the net price of cupcakes.<br>ii.<br>Calculate and display the total price of all cupcakes.<br>

Extracted text: 1.1 The class Cupcake has the following attributes: Name – example: vanilla, red velvet Code – example: CV123 Price per piece a) Write a complete class called Cupcake with the following methods: i. Default/Normal/Copy constructors ii. Mutator method for all data members iii. Accessor methods for all data members iv. tostring () method to return the objects' information v. priceInDozen (): a method that will return the price of the cupcake. Discount will be calculated based on the last character of the code. Otherwise no discount will be given. The discount rate for each code are as follows: Character Rate '1' 5% 8% '2' '3' 10% Example: discount for a dozen of cupcakes with code CV123 is 10% b) Write an application class called CupcakeApp to perform the following: i. Declare and create an array of cupcake objects and store the data onto array. The size of array will be entered by the user. ii. Calculate and display the net price of cupcakes. ii. Calculate and display the total price of all cupcakes.

Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here