Requirements: 1. Class - Fruit • о Create an abstract class named Fruit. Define at least three fields to describe the fruit with the appropriate access modifiers (e.g. color, type, etc.) • Define a price variable with the appropriate access modifier Constructors: • Implement a copy constructor that takes a Vehicle object as a parameter and initializes the fields accordingly. Methods: o Define necessary accessor and mutator methods. ⚫ Define at least three abstract methods for this class • Define another abstract method to calculate the total price of the fruit. Add a 7% sales tax to each purchase 2. Fruit Classes - Create a least two other classes that represent a piece of fruit (e.g. orange, kiwi). These classes will inherit the Fruit class - These classes must be implemented in different files • Class names should reflect the type of fruit that is being implemented Methods: 。 Implement all abstract methods (override the method in the Fruit class to calculate the total price of the fruit Override the toString method to reflect each specific fruit details 3. Class Demo • Demonstrate the functionality of the fruit stand in a separate class called Demo. 。 Create necessary objects from Fruit classes to allow users to shop 4. Input Validation • Ensure users can input case-insensitive values to quit the program. 。 Validate menu options to ensure that only valid selections are accepted, catching any invalid inputs. 5. Output 。 Display fruit stand information in a user-friendly format Format prices to include dollar signs, two decimal places, and commas 。 Display fruit price and total price of purchase after the user finishes shopping 6. Implementation Details о Utilize concepts from chapters 1-11 only. Follow the program rubric closely. Sample Runs (Please use your own fruit classes. The fruits below are for example): Run 1 - Purchase one fruit item Welcome to the Fruit Stand! We sell Red Apples, Green Apples, and Bananas What fruit would you like to purchase? Banana How many Bananas would you like to purchase? 1 Would you like to continue shopping? (Yes or No) No You purchased 1 Banana(s) at $1.39 each. Product Details: Color: Yellow Texture: Soft Type: Organic Has Seeds: true Your total price is $1.49
Requirements: 1. Class - Fruit • о Create an abstract class named Fruit. Define at least three fields to describe the fruit with the appropriate access modifiers (e.g. color, type, etc.) • Define a price variable with the appropriate access modifier Constructors: • Implement a copy constructor that takes a Vehicle object as a parameter and initializes the fields accordingly. Methods: o Define necessary accessor and mutator methods. ⚫ Define at least three abstract methods for this class • Define another abstract method to calculate the total price of the fruit. Add a 7% sales tax to each purchase 2. Fruit Classes - Create a least two other classes that represent a piece of fruit (e.g. orange, kiwi). These classes will inherit the Fruit class - These classes must be implemented in different files • Class names should reflect the type of fruit that is being implemented Methods: 。 Implement all abstract methods (override the method in the Fruit class to calculate the total price of the fruit Override the toString method to reflect each specific fruit details 3. Class Demo • Demonstrate the functionality of the fruit stand in a separate class called Demo. 。 Create necessary objects from Fruit classes to allow users to shop 4. Input Validation • Ensure users can input case-insensitive values to quit the program. 。 Validate menu options to ensure that only valid selections are accepted, catching any invalid inputs. 5. Output 。 Display fruit stand information in a user-friendly format Format prices to include dollar signs, two decimal places, and commas 。 Display fruit price and total price of purchase after the user finishes shopping 6. Implementation Details о Utilize concepts from chapters 1-11 only. Follow the program rubric closely. Sample Runs (Please use your own fruit classes. The fruits below are for example): Run 1 - Purchase one fruit item Welcome to the Fruit Stand! We sell Red Apples, Green Apples, and Bananas What fruit would you like to purchase? Banana How many Bananas would you like to purchase? 1 Would you like to continue shopping? (Yes or No) No You purchased 1 Banana(s) at $1.39 each. Product Details: Color: Yellow Texture: Soft Type: Organic Has Seeds: true Your total price is $1.49
Chapter11: Advanced Inheritance Concepts
Section: Chapter Questions
Problem 5RQ
Related questions
Question
I am having trouble figuring out how to construct this code in my self-studying of Java.
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps
Recommended textbooks for you
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,