Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please Help, Use the code below. CoffeeBeanOrder _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ - weight:double -
Please Help, Use the code 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. 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
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