Question: Please Help, Add the class CoffeeBeanOrder below CoffeeBeanOrder _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ - weight:double
Please Help, Add the class CoffeeBeanOrder below
CoffeeBeanOrder
weight:double
quality:int
CoffeeBeanOrder
CoffeeBeanOrderdoubleint
setWeightdouble:void
getWeight:double
setQualityint:void
getQuality: int
calcCost:double
calcShipping: double
toString: String
Additional specifications:
The CoffeeBeanOrder no arg constructor should set both fields to zero.
The parameterized constructor should have parameters ordered:
CoffeeBeanOrder double weight, int quality
The integer quality field is defined as:
Marginal
Good
Best
Calculate theorder cost using the following:
Margin coffee: $pound
Good coffee: $pound
Best coffee: $pound
Calculate the shipping cost as: $pound
Method toString should return a String in a format of your choice that contains the current values of weight and quality, but report MarginalGood or Bad instead of the integer value for quality. Add the above to the program below. public class TestCoffee
public static void main String args
Test noarg constructor
CoffeeBeanOrder order new CoffeeBeanOrder;
System.out.printlnorder;
Test setters, toString and calculations
ordersetWeight;
ordersetQuality;
System.out.printlnorder;
System.out.printlnordercalcCost;
System.out.printlnordercalcShipping;
Test parameterized constructor, and calculations
CoffeeBeanOrder order new CoffeeBeanOrder;
System.out.printlnorder;
System.out.printlnordercalcCost;
System.out.printlnordercalcShipping;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
