ITEC 1620 Lecture Notes - Black Pepper

15 views2 pages
Published on 12 Oct 2012
School
York University
Department
Information Technology
Course
ITEC 1620
Professor
Sample 1:
A farmer needs to transport a wolf, a rabbit, and a bundle of cabbage across a river.
However, he cannot carry all of the items in his boat at one time. Thus, he will have to
make multiple trips across the river. With each trip, he might have to leave part of his
cargo on the shore unattended.
If left unattended together, the wolf will eat the rabbit, and the rabbit will eat the cabbage.
In a JAVA program, there are three boolean variables – wolf, rabbit, and cabbage.
The value of each variable is true if that item is unattended on the shore, and false
otherwise.
Write an if statement that will set the boolean variable safe to true if unattended
items will be safe, and to false if one of the items will get eaten.
Unlock document

This preview shows half of the first page of the document.
Unlock all 2 pages and 3 million more documents.

Already have an account? Log in

Document Summary

A farmer needs to transport a wolf, a rabbit, and a bundle of cabbage across a river. However, he cannot carry all of the items in his boat at one time. Thus, he will have to make multiple trips across the river. With each trip, he might have to leave part of his cargo on the shore unattended. If left unattended together, the wolf will eat the rabbit, and the rabbit will eat the cabbage. In a java program, there are three boolean variables wolf, rabbit, and cabbage. The value of each variable is true if that item is unattended on the shore, and false otherwise. Write an if statement that will set the boolean variable safe to true if unattended items will be safe, and to false if one of the items will get eaten. A certain chef insists that chicken needs a flavouring to make it edible. This chef has three flavourings: chili, lemon, and black pepper.

Get OneClass Grade+

Unlimited access to all notes and study guides.

YearlyMost Popular
75% OFF
$9.98/m
Monthly
$39.98/m
Single doc
$39.98

or

You will be charged $119.76 upfront and auto renewed at the end of each cycle. You may cancel anytime under Payment Settings. For more information, see our Terms and Privacy.
Payments are encrypted using 256-bit SSL. Powered by Stripe.