Step 3: Add a basic WineCase class and allow a buyer to select a case of wine to buy.   Write a basic WineCase class to represent a case of wine. A WineCase object has four fields: refNo (a unique sequence of letters and digits), description (e.g. "chablis", "white burgundy" or similar), noOfBottles (in the case) and price (the price of the case in pounds).  The constructor for the class should be passed suitable arguments to initialise these four fields. Add a selectWineCase() method to the Browser class which allows a browser to choose a case of wine provided that browser is a buyer. This method is passed a WineCase object as a parameter. You should declare a new field wineCase in the Browser class in order to store the case of wine selected.   Make the selectWinecase() method print a message to the terminal window about the selection. An example is shown below:            Buyer with ID 6732 has selected wine case with reference             number LO786, a case of 2018 Pinot from Italy of 12 bottles          at £120   Step 4: Allow a buyer to pay for the case of wine. Add a method payForWine() to the Browser This method will simply call a method in the Website class to pay for the wine i.e. to record the transaction with the website.   And  here we have a problem: at the moment the Website object does not record which browser has entered the store and, conversely, the Browser object also keeps no details of which site it has entered. Let’s deal with that now.   b) Add another field website to the Browser This field will be used to store a reference (i.e. a pointer) to the website the browser is currently logged into.  Write a mutator method setWebsite().

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter11: Advanced Inheritance Concepts
Section: Chapter Questions
Problem 2PE
icon
Related questions
Question
100%

Step 3: Add a basic WineCase class and allow a buyer to select a case of wine to buy.

 

  1. Write a basic WineCase class to represent a case of wine. A WineCase object has four fields: refNo (a unique sequence of letters and digits), description (e.g. "chablis", "white burgundy" or similar), noOfBottles (in the case) and price (the price of the case in pounds).  The constructor for the class should be passed suitable arguments to initialise these four fields.
  2. Add a selectWineCase() method to the Browser class which allows a browser to choose a case of wine provided that browser is a buyer. This method is passed a WineCase object as a parameter. You should declare a new field wineCase in the Browser class in order to store the case of wine selected.

 

  1. Make the selectWinecase() method print a message to the terminal window about the selection. An example is shown below:

           Buyer with ID 6732 has selected wine case with reference

            number LO786, a case of 2018 Pinot from Italy of 12 bottles

         at £120

 

Step 4: Allow a buyer to pay for the case of wine.

  1. Add a method payForWine() to the Browser This method will simply call a method in the Website class to pay for the wine i.e. to record the transaction with the website.

 

And  here we have a problem: at the moment the Website object does not record which browser has entered the store and, conversely, the Browser object also keeps no details of which site it has entered. Let’s deal with that now.

 

  1. b) Add another field website to the Browser This field will be used to store a reference (i.e. a pointer) to the website the browser is currently logged into.  Write a mutator method setWebsite().
Expert Solution
steps

Step by step

Solved in 2 steps with 6 images

Blurred answer
Knowledge Booster
Class
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.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT