PROBLEM #2 (60 points) The GasPump class (component) supports the following operations: change. How the system...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
PROBLEM #2 (60 points) The GasPump class (component) supports the following operations: change. How the system notifies the registered user component about the out-of-range stock price change. Activate (float a, b) PayCredit(float limit) PayCash(float c) Regular() Super() StartPump() PumpGallon() StopPump() Receipt() TurnOff() The GasPump is a state-based component that is used to control a simple gas pump. Users can pay by cash or a credit card. The gas pump disposes two types of gasoline: Regular and Super. The price of gasoline is provided when the gas pump is activated. A simplified EFSM model for the GasPump component is shown in Figure 1. Design the system using the State design pattern. Provide two solutions: de-centralized version of the State pattern centralized version of the State pattern // the gas pump is activated where a represents the price of Regular gas // and b represents the price of Super gas // pay for gas by a credit card where limit represents the available credit on // the credit card // pay for gas by cash, where c represents prepaid cash // Regular gas is selected Notice that the components in your design should be de-coupled as much as possible. In addition, components should have high cohesion. T Activate(a,b)/ Rprice=a; Sprice=b; // Super gas is selected // start pumping gas For each solution: a. Provide a class diagram for the system. For each class list all operations with parameters and specify them using pseudo-code. In addition, for each class provide its attributes and data structures. Make the necessary assumptions for your design. Start price=a: G=0; // one gallon of gas is disposed // stop pumping gas // Receipt is printed // the gas pump is turned off b. Provide a sequence diagram for the following operation sequence: Activate (5.5,7), PayCredit(110), Super(), StartPump(), PumpGallon(), StopPump(), Receipt() T14 TurnOff() Exit When the EFSM model is "executed" on this sequence of operations, the following sequence of transitions is traversed/executed: T, T3, T6, T7, T9, T11, T13 S5 T PayCredit(limit) [limit 0]/w=1; T11 StopPump()/ total=G*price; Tg PumpGallon()/G=G+1 T12 PumpGallon()[cash =price*(G+1)]/ G=G+1; T5 Regular()/ price = Rprice; T7 StartPump()[w==1] T8 StartPump() [w==0]/ cash-cash 1.1, S T6 Super()/ price = Sprice; PROBLEM #2 (60 points) The GasPump class (component) supports the following operations: change. How the system notifies the registered user component about the out-of-range stock price change. Activate (float a, b) PayCredit(float limit) PayCash(float c) Regular() Super() StartPump() PumpGallon() StopPump() Receipt() TurnOff() The GasPump is a state-based component that is used to control a simple gas pump. Users can pay by cash or a credit card. The gas pump disposes two types of gasoline: Regular and Super. The price of gasoline is provided when the gas pump is activated. A simplified EFSM model for the GasPump component is shown in Figure 1. Design the system using the State design pattern. Provide two solutions: de-centralized version of the State pattern centralized version of the State pattern // the gas pump is activated where a represents the price of Regular gas // and b represents the price of Super gas // pay for gas by a credit card where limit represents the available credit on // the credit card // pay for gas by cash, where c represents prepaid cash // Regular gas is selected Notice that the components in your design should be de-coupled as much as possible. In addition, components should have high cohesion. T Activate(a,b)/ Rprice=a; Sprice=b; // Super gas is selected // start pumping gas For each solution: a. Provide a class diagram for the system. For each class list all operations with parameters and specify them using pseudo-code. In addition, for each class provide its attributes and data structures. Make the necessary assumptions for your design. Start price=a: G=0; // one gallon of gas is disposed // stop pumping gas // Receipt is printed // the gas pump is turned off b. Provide a sequence diagram for the following operation sequence: Activate (5.5,7), PayCredit(110), Super(), StartPump(), PumpGallon(), StopPump(), Receipt() T14 TurnOff() Exit When the EFSM model is "executed" on this sequence of operations, the following sequence of transitions is traversed/executed: T, T3, T6, T7, T9, T11, T13 S5 T PayCredit(limit) [limit 0]/w=1; T11 StopPump()/ total=G*price; Tg PumpGallon()/G=G+1 T12 PumpGallon()[cash =price*(G+1)]/ G=G+1; T5 Regular()/ price = Rprice; T7 StartPump()[w==1] T8 StartPump() [w==0]/ cash-cash 1.1, S T6 Super()/ price = Sprice;
Expert Answer:
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Managing Scope Changes Case Study Scope changes on a project can occur regardless of how well the project is planned or executed. Scope changes can be the result of something that was omitted during...
-
On January 1, 2010, Phelps Company purchased an 85% interest in Sloane Company for $955,000 when the retained earnings of Sloane Company were $150,000. The difference between implied and book value...
-
The following is the pre closing trial balance for Allen University as of June 30, 2017. Additional information related to net assets and the statement of cash flows is also provided. Additional...
-
You will create a program which tracks the balance and number of transactions for a gift card. Display a prompt to the Terminal user and scan in (using the scanf( ) command) the initial value of the...
-
Identify at least three ways you can obtain information about the location of the debtors assets.
-
Demand for stereo headphones and an MP3 player for joggers has caused Nina Industries to grow almost 50 percent over the past year. The number of joggers continues to expand, so Nina expects demand...
-
Please find the following derivative a) f(t)=sin(t)
-
A simple lumped-parameter model of a building, shown as the inverted link in Figure 6.68, can be used for preliminary study of earthquake dynamics. Derive the equations of motion for this two...
-
What strategy for entering a new international market would you recommend to your company? You may consider acquisitions, setting up a facility from scratch, forming an alliance or joint venture, or...
-
Prove that if f [a, b] (a,b) - R is a differentiable function on (the interior of) its domain, then f': R satisfies the intermediate value theorem: for any c
-
Bill plans to open a do-it-yourself dog bathing center in a storefront, The bathing equipment will cost $180,000, Bill expects the after-tax cash inflows to be $40,000 annually for five years, after...
-
1: Find the arc length as a function of X(8) = [(ro+r)cose -rcos ( along the epicycloid if cose)] + [(ro+r)cose -rcos (Te cose)]1
-
1. eXclusive-OR (XOR), denoted by the symbol, is a logical operation that performs the following Boolean operation: x+y = xy' + x'y XOR is 1 if x and y are the complements of each other. Using truth...
-
Antoine's equation is a correlation for vapor pressures based on the Clausius- Clapeyron equation. It has been used over limited temperature ranges. 2. log0Pvap = A where T is in K and Pvap is in...
-
How does an agile team maintain requirements? Select only one answer. Every team member maintains a personal backlog of items they are working on. Facilitator/Onsite coordinator maintains the...
-
1. Using the information from Problem 16-4B, prepare a statement of cash flows for Lim Garden Supplies Inc. using the direct method of presenting cash flows from operating activities. 2. How does Lim...
-
Ken paid the following amounts for interest during 2012: Qualified interest on home mortgage...........................................$4,700 Auto loan...
-
In June of 2012, Maureen's house is vandalized during a long-term power failure after a hurricane hit the city. The president of the United States declares Maureen's city a disaster area as a result...
-
Frank, age 35, and Joyce, age 34, are married and file a joint income tax return for 2012. Their salaries for the year total $83,000 and they have taxable interest income of $4,000. They have no...
-
Steam flows steadily and isentropically through a nozzle. At an upstream section where the speed is negligible, the temperature and pressure are \(450^{\circ} \mathrm{C}\) and \(6 \mathrm{MPa}\)...
-
Space debris impact is a real concern for spacecraft. If a piece of space debris were to create a hole of \(0.001 \mathrm{in} .^{2}\) area in the hull of the International Space Station (ISS), at...
-
Oxygen discharges from a tank through a convergent nozzle. The temperature and velocity in the jet are \(-20^{\circ} \mathrm{C}\) and \(270 \mathrm{~m} / \mathrm{s}\), respectively. What is the...
Study smarter with the SolutionInn App