Question: Solution must on Python Program with software design pattern implementation Assume there are three libraries, each with the identical goal of predicting future oil prices.
Solution must on Python Program with software design pattern implementation
Assume there are three libraries, each with the identical goal of predicting future oil prices. Of course, the predictive algorithms are different, and the inputs are also different. For example,
class PredictiveOil1:
def predictFuturePrice(futureDate, currentPrice, someData):
class PredictiveOil2:
def predictFuturePrice(futureDate, currentPrice, someData1, someData2):
class PredictiveOil3:
def predictFuturePrice(futureDate, currentPrice, someData1, someData2, someData3):
Currently, if a client want to use these libraries, they must develop three separate client programs. For example,
To use PredictiveOil1,
def main():
po = new PredictiveOil1()
futureDate = input()
currentDate = input()
someData = input()
futurePrice = po.predictFuturePrice(futureDate, currentPrice, someData)
To use PredictiveOil2,
def main():
po = new PredictiveOil2()
futureDate = input()
currentDate = input()
someData1 = input()
someData2 = input()
futurePrice = po.predictFuturePrice(futureDate, currentPrice, someData1, someData2)
To use PredictiveOil3,
def main():
po = new PredictiveOil3()
futureDate = input()
currentDate = input()
someData1 = input()
someData2 = input()
someData3 = input()
futurePrice = po.predictFuturePrice(futureDate, currentPrice, someData1, someData2, someData3)
You can design software using one or more design patterns such that the user only has to develop one client program that allows the user to select a prediction model. Even if a new prediction model is added in the future, the same client program can still be used. You are required to write a Python code to demonstrate your idea.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
