Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
9th Edition
ISBN: 9781337669405
Author: FARRELL
Publisher: Cengage
expand_more
expand_more
format_list_bulleted
Bartleby Related Questions Icon
Related questions
Question
I am having trouble figuring out how to construct this code in my self-studying of Java.
Transcribed Image Text: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.
Transcribed Image Text: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
Expert Solution
Check MarkThis question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
bartleby
Step by stepSolved in 2 steps
Knowledge Booster
Background pattern image
Recommended textbooks for you
- Text book imageProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageText book imageC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningText book imageEBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
- Text book imageC++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrText book imageMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,Text book imageSystems ArchitectureComputer ScienceISBN:9781305080195Author:Stephen D. BurdPublisher:Cengage Learning
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Text book image
Systems Architecture
Computer Science
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Cengage Learning