Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Suppose we have a set of sports teams in a league L, and a set of games G among those teams. Each game has a

Suppose we have a set of sports teams in a league L, and a set of games G among those teams. Each game has a home team and a visiting team, who are two different teams in the league. We have predicates H(g, t) meaning team t was the home team in game g and V(g, t) meaning team t was the visiting team in game g.

(a) Consider the predicate P(s, t) meaning team s played a game against team t. Can you express this predicate in terms of the predicates H and V, along with boolean operators? Either do it or explain (informally) why you cannot.

(b) If I have a list of the games played, and access to the H and V predicates, how could I compute the value of P(s, t) given two teams s and t?

(c) (uses Java) Assume that you have a Java class Game that includes instance methods boolean home(Team t) and boolean visitor (Team t). Write a static method boolean played(Team s, Team t, Game[ ] season) that will input two teams and an array of games, and return true if and only if P(s, t) is true for the set of games in the array.

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

Information Modeling And Relational Databases

Authors: Terry Halpin, Tony Morgan

2nd Edition

0123735688, 978-0123735683

More Books

Students also viewed these Databases questions