Write a java program to draw a cityscape

Assignment Help JAVA Programming
Reference no: EM132139470

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

Reference no: EM132139470

Questions Cloud

How would you assign a primary key in a table : How would you assign a Primary key in a table? Also, explain for each type of connectivity (1:1, 1:M and M:N), how would you assign a Foreign key?
Declare a type pchar : Use typedef to declare a type pChar that is a pointer to a character.
Help formulate a program : Help formulate a program (Python script) named mycalc.py, which implements a simple calculator using python.
Why ultimately does he decide not to escape to canada : How does O'Brien feel about the war in Vietnam? Why does O'Brien go to the rainy river? Why ultimately, does he decide not to escape to Canada?
Write a java program to draw a cityscape : COSC 1P02 Assignment - "Method in our Madness". Write a Java program to draw a cityscape as seen. The city consists of some number of buildings
Identify a severe risk : Identify a severe risk that you take when you sign on to the Internet? How do you protect yourself from it?
Virtualization and cloud computing : Which term describes the creation of a complete environment in which a guest operating system can function as though it were installed on its own computer?
Why is intervention in kuwait necessary : What domestic issues does President Bush also address? How are those issues linked to the situation in Iraq?
Discuss the measurement of finical instruments : Are you able to produce a Report as per the given requirements please? Chosen company is Origin Energy (ORG). Discuss the measurement of finical instruments

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd