Ask Question, Ask an Expert

+1-415-315-9853

info@mywordsolution.com

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 PipeKit.java

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 Foo.java 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 Tile.java or the rescore() function in GameBoard.java.

Java, Programming

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

Have any Question? 


Related Questions in Java

Code reviewcan some have this done immediatelypublic class

Code Review Can some have this done immediately public class BankAccount { private double balance; public BankAccount() { balance = 0; } public BankAccount(double initialBalance) { balance = initialBalance; } public void ...

Part 1 text readingchapter 3 chapter 4 part 2 textbook

Part 1. Text reading Chapter 3, Chapter 4 Part 2 . Textbook questions Chapter 3. Describe why an application developer might choose to run over TCP rather than UDP. Suppose host A is sending host B a large file over a TC ...

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 ...

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 ...

Java question1write an application that prompts a user for

JAVA Question 1. Write an application that prompts a user for a month, day, and year. Display a message that specifies whether the entered date is not this year, in an earlier month this year, in a later month this year, ...

This assignment is based on the principles of clock

This assignment is based on the principles of clock consistency and associated drifts in a distributed system. You have to create a simulation, running on a single machine, of a simple distributed system involving four p ...

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) ...

Java programmingyou have been asked by your manager to

Java programming You have been asked by your manager to create a user-friendly application that will present a survey to your customers. The application will compile and analyze the results entered by the survey responde ...

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 ...

Animal characteristicsin todays fast-paced world it is

Animal characteristics In today's fast-paced world, it is important for programmers to think about potential future changes that impact their programs. One way that software developers can address this concern is by desi ...

  • 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