Ask Question, Ask an Expert


Ask Java Expert

Home >> Java

problem 1) Assignment: PipeLayer

In this assignment you would explore use of inheritance and dynamic binding in Java.

You would be provided with the partial implementation of simple game program, written in Java. Your task is to complete the program.

The Lake Gaston Pipeline Game

Construction is underway on pipeline to bring water from Lake Gaston to thirsty Virginia Beach. You are lucky enough to have won contract to lay pipe through the small parcel of land. What's more, your brother-in-law lawyer has wrangled a wonderful contract under which you get paid per unit length of pipe which actually carries water, so it is in your best interest to snake that pipe back and forth as much as you can, so as to get the longest possible working pipeline within your small area of land.

Unfortunately, your pipe supplier delivers whatever shape pipe sections he feels like, and you have to pay for each one delivered, whether you use it or not. Could you lay more water-carrying pipe than you waste in unused pipe sections just lying around on your property?

To play game, follow the instructions below for running the program. At the top of the gameboard you would see the section of pipe which has been delivered. Click in the grid to place the pipe. If the pipe connects with water carrying pipe laid so far, the color would change to indicate that pipe is filling with water, and your score increases.

Running the game

To familiarize yourself with how program is supposed to work, you could run the completed version from the provided jar:

java -jar pipelayer.jar

The Assignment

Select a working directory for your assignment, ensure it is not world readable or executable. Copy the assignment files into that directory.
Files for this assignment are available here or, if you are logged in on our Linux system, at ~zeil/Assignments/cs330/pipelayer/.

Compile source code. (On the Linux system, you could use the provided makefile.

Run this version of the game, and compare to complete game you ran earlier.

As you would note in the previous step, the source code you have been given provides only a single shape of pipe.

You should complete the game, making it behave identically to complete game.

To do this, you must

a) modify

b) add any extra source code files you wish

but you must not otherwise modify or remove other source code files provided.

If working on Linux, you might also find it to your advantage to modify the makefile by adding to list of CLASSES. For every file which you add to the project, add name Foo.class to the CLASSES list in the makefile. [Note that all but the last line of the CLASSES list should end with a backslash \.]

Though, to appreciate how these classes get used in ways that exploit dynamic binding, look at the paint() function in or the rescore() function in

Java, Programming

  • Category:- Java
  • Reference No.:- M94550

Have any Question? 

Related Questions in Java

Programmers often develop different types of accounts to

Programmers often develop different types of accounts to provide access to a program for a variety of users. The structure of each account is formatted based on the needs of the user and how the program will be used. One ...

Instructionsi what are the diagrams defined in the uml

Instructions I. What are the diagrams defined in the UML Standard. Give a one or two sentence description of each one. II. Given the following code, how should the toString methods in the classes H2ClassA and H2ClassB be ...

Pogramming assignmentmickeymouse- x int- y int- size

Programming Assignment MickeyMouse - x : int - y : int - size : int -color: Color + MickeyMouse(): + setLocation (x: int, y: int): void + setSize (size: int): void + setColor(color: Color):void + draw(canvas: Graphics2D) ...

Below is the beginning of a java classpublic class

Below is the beginning of a Java class. public class Implement { private String name; private boolean hasMovingParts; private String constructedFrom; public Implement() { } a) Complete this class so that: i. The instance ...

Twitter is a popular social media platform for users to

Twitter is a popular social media platform for users to send out a short message (a "tweet") to other users who are registered as his/her followers. Figure 1 shows a graph. (The topic on graphs will be covered after your ...

Overviewthis assignment is intended to familiarize students

Overview: This assignment is intended to familiarize students with web application design, basic servlet functionality, and application deployment with a focus on servlet HTML generation and page navigation. The goal is ...

Question 1 illustrate that the nodes of any avl tree t can

Question 1. Illustrate that the nodes of any AVL tree T can be colored "red" and "black" so that T becomes a red-black tree. Question 2. Illustrate that via AVL single rotation, any binary search tree T1 can be transform ...

The class below has some errors for each error do the

The class below has some errors. For each error do the following: a) Write the erring section of code and explain what the error is. b) Fix the error (i.e. re-write the code correctly). public class ClassWithErrors { pub ...

Assignmentupload your completed assignment to the

Assignment Upload your completed assignment to the Assignment 2 link on the course home page for marking and tutor feedback. Be sure to complete the final step-click on the Send for Marking button to notify your tutor. P ...

Programming assignment - summer semester 2015-purpose-to

Programming Assignment - Summer Semester 2015- Purpose- To provide students with the opportunity to apply the knowledge acquired and skills developed. These include understanding of primitive data types and the concept o ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

A cola-dispensing machine is set to dispense 9 ounces of

A cola-dispensing machine is set to dispense 9 ounces of cola per cup, with a standard deviation of 1.0 ounce. The manuf

What is marketingbullwhat is marketing think back to your

What is Marketing? • "What is marketing"? Think back to your impressions before you started this class versus how you

Question -your client david smith runs a small it

QUESTION - Your client, David Smith runs a small IT consulting business specialising in computer software and techno

Inspection of a random sample of 22 aircraft showed that 15

Inspection of a random sample of 22 aircraft showed that 15 needed repairs to fix a wiring problem that might compromise

Effective hrmquestionhow can an effective hrm system help

Effective HRM Question How can an effective HRM system help facilitate the achievement of an organization's strate