Question: Strategy pattern is used when we have multiple algorithms for a specific task and client decides the actual implementation to be used at runtime. For

Strategy pattern is used when we have multiple algorithms for a specific task and client decides the actual implementation to be used at runtime.
For this task, complete the simple Shopping Cart implementation modelled in the CDC diagram below where there are two payment strategies using Credit Card or using PayPal.
Summary: Create a simple application described in a provided CDC diagram.
Questions:
Task 3: Strategy pattern is used when we have multiple algorithms for a specific task and client decides the actual implementation to be used at runtime. For this task, complete the simple Shopping Cart implementation modelled in the CDC diagram below where there are two payment strategies using Credit Card or using PayPal.
Complete the Implementation of the application in the CDC diagram following exactly the steps below:
1. Create a folder named YourIDTask3 and initialize in it a Git repository.
2. Configure the repository to ignore .class files.
3. Open Notepad++ and create a text file for Git commands and its output. Initially, save the file empty with name log.txt.
4. Use Notepad++ create Java files for your code. Save files into the repository.
5. During coding, make sure you work incrementally; that is:
a. Define an empty class
b. Save file containing class
c. Compile file using javac followed by the file name
d. If your compilation is successful, stage the source file, store it in the repository,
e. Copy all Git commands to log.txt and save it to the repository folder, stage it and store it into the Git repository.
f. Repeat Step d.
6. Repeat Step 6 until all classes and methods are completed.
7. Track all files.
8. Store all files to the repository.
9. Show the status of your repository.
10. Append Git commands and results to log.txt and store it to your repository.
11. Compress the repository and upload at Task3 link in the Lab course website.
Your Solution:
Interface PaymentStrategy {
.....................................
.....................................
.....................................
.....................................
Public class PaypalStrategy ............................
............................................................................
............................................................................
............................................................................
............................................................................
Public class CreditCardStrategy ............................
............................................................................
............................................................................
............................................................................
............................................................................

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!