soen331_a5

.pdf

School

University of the Fraser Valley *

*We aren’t endorsed by this school

Course

13

Subject

Computer Science

Date

Oct 30, 2023

Type

pdf

Pages

2

Uploaded by kakger18

SOEN 331: Assignment 5 Adrienne Digo(40058646) Flora Avakian(40158192) Rose Rutherford-Stone(27062516) Due: November 28, 2021 Problem 1. ”To be a supervisor, one must have been employed for at least 2 years.” (Assume that we have some global variable Date that holds the current date.) Solution. context Employee inv : s e l f . supervisor > r e j e c t ( hiredate < Date 2 years ) Problem 2. ”No employee must work for a project different that any of those of his supervisor’s.” Solution. context Employee inv : s e l f . employee . supervisor > f o r A l l ( e : Employee | ( e . project = s e l f . project ) = true ) Problem 3. ”A supervisor and all of their subordinates must work in the same department.” Solution. context Employee inv : s e l f . subordinates > f o r A l l ( e : Employee | e . worksFor = s e l f . worksFor)=true ) Problem 4. ”All connections in a station must be handled by a rail company.” Solution. context Station inv : s e l f . RailCompany . connection > i n c l u d e s A l l ( s e l f . handles ) Problem 5. ”Any ticket issued for a passenger who is accompanied, is discounted.” Solution. context Passenger inv : s e l f . issued by . Ticket > s e l f . is accompanied by = True implies s e l f . discounted 1
Problem 6. Provide a contract for operation changeDepartureBy(time: Integer) that changes the departure time. Sooner departures are not permitted, and the arrival time is expected to be automat- icaly updated. Solution. context Flight : : changeDepartureBy ( time : Integer ) pre : s e l f . depatureTime > 1 post : s e l f . arrivalTime = s e l f . arrivalTime@pre + time Problem 7. “Flights arriving at the airport are handled by an airline that is housed by the airport.” Solution. context Airport inv : s e l f . a r r i v i n g F l i g h t s > e x i s t s ( f : Flight | f . a i r l i n e = s e l f . a i r l i n e ) Problem 8. “No multiple flights depart from an airport at the same time.” Solution. context Airport inv : s e l f . departingFlights > f o r A l l ( f1 , f2 : Flight | f1 <> f2 implies f1 . departureTime <> t2 . departureTime ) Problem 9. “The number of passengers that have booked a flight cannot exceed the capacity of the flight.” Solution. context Flight pre : s e l f . passengers > s i z e () < s e l f . capacity Problem 10. “All tickets on connections scheduled by a rail company are tickets issued by that company.” “All tickets issued by a rail company correspond to connections handled by the company.” Solution. context Ticket inv : s e l f . schedule . getConnection > f o r A l l ( c : Connection | c . railcompany = s e l f . railcompany ) 2
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help

Browse Popular Homework Q&A

Q: Name Lab Instructor Experiment 2-Graphing Prelaboratory Exercises 1. Using the slope formula,…
Q: After reviewing internal and external male genital organs, discuss how, after sperm cells develop,…
Q: A computer on your network uses static IPv4 configuration associated with its Ethernet NIC. Which of…
Q: GRAPHS AND FUNCTIONS Graphing a piecewise-defined function: Problem type 1 Suppose that the function…
Q: Solve the equation x + 2x? - 5x - 6 = 0 given that 2 is a zero of f(x) = x° + 2x? - 5x- 6. The…
Q: The world price of zinc has increased to the point where "moth balled" zinc mines in east Tennessee…
Q: An artifact originally had 16 grams of carbon-14 present. The decay model A 16 e .000121 describes…
Q: A model electric train requires 10 volts to operate. When it is connected to a 111 volt circuit, a…
Q: In(-/-) (vi) 2x In - x = 0
Q: 3. d dx Pick one by (and only one!) and prove it: [kf(x)]= = k f(x) d d.x d - [csc(x)]=-csc(x)…
Q: TSI tubes indicate K/a and sulfide production
Q: 8. For the sine wave in Figure 11-77, determine the peak, peak-to-peak, rms, and aver- age values.…
Q: Find ||v-w||, if v = – 6i +6j and w = 3i – 5j. v-w O (Type an exact answer, using radicals as…
Q: Create 3 exact differential equations and solve for their test for exactness and general solution.…
Q: The Kahneman model of attention is an example of which type of limited-capacity theory?   Question…
Q: When we think of the "ideal American mom" in popular culture, what moms do we think of? What is her…
Q: ► Exercise 11.2. Prove Proposition (c) A finite product of covering maps is a covering map.
Q: Problem 5.8: A dry air parcel undergoes a complete Carnot cycle consisting of the steps indicated in…
Q: 1. Consider the curve in parametric form x(t) = t³ - 3t a) Find the point(s) where the tangent line…
Q: 5 CH3 1 2 3 4/ H-C=C-CH=CH
Q: 0 310.04 5) Copper metal reacts with dilute (10 M) nitric acid by the following reaction. 3Cu(s) +…
Q: A rigid, well-insulated container holds 0.5 m³ saturated water vapor at 200°C and 0.1 m³ solid…