Problem 3: Friends and Relations Select/write a solution to each of these problems using relational and logical operators. Do not use any if statements! Rule 1: If I see a friend, I greet them. (Friends can be seen more than once in the same input.) Rule 2: If a person doesn't have the name of a friend, I do not greet them. Rule 3: The input consists of the names of the people I meet represented as String data Note: All output should be true if and only if a certain condition occurs. Your code must return true for all situations where that condition occurs, not just some of them. Similarly, your code must return false for all situations where the condition does not occur. For example, if I have two friends named "Abby" and "George", I would greet both of them if I saw "Abby" first, then "George". But, I would also greet them both if I saw "George" first, then "Abby". My code would need to print true in both of those situations not just one of them. odd number of people. (true if 1, 3, or 5 people, false otherwise) boolean oddFriends oddFriends = (input() EQ "David" AND input() EQ "David" AND input() EQ "David" AND input() EQ "David" AND input() EQ "David") print oddFriends boolean one, three, five one =input() == "David" two =input() == "David" AND input() == "David" three = input() == "David" AND input() == "David" AND input() == "David" print one or two or three boolean oddFriends oddFriends = (input() EQ "David" OR input() EQ "David" OR input() EQ "David" OR input() EQ "David" OR input() EQ "David") print oddFriends boolean oddFriends oddFriends = (input() EQ "David" XOR input() EQ "David" XOR input() EQ "David" XOR input() EQ "David" XOR input() EQ "David") print oddFriends
SQL
SQL stands for Structured Query Language, is a form of communication that uses queries structured in a specific format to store, manage & retrieve data from a relational database.
Queries
A query is a type of computer programming language that is used to retrieve data from a database. Databases are useful in a variety of ways. They enable the retrieval of records or parts of records, as well as the performance of various calculations prior to displaying the results. A search query is one type of query that many people perform several times per day. A search query is executed every time you use a search engine to find something. When you press the Enter key, the keywords are sent to the search engine, where they are processed by an algorithm that retrieves related results from the search index. Your query's results are displayed on a search engine results page, or SER.
I need help at this question because I am stuck at this question. I included answer choice as well and please solve with carefully.
![input.)
Rule 2: If a person doesn't have the name of a friend, I do not greet them
Rule 3: The input consists of the names of the people I meet represented as String
data
Note: All output should be true if and only if a certain condition occurs. Your code must
return true for all situations where that condition occurs, not just some of them. Similarly,
your code must return false for all situations where the condition does not occur.
For example, if I have two friends named "Abby" and "George", I would greet both of
them if I saw "Abby" first, then "George". But, I would also greet them both if I saw
"George" first, then "Abby". My code would need to print true in both of those situations,
not just one of them.
Friend: "David"
Input: 5 people
Output: true iff I greet an
odd number of
O
O
people.
(true if 1, 3, or 5
people, false
otherwise)
boolean oddFriends
oddFriends (input() EQ "David" AND
input() EQ "David" AND
input() EQ "David" AND
input() EQ "David" AND
input() EQ "David")
print oddFriends
boolean one, three, five
one =input() == "David"
two =input() == "David" AND input() == "David"
three=input() == "David" AND input() == "David" AND
input() == "David"
print one OR two OR three
boolean oddFriends
oddFriends = (input() EQ "David" OR
input() EQ "David" OR
input() EQ "David" OR
input() EQ "David" OR
input() EQ "David")
print oddFriends](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fa471b51a-0850-4e57-a059-1b322d7c0961%2Fd4590f17-3886-45e4-ad8a-43d8646394a2%2Fhkqmbq3_processed.png&w=3840&q=75)
![Problem 3: Friends and Relations
Select / write a solution to each of these problems using relational and logical
operators.
Do not use any if statements!
Rule 1: If I see a friend, I greet them. (Friends can be seen more than once in the same
input.)
Rule 2: If a person doesn't have the name of a friend, I do not greet them.
Rule 3: The input consists of the names of the people I meet represented as String
data.
Note: All output should be true if and only if a certain condition occurs. Your code must
return true for all situations where that condition occurs, not just some of them. Similarly,
your code must return false for all situations where the condition does not occur.
For example, if I have two friends named "Abby" and "George", I would greet both of
them if I saw "Abby" first, then "George". But, I would also greet them both if I saw
"George" first, then "Abby". My code would need to print true in both of those situations,
not just one of them.
odd number of
people.
(true if 1, 3, or 5
people, false
otherwise)
boolean oddFriends
oddFriends = (input() EQ "David" AND
input() EQ "David" AND
input() EQ "David" AND
input() EQ "David" AND
input() EQ "David")
print oddFriends
boolean one, three, five
one
=input() == "David"
two
=input() == "David" AND input() == "David"
three = input() == "David" AND input() == "David" AND
input() == "David"
print one OR two OR three
boolean oddFriends
oddFriends = (input() EQ "David" OR
input() EQ "David" OR
input() EQ "David" OR
input() EQ "David" OR
input() EQ "David")
print oddFriends
boolean oddFriends
oddFriends (input() EQ "David" XOR
input() EQ "David" XOR
input() EQ "David" XOR
input() EQ "David" XOR
input() EQ "David")
print oddFriends](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fa471b51a-0850-4e57-a059-1b322d7c0961%2Fd4590f17-3886-45e4-ad8a-43d8646394a2%2Faenx0cb_processed.png&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Step by step
Solved in 2 steps
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![C++ Programming: From Problem Analysis to Program…](https://www.bartleby.com/isbn_cover_images/9781337102087/9781337102087_smallCoverImage.gif)
![C++ Programming: From Problem Analysis to Program…](https://www.bartleby.com/isbn_cover_images/9781337102087/9781337102087_smallCoverImage.gif)