Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

=+What is the most challenging part of working in social media?

Answered: 1 week ago