Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please help me with the following Java programming project task, I hope to get a correct answer as a reference, thank you very much. I
Please help me with the following Java programming project task, I hope to get a correct answer as a reference, thank you very much.
I need to complete the DimSum class for storing the information of the dim sum dishes,such as
Barbecued pork bun $
Shrimp dumpling $
Siu mai $
Spring roll $
For example, if you want to create the dim sum 'Siu Mai' you will use the following code:
DimSum siumai new DimSumSiu Mai", f;
The above example creates an instance of the DimSum class and the dimsum object stores the name as "Siu Mai" and its price as For the class, you need to store the input parameters name and price to the name attribute and the price attribute. You may find that you need to use this.name and this.price when you assign the values to the attributes, for example like this:
this.name ;
this.price ;
After that you also need to initialize the quantity attribute to become
Here's the unfinished part of the code, please help me build on it to complete it
public class DimSum
Task create the attributes
The name of the dim sum
The price of the dim sum
The quantity ordered
Constructor of the class
public DimSumString name, float price
Task Initialize the attributes of the dim sum
Return the name of the dim sum
public String getName
Task Return the name of the dim sum
return "DimSum";
Return the price of the dim sum
public float getPrice
Task Return the price of the dim sum
return f;
Return the quantity ordered
public int getQuantity
Task Return the quantity of the dim sum
return ;
ds Order this dim sum dish
public void orderint quantity
Task Increase the quantity ordered
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