Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Driver: /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates *

image text in transcribed

Driver:

/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */

/** * * @author kerlin */ public class Driver {

/** * Main method to run our code * @param args NOT USED */ public static void main(String[] args) { Orange myFruit = new Orange(14, 4); System.out.println("Printing My fruit: " + myFruit); System.out.println("Juicing My fruit: " + myFruit.juice()); Fruit yourFruit = new Fruit(20); System.out.println("Printing Your fruit: " +yourFruit); yourFruit.setSeeds(5); System.out.println("Your fruit should now have 5 seeds: " + yourFruit.getSeeds()); myFruit.setDiameter(10); System.out.println("My fruit should now be 10 units in diameter: " + myFruit.getDiameter()); System.out.println("My fruit should now juice 5 units: " + myFruit.juice());

} }

image text in transcribed

Problem 2: Foods or n s pro Dem, you Will De creating a derived Class, Dase class and an?n emace . NO Drivers equ?re with. A UML diagram for this problem has been provided to assist you Fruit Class: Attribute: o Number of Seeds per instance Methods: o get and set methods for attribute o toString): returns a String describing the Fruit o constructor that takes in the Fruit's seed count Juiceable Interface: Juiceable should be its own interface which has a: Method header: juice(): returns the amount of juice obtained if the object was juiced Orange Object: Orange should be its own class and should inherit from Fruit and implement Juiceable. Orange should have: Attributes: diameter of Orange Methods: o get and set methods for diameter of Orange o toString): returns a String describing the Orange o constructor which takes in the Orange's seed count o constructor which takes in the Orange's seed count and the Orange's diameter ojuice() returns 2 units of juice for every 4 units of diameter Grading Breakdown: 10- -Correctly creating your Interface 10 -Correctly creating your Base Object 10--Correctly creating your Derived Object 10--Correctly connecting your data using the correct keywords, etc

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design And SQL For DB2

Authors: James Cooper

1st Edition

1583473572, 978-1583473573

Students also viewed these Databases questions

Question

Why is the System Build Process an iterative process?

Answered: 1 week ago