Instructions Today you will be given a Frult class. From this, you will subclass Frult to make an Lemon and Pear class. The Frult class has the following fields: - peel (boolean) : tells us if we can eat the skin (false) or must peel the fruit (true) - colour (String) : Colour of the outside of the fruit It has a constructor and five methods, including a toString() method, 2 getters and 2 setters. Frult boolean peel String colour boolean : getPeelO void : setPeel(boolean) String : getColour(] void : setColour(String) String : toString() Details Input The main method will be given the following input: - a String (fruitType): either "PEAR" or "LEMON" - this will determine which subclass of fruit is created. - a boolean (peelSkin): used to determine if one must peel the fruit before eating or not. - a String (skinColour): used to modify the skin colour set for the fruit. Processing - Create a Pear subclass - Set up the subclass so that new Pear objects are set up to have peel set to false (pear skin is edible!) and co - Create an Lemon subclass

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Java.

 

Instructions
Today you will be given a Frult class. From this, you will subclass Frult to make an Lemon and Pear class.
The Frult class has the following fields:
peel (boolean) : tells us if we can eat the skin (false) or must peel the fruit (true)
colour (String) : Colour of the outside of the fruit
It has a constructor and five methods, including a toString() method, 2 getters and 2 setters.
Frult
boolean peel
String colour
boolean : getPeel()
void : setPeel(boolean)
String : getColour()
void : setColour(String)
String : toString()
Details
Input
The main method will be given the following input:
- a String (frultType): either "PEAR" or "LEMON" - this will determine which subclass of frult is created.
- a boolean (peelSkin): used to determine if one must peel the fruit before eating or not.
- a String (skinColour): used to modify the skin colour set for the fruit.
Processing
- Create a Pear subclass
- Set up the subclass so that new Pear objects are set up to have peel set to false (pear skin is edible!) and colour set to "green" (even though pears come in many fun shades!).
- Create an Lemon subclass
- Set up the subclass so that new Lemon objects are set up to have peel set to true and colour set to "yellow".
Transcribed Image Text:Instructions Today you will be given a Frult class. From this, you will subclass Frult to make an Lemon and Pear class. The Frult class has the following fields: peel (boolean) : tells us if we can eat the skin (false) or must peel the fruit (true) colour (String) : Colour of the outside of the fruit It has a constructor and five methods, including a toString() method, 2 getters and 2 setters. Frult boolean peel String colour boolean : getPeel() void : setPeel(boolean) String : getColour() void : setColour(String) String : toString() Details Input The main method will be given the following input: - a String (frultType): either "PEAR" or "LEMON" - this will determine which subclass of frult is created. - a boolean (peelSkin): used to determine if one must peel the fruit before eating or not. - a String (skinColour): used to modify the skin colour set for the fruit. Processing - Create a Pear subclass - Set up the subclass so that new Pear objects are set up to have peel set to false (pear skin is edible!) and colour set to "green" (even though pears come in many fun shades!). - Create an Lemon subclass - Set up the subclass so that new Lemon objects are set up to have peel set to true and colour set to "yellow".
Details
Input
The main method will be given the following input:
- a String (frultType): either "PEAR" or "LEMON" - this will determine which subclass of frult is created.
- a boolean (peelSkin): used to determine if one must peel the fruit before eating or not.
- a String (skinColour): used to modify the skin colour set for the fruit.
Processing
- Create a Pear subclass
- Set up the subclass so that new Pear objects are set up to have peel set to false (pear skin is edible!) and colour set to "green" (even though pears come in many fun shades!).
- Create an Lemon subclass
- Set up the subclass so that new Lemon objects are set up to have peel set to true and colour set to "yellow".
Output
The format of the output is given to you by the toString() method in the Fruitjava object class. This will be used by the main method in PoD.java
The main method will output the default version of the new object followed by the updated version after modifying it based on the input of peelSkin and sklnColour
Sample Input/output:
Sample Input
Sample Output
-------PEAR-------
Peel: no, skin is edible
Colour: green
-------UPDATED-------
Peel: yes, you must peel
Colour: purple
PEAR true purple
END OF OUTPUT
Transcribed Image Text:Details Input The main method will be given the following input: - a String (frultType): either "PEAR" or "LEMON" - this will determine which subclass of frult is created. - a boolean (peelSkin): used to determine if one must peel the fruit before eating or not. - a String (skinColour): used to modify the skin colour set for the fruit. Processing - Create a Pear subclass - Set up the subclass so that new Pear objects are set up to have peel set to false (pear skin is edible!) and colour set to "green" (even though pears come in many fun shades!). - Create an Lemon subclass - Set up the subclass so that new Lemon objects are set up to have peel set to true and colour set to "yellow". Output The format of the output is given to you by the toString() method in the Fruitjava object class. This will be used by the main method in PoD.java The main method will output the default version of the new object followed by the updated version after modifying it based on the input of peelSkin and sklnColour Sample Input/output: Sample Input Sample Output -------PEAR------- Peel: no, skin is edible Colour: green -------UPDATED------- Peel: yes, you must peel Colour: purple PEAR true purple END OF OUTPUT
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Introduction to computer system
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education