Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Java Expert


Home >> Java

Assignment - "Method in our Madness"

The emphasis for this assignment is methods with parameters. In preparation for this assignment, create a folder called Assign_3 for the DrJava projects for the assignment.

A Cityscape

Write a Java program to draw a cityscape as seen below. The city consists of some number of buildings. Each building has multiple stories. Each story has windows. Your program should draw a random cityscape as defined below using Turtle Graphics and methods with parameters.

The problem can be defined as such:

  • A city consists of 3 to 6 buildings (inclusive), randomly chosen. The cityscape should be centered left to right on the display and ground level should be such that a 15-story building is centered top to bottom.
  • The buildings are of width 70 and should be horizontally centred left to right in the display
  • Each building is a rectangle with 5 to 15 stories (inclusive), randomly chosen.
  • Each story has two windows and is of height 30.
  • Each window is four 10x10 squares (remember, squares are also rectangles) centered within the story

Hints:

  • Use a TurtleDisplayer with a 500x500 canvas: display = new TurtleDisplayer(yertle,500,500); which creates the display and places yertle on the display.
  • Use a FAST Turtle.
  • Consider using methods to draw the city of some number of buildings, draw a building of some number of stories, draw a window and draw a rectangle each with appropriate parameters.
  • Build your program bottom-up, that is, initially simply draw a rectangle, then draw a window, then a building and finally a city.

Submission:

Details regarding preparation and submission of assignments in COSC 1P02 are found on the COSC 1P02 Sakai Site as Assignment Guidelines under Course Documents. This document includes a discussion of assignment preparation, programming standards, evaluation criteria and academic conduct (including styles for citation) in addition to the detailed assignment submission process copied below.

To prepare and submit the assignment electronically, follow the procedure below:

1. Ensure your folder (Assign_3) contains the DrJava project for the assignment.

2. Using DrJava, print (as a pdf file, e.g. using "printer" Microsoft Print to PDF or similar) the .java file for your assignment using the name ClassName.pdf where ClassName is the class name (i.e. same name as the .java file) and save the .pdf file at the top level of the assignment folder (i.e. directly within Assign_3).

3. Run the program. When the display is finished (i.e. Close button visible), select Print Image of Window... from the File menu on the TurtleDisplayer and direct the output to Microsoft Print to PDF saving the .pdf file at the top level of the assignment folder (i.e. directly within Assign_3) using an appropriate name (e.g. Output.pdf).

4. Create a .zip file of your submission by right-clicking on the top level folder (i.e. Assign_3) and selecting Send to/Compressed (zipped) folder. A zipped version of the folder will be created. Use the default name (Assign_3.zip).

5. Log on to Sakai and select the COSC 1P02 site.

6. On the Assignments page select Assignment 3. Attach your .zip file (e.g. Assign_3.zip) to the assignment submission (use the Add/Remove Attachments button and select Browse). Navigate to where you stored your assignment and select the .zip file (Assign_3.zip). The file will be added to your submission. Be sure to check the Honor Pledge checkbox. Press Submit to submit the assignment. You should receive a confirmation email.

DrJava

The .zip folder you submit should contain the project folders for the two parts, including all files relevant to the project-the .java and .class files for the assignment-and the .pdf files for program listings and output at the top level.

Other Platforms

If you are using an IDE other than DrJava to prepare your assignment, you must include the .java source files and the .pdf files described above for each part as well as an executable file (likely .class or.jar) that will execute on the lab machines.

Attachment:- Assignment File.rar

Java, Programming

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

Have any Question?


Related Questions in Java

Assignment taskwrite a java console application that allows

Assignment task Write a java console application that allows the user to read, validate, store, display, sort and search data such as flight departure city (String), flight number (integer), flight distance (integer), fl ...

In ruby the hash class inherits from enumerable suggesting

In Ruby, the Hash class inherits from Enumerable, suggesting to a programmer that Hashes are collections. In Java, however, the Map classes are not part of the JCF (Java Collections Framework). For each language, provide ...

Assessment database and multithread programmingtasktask 1

Assessment: Database and Multithread Programming Task Task 1: Grade Processing University grading system maintains a database called "GradeProcessing" that contains number of tables to store, retrieve and manipulate stud ...

Fundamentals of operating systems and java

Fundamentals of Operating Systems and Java Programming Purpose of the assessment (with ULO Mapping) This assignment assesses the following Unit Learning Outcomes; students should be able to demonstrate their achievements ...

Chatbotscreate a small networked chat application that is

Chatbots Create a small, networked chat application that is populated by bots. Introduction On an old server park, filled with applications from the early days of the internet, a few servers still run one of the earliest ...

Can someone kindly help me to consider whether java

Can someone kindly help me to consider whether Java provides the facility of operator overloading? If it does, may you kindly describe how overloading operators can be accomplished? If not, may you kindly describe why yo ...

Assignment taskwrite a java console application that allows

Assignment task Write a java console application that allows the user to read, validate, store, display, sort and search data such as flight departure city (String), flight number (integer), flight distance (integer), fl ...

Part a specification - robot simulationpart a

PART A Specification - Robot Simulation PART A Requirements To complete this assignment you will use the supplied eclipse project Robot P1/. It is already set up to execute a simple arm movement loop which you will build ...

Assignment - java program using array of objectsobjectives

Assignment - JAVA Program using array of objects Objectives - This assessment item relates to the course learning outcomes as stated in the Unit Profile. Details - For this assignment, you are required to develop a Menu ...

Operating systems assignment -problem 1 sharing the bridgea

Operating Systems Assignment - Problem 1: Sharing the Bridge A new single lane bridge is constructed to connect the North Island of New Zealand to the South Island of New Zealand. Farmers from each island use the bridge ...

  • 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

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As