Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

Assignment 2 Gift Hierarchy Before attempting this project, be sure you have completed all of the reading assignments, non- graded exercises, discussions, and assignments to date. Design and implement...

1 answer below »
Assignment 2
Gift Hierarchy
Before attempting this project, be sure you have completed all of the reading assignments, non-
graded exercises, discussions, and assignments to date.
Design and implement Java program as follows:
(1) There will be a Gift class with following attributes: id (combination of numbers and letters),
size (values S, M, or L), and price
(2) There will be two child classes FruitBasket and SweetsBasket with the following additional
attributes:
ï‚· FruitBasket: number of fruits, include citrus fruits indication (true or false)
ï‚· SweetsBasket: include nuts indication (true or false)
(3) The Gift class hierarchy must provide the following Functionality:
ï‚· On creation, a gift instance must be given all attribute values except price which must be
calculated and number of fruits which must be set by system
ï‚· All attribute values can be changed after creation except id and the values that are
calculated or set by the system
ï‚· Price is calculated as follows:
o There is a flat fee of 19.99 for S gift, 29.99 for M gift, and 39.99 for L gift.
o Fruit basket gift has additional fee of 5.99 when it has citrus fruits.
ï‚· Number of fruits in a basket is as follows: Small size has 6 fruits, M has 9 fruits, and L
has 15 fruits
 Each class must have a method to return or display the class’s values to the console
(4) Implement OrderSystem class with main method with following functionality:
ï‚· Order a gift
ï‚· Change a gift
ï‚· Display gift
(5) Your classes must be coded with co
ect encapsulation: private/protected attributes, get
methods, and set methods and value validation
(6) There should be appropriate overloading and ove
iding methods
(7) OrderSystem should take advantage of the inheritance properties (e.g. use Gift variable
egardless which gift instance as appropriate)
Style and Documentation:
Make sure your Java program is using the recommended style such as:
ï‚· Javadoc comment up front with your name as author, date, and
ief purpose of the
program
ï‚· Comments for variables and blocks of code to describe major functionality
ï‚· Meaningful variable names and prompts
ï‚· Class names are written in upper CamelCase
ï‚· Constants are written in All Capitals
ï‚· Use proper spacing and empty lines to make code human readable
Capture execution:
You should capture and label screen captures associated with compiling your code, and running
the a passing and failing scenario for each functionality
Sample run 1:

MENU
1: Order a Gift Basket
2: Change Gift Basket
3: Display Gift
9: Exit program

Enter your selection : 3

No gift has been ordered yet

MENU
1: Order a Gift Basket
2: Change Gift Basket
3: Display Gift
9: Exit program

Enter your selection : 9

Thank you for using the program. Goodbye!
Sample run 2:

MENU
1: Order a Gift Basket
2: Change Gift Basket
3: Display Gift
9: Exit program

Enter your selection : 2

No gift has been ordered yet

Sample run 3:

MENU
1: Order a Gift Basket
2: Change Gift Basket
3: Display Gift
9: Exit program

Enter your selection : 1
Do you want Fruit Basket (1) or Sweets Basket (2): 1
What size do you want: S, M, or L: S
Do you want citrus fruits included? true/false: true

MENU
1: Order a Gift Basket
2: Change Gift Basket
3: Display Gift
9: Exit program

Enter your selection : 3

FruitBasket [numFruits=6 haveCitrus=true size=S id=FB3150 price=25.98]

MENU
1: Order a Gift Basket
2: Change Gift Basket
3: Display Gift
9: Exit program

Enter your selection : 2
Cu
ent gift size is: S What size do you want? S, M, or L:
M
Cu
ent basket citrus=true Do you want citrus fruits included? true/false: false

MENU
1: Order a Gift Basket
2: Change Gift Basket
3: Display Gift
9: Exit program

Enter your selection : 3

FruitBasket [numFruits=9 haveCitrus=false size=M id=FB3150 price=29.99]

MENU
1: Order a Gift Basket
2: Change Gift Basket
3: Display Gift
9: Exit program

Enter your selection : 9

Thank you for using the program. Goodbye!


Submission requirements
Deliverables include Java program (.java) and a single Word (or PDF) document. The Java and
Word/PDF files should be named appropriately for the assignment (as indicated in the
SubmissionRequirements document.
The word (or PDF) document should include screen captures showing the successful compiling
and running of each of the test scenario. Test scenarios should include all required functionality
of the program. Each screen capture should be properly labeled clearly indicated what the screen
capture represents.
Submit your files to Assignment 2 submission area no later than the due date listed in your
online classroom.
Grading Ru
ic:
The following grading ru
ic will be used to determine your grade:
Attribute Level
(15-20 points)
Level
(5-15 points)
Level 0
(0 - 5 points)
The Gift hierarchy
classes
Co
ect or
almost co
ect
attributes and
inheritance
structure
Mistakes in
implementation
Missing or significantly
inco
ect implementation
Calculate price Co
ect or
almost co
ect
code to calculate
price using
ove
iding
Mistakes in
implementation
Missing or significantly
inco
ect implementation
Encapsulation Co
ect or
almost co
ect
code for
encapsulation
Mistakes in
implementation
Missing or significantly
inco
ect implementation
Test class Co
ect or
almost co
ect
code to meet
equired
functionality
Mistakes in
implementation
Missing or significantly
inco
ect implementation
Program
documentation and
style, screen
captures
Co
ect or
almost co
ect
menu, program
comments,
identifiers, and
screen captures
Mistakes or
incomplete menu,
documentation
and/or style, and
screen captures
Missing or significantly
inco
ect menu, documentation
and/or style, or screen captures
Answered 2 days After Apr 10, 2021

Solution

Arun Shankar answered on Apr 12 2021
166 Votes
Project_Inheritance/.classpath

    
        
            
        
    
    
    
Project_Inheritance/.project

     Project_Inheritance
    
    
    
    
        
             org.eclipse.jdt.core.javabuilde
            
            
        
    
    
        ...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here