New

Learn smart - Learn online. Upto 88% off on courses for a limited time. View Courses

Securing Higher Grades Costing Your Pocket? Book Your Assignment at The Lowest Price Now!
loader
Add File

Error goes here

Files Missing!

Please upload all relevant files for quick & complete assistance.

Guaranteed Higher Grade!

Stuck on Your Question?

Get 24x7 live help from our Top Tutors. All subjects covered.

loader
250 words

Error goes here

Files Missing!

Please upload all relevant files for quick & complete assistance.

Students Who Viewed This Also Studied

9 Pages
EECS 4462 Digital Audio

Identify a Unity 3D game that you would like to add sound to. This can be a game you foundonline, a game you wrote, or one of the Unity sample games. It will need to have sufficientcomplexity to imple ...

Course

EECS 4462

Type

Programming

Subject

Programing

University

York University

20 Pages
COMP1680 Clouds, Grids and Virtualization

Task: Characterise and critically evaluate high performance computing based architectures and their suitability for given applications.Implement and execute applications using shared and distributed ...

Course

COMP1680

Type

Programming

Subject

Programing

University

University of Greenwich

7 Pages
mth814 computational complexity

Consider the following instance of the Generalized Geography game:Which player has a winning strategy in this game? What is the strategy for that player?(d) Prove thatNP=PSAT,whereSATis the satisfiabi ...

Course

mth814

Type

Programming

Subject

Programing

University

Ryerson University

0 Page
Baggage Tracking System

...

Course

CIS4019N

Subject

Programing

University

Teesside University

Season

Fall

ITEC313 Object Oriented Programming

Question

Answered

Question:

River Crossing, Game Programming

Problem Description

One day a farmer goes to the market, taking with him a cabbage and a goat. On the way he captured a wolf, he’s a mighty farmer, and took it with him to the market. They came to a river. And on the Bank, there’s a boat. Now, the problem is that the boat just big enough to carry the farmer and one of the others. If the farmer leaves the wolf and the goat together, in his absence, the wolf would make a meal of the goat. Neither, could be leave the goat and the cabbage alone: the goat would eat the cabbage. Being used to hardship, the farmer was quite prepared to make several trips back and forth, just so long as he could eventually bring them all to the other side and went on to the market. How should he arrange the trips?

Figure 1. CLI version of the river crossing

Part 1 Requirements

Your task as a software developer is to write a Command Line Interface (CLI) application RiverCrossingCLI simulating the river crossing. The farmer (player) can then work out the steps required to safely move all items to the other side of the river. In Part 1 you will need to do two tasks:

  1. Your first task is to design and create a RiverCrossing class to represent the river crossing with the appropriate attributes and methods. Assume river flows west to east (left to right of the page), farmer moves north (straight up) and requires to transport items from the South Bank to North Bank of the river. Design class so it can be re-used in Part 2 of the assignment, the GUI version of River Crossing.

(a) Write the RiverCrossing constructor.

(b) Use a boolean (or integer) array elements as place holders for the Farmer’s items (boat, cabbage, goat, wolf). False value to represent an item located on the South Bank and True on the North Bank of river.

(c) Write a row() method to transport an item from one Bank to another Bank.

(d) Write get() methods to return string with inventory (a list of all items, including the boat) located on the North Bank and another get() method for the South Bank.

(e) Write other methods as required.

  1. Write a Command Line Interface class with main method to allow the user to play the game. A sample of a dialogue between the computer and the user (farmer) trying to cross from the south Bank to the north Bank:

Part 2

Create a Windows GUI (JFrame) application for launching RiverCrossing game.

Part 2

Create a Windows GUI (JFrame) application for launching RiverCrossing game.

//Create JFrame container

public class River

{

public static void main(String[] args) //main method

{

JFrame frame = new JFrame("River Crossinge");

frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

frame.getContentPane().add(new RiverGUI()); //create GUI

frame.pack();

frame.setVisible(true);

}//end of main method

}//end River class

Choose GUI components that reduce user errors and provide a feedback to the player. For example, there is no need for a “boat” button because “row” button always moves the boat with or without an item.

One simple GUI interface is shown in the Figure 2 below. Click the button “row” to immediately row the boat across or to transport the wolf select button “wolf” followed by click on the “row” button.

Figure 2. Basic river crossing layout.

Once again, this is only a sample interface to illustrate the idea of the game. You are free to choose your own colour scheme and buttons. Movement can be achieved by clicking a button. Make use of layout managers to design colourful and a well-organized game. Consider the following controls as a minimum requirement:

  • one button to reset and start the game again,
  • a text field for the player’s name (a player may choose to leave it blank).
  • a text area to display a warning messages (and the past history), for example, “This is not a good idea” or to inform the player that cabbage or the goat was eaten and game is lost. You can provide your own appropriate messages.

An advanced River crossing is shown in Figure 3. Full marks will be given to fully functional basic layout but additional marks may be given by better GUI as long it is fully functional.

Figure 3. An example of advanced river crossing layout with button icons (pictures) and boat drawing.

ITEC313 Object Oriented Programming

Answer in Detail

Solved by qualified expert

Get Access to This Answer

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Hac habitasse platea dictumst vestibulum rhoncus est pellentesque. Amet dictum sit amet justo donec enim diam vulputate ut. Neque convallis a cras semper auctor neque vitae. Elit at imperdiet dui accumsan. Nisl condimentum id venenatis a condimentum vitae sapien pellentesque. Imperdiet massa tincidunt nunc pulvinar sapien et ligula. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere. Et ultrices neque ornare aenean euismod. Suscipit tellus mauris a diam maecenas sed enim. Potenti nullam ac tortor vitae purus faucibus ornare. Morbi tristique senectus et netus et malesuada. Morbi tristique senectus et netus et malesuada. Tellus pellentesque eu tincidunt tortor aliquam. Sit amet purus gravida quis blandit. Nec feugiat in fermentum posuere urna. Vel orci porta non pulvinar neque laoreet suspendisse interdum. Ultricies tristique nulla aliquet enim tortor at auctor urna. Orci sagittis eu volutpat odio facilisis mauris sit amet.

Tellus molestie nunc non blandit massa enim nec dui. Tellus molestie nunc non blandit massa enim nec dui. Ac tortor vitae purus faucibus ornare suspendisse sed nisi. Pharetra et ultrices neque ornare aenean euismod. Pretium viverra suspendisse potenti nullam ac tortor vitae. Morbi quis commodo odio aenean sed. At consectetur lorem donec massa sapien faucibus et. Nisi quis eleifend quam adipiscing vitae proin sagittis nisl rhoncus. Duis at tellus at urna condimentum mattis pellentesque. Vivamus at augue eget arcu dictum varius duis at. Justo donec enim diam vulputate ut. Blandit libero volutpat sed cras ornare arcu. Ac felis donec et odio pellentesque diam volutpat commodo. Convallis a cras semper auctor neque. Tempus iaculis urna id volutpat lacus. Tortor consequat id porta nibh.

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Hac habitasse platea dictumst vestibulum rhoncus est pellentesque. Amet dictum sit amet justo donec enim diam vulputate ut. Neque convallis a cras semper auctor neque vitae. Elit at imperdiet dui accumsan. Nisl condimentum id venenatis a condimentum vitae sapien pellentesque. Imperdiet massa tincidunt nunc pulvinar sapien et ligula. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere. Et ultrices neque ornare aenean euismod. Suscipit tellus mauris a diam maecenas sed enim. Potenti nullam ac tortor vitae purus faucibus ornare. Morbi tristique senectus et netus et malesuada. Morbi tristique senectus et netus et malesuada. Tellus pellentesque eu tincidunt tortor aliquam. Sit amet purus gravida quis blandit. Nec feugiat in fermentum posuere urna. Vel orci porta non pulvinar neque laoreet suspendisse interdum. Ultricies tristique nulla aliquet enim tortor at auctor urna. Orci sagittis eu volutpat odio facilisis mauris sit amet.

Tellus molestie nunc non blandit massa enim nec dui. Tellus molestie nunc non blandit massa enim nec dui. Ac tortor vitae purus faucibus ornare suspendisse sed nisi. Pharetra et ultrices neque ornare aenean euismod. Pretium viverra suspendisse potenti nullam ac tortor vitae. Morbi quis commodo odio aenean sed. At consectetur lorem donec massa sapien faucibus et. Nisi quis eleifend quam adipiscing vitae proin sagittis nisl rhoncus. Duis at tellus at urna condimentum mattis pellentesque. Vivamus at augue eget arcu dictum varius duis at. Justo donec enim diam vulputate ut. Blandit libero volutpat sed cras ornare arcu. Ac felis donec et odio pellentesque diam volutpat commodo. Convallis a cras semper auctor neque. Tempus iaculis urna id volutpat lacus. Tortor consequat id porta nibh.

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Hac habitasse platea dictumst vestibulum rhoncus est pellentesque. Amet dictum sit amet justo donec enim diam vulputate ut. Neque convallis a cras semper auctor neque vitae. Elit at imperdiet dui accumsan. Nisl condimentum id venenatis a condimentum vitae sapien pellentesque. Imperdiet massa tincidunt nunc pulvinar sapien et ligula. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere. Et ultrices neque ornare aenean euismod. Suscipit tellus mauris a diam maecenas sed enim. Potenti nullam ac tortor vitae purus faucibus ornare. Morbi tristique senectus et netus et malesuada. Morbi tristique senectus et netus et malesuada. Tellus pellentesque eu tincidunt tortor aliquam. Sit amet purus gravida quis blandit. Nec feugiat in fermentum posuere urna. Vel orci porta non pulvinar neque laoreet suspendisse interdum. Ultricies tristique nulla aliquet enim tortor at auctor urna. Orci sagittis eu volutpat odio facilisis mauris sit amet.

Tellus molestie nunc non blandit massa enim nec dui. Tellus molestie nunc non blandit massa enim nec dui. Ac tortor vitae purus faucibus ornare suspendisse sed nisi. Pharetra et ultrices neque ornare aenean euismod. Pretium viverra suspendisse potenti nullam ac tortor vitae. Morbi quis commodo odio aenean sed. At consectetur lorem donec massa sapien faucibus et. Nisi quis eleifend quam adipiscing vitae proin sagittis nisl rhoncus. Duis at tellus at urna condimentum mattis pellentesque. Vivamus at augue eget arcu dictum varius duis at. Justo donec enim diam vulputate ut. Blandit libero volutpat sed cras ornare arcu. Ac felis donec et odio pellentesque diam volutpat commodo. Convallis a cras semper auctor neque. Tempus iaculis urna id volutpat lacus. Tortor consequat id porta nibh.

26 More Pages to Come in This Document. Get access to the complete answer.

MyAssignmenthelp.com boasts a team of talented and experienced thesis helper who are capable of providing best quality thesis help services. Our wide range of thesis writing services include assistance with writing and structuring top-quality thesis, help with research, topic selection help and editing and proofreading help. Students can get any of these services at cheap price. Despite charging cheap from student, our thesis writers never compromise with the quality. They efficiently answer students queries pertaining to can someone help me with my thesis paper.

More ITEC313 ITEC313 Object Oriented Programming: Questions & Answers

Q
icon

We aren't endorsed by this University

EECS 4462 Digital Audio

Identify a Unity 3D game that you would like to add sound to. This can be a game you foundonline, a game you wrote, or one of the Unity sample games. It will need to have sufficientcomplexity to implement the required features (see below) in a meaningful way, but it does nothave to be very complex, ...

View Answer
Q
icon

We aren't endorsed by this University

COMP1680 Clouds, Grids and Virtualization

Task: Characterise and critically evaluate high performance computing based architectures and their suitability for given applications.Implement and execute applications using shared and distributed memory programming paradigms.Describe and critically discuss the roles and applications of cloud and ...

View Answer
Q
icon

We aren't endorsed by this University

mth814 computational complexity

Consider the following instance of the Generalized Geography game:Which player has a winning strategy in this game? What is the strategy for that player?(d) Prove thatNP=PSAT,whereSATis the satisfiability problem for Boolean logic. ...

View Answer
Q
icon

We aren't endorsed by this University

Baggage Tracking System

...

View Answer

Content Removal Request

If you are the original writer of this content and no longer wish to have your work published on Myassignmenthelp.com then please raise the content removal request.

Choose Our Best Expert to Help You

icon

5% Cashback

On APP - grab it while it lasts!

Download app now (or) Scan the QR code

*Offer eligible for first 3 orders ordered through app!

screener
ribbon
callback request mobile
Have any Query?