Answered step by step
Verified Expert Solution
Question
1 Approved Answer
To do: FRUIT and FRUITDRIVER Java Class>> Fruit quzweek type: String a numCalories: int o kgWeight: double a cost: double Fruit) Fruit(String.int,double,double) o toString0:String costPerKg0.double
To do: FRUIT and FRUITDRIVER Java Class>> Fruit quzweek type: String a numCalories: int o kgWeight: double a cost: double Fruit) Fruit(String.int,double,double) o toString0:String costPerKg0.double calPerKg0:double o getType): String o setType(String).void o getNumCalories0:int o setNumCalories(int)void o getKgWeight():double o setgWeight(double):void o getCost0:double o setCost(double):void This is a UML diagram which is a great way to summarize a blueprint! We will discuss these in our sessions. Note that the red box means private and the green circle means public. C-constructor, F-final, S-static. Note how the methods give you their signature, with the parameter types in parentheses and the return type after the colon Write a driver that creates the following three fruits Fruit b-mkxuit("banana",94,0.20,0.50) Fruit anew Fruitl apple",52,0.10,0.45) Fruit or new Eruitlorange",86,0.20,0.55) Then have it calculate and print out the fruit with the lowest cost per kilogram. Your output should look similar to mine A typical banana weights0.2 kilograms, has 94 calories and costs $0.50 each A typical apple weights 0.1 kilograms, has 52 calories and costs $0.45 each A typical orange weights 0.2 kilograms, has 86 calories and costs $0.55 each The cost per kg is $2.50 and the calories per kg is 470.0 The cost per kg is $4.50 and the calories per kg is 520.0 The cost per kq is $2.75 and the calories per kg is 430.0 A banana has the lowest cost per kg
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