The purpose of this assignment is to introduce you to programming in Java and familiarize you with the mechanics of preparing and submitting assignments. The specific goals are to:
The class discussion board is hosted on Piazza. In addition to being an important forum for discussing material, we make all course announcements through piazza.
This part of the homework will walk you through setting up the necessary software on your computer, and making sure that it works. The software you need is all freely available, and the booksite provides a handy installer to set it up for you. Even if you have already installed Java on your computer, you need to complete this step to set up the course-specific software properly. The necessary tools are also installed on the Moore lab computers, but you will need a SEAS account to log in. If you are an engineering student, you should already have a SEAS account.
Non-SEAS Students: Request your SEAS account here - . It usually takes at least 30 minutes for your account to be activate. Even if you do not plan on using the lab computers, you should request an account now. If your own laptop stops working for any reason, you will be relieved to have immediate access to the lab machines. (Per SEAS policy, SEAS accounts are available only to registered students (including P/F), but not to auditors.)
Click on the accordion panel below that corresponds to your system.This part of the homework walks you through completing your first program. Traditionally, the first program anyone writes in a new language just prints, "Hello, World."
/* Name: Benedict Brown * PennKey: bjbrown * Recitation: 200 * * Execution: java HelloWorld * * Prints "Hello, World". By tradition, this is everyone's first program. * */ public class HelloWorld { public static void main(String[] args) { System.out.println("Hello, World"); } }
For CIS110, we will be using a drawing library that we have called PennDraw (PennDraw is StdDraw that the textbook refers to with some additional functionality)
To do this part of your HW:
Here is some example code to make sure that drawing
is working on your machine. It also gives you some examples of
what can be drawn using PennDraw.
PennDraw is documented extensively on the
Make sure to update the header section so that it is your name, PennKey, and recitation (or ??? if you don't have a recitation yet). Make sure this code runs on your machine and pay attention to the comments in the code. Those should help you understand how the program works. Save this file as MyHouse.java .
/** * Name : Arvind Bhusnurmath * PennKey : bhusnur4 * Recitation : 110 * * Execution: java MyHouse * * An example drawing using the PennDraw library * This draws a house in the middle of a green field with a blue sky. */ public class MyHouse { public static void main(String[] args) { PennDraw.setCanvasSize(500, 500); // draw a blue background PennDraw.clear(PennDraw.BLUE); //draw a green field PennDraw.setPenColor(0, 170, 0); PennDraw.filledRectangle(0.5, 0.25, 0.6, 0.3); //change the pen color to a shade of yellow PennDraw.setPenColor(200, 170, 0); //draw a filled triangle (roof) PennDraw.filledPolygon(0.255, 0.70, 0.745, 0.70, 0.49, 0.90); //draw the house PennDraw.filledRectangle(250 / 500.0, 260 / 500.0, 120 / 500.0, 90 / 500.0); PennDraw.setPenRadius(0.005); // thicken the pen for outline drawing PennDraw.setPenColor(PennDraw.BLACK); // make the pen black // draw the roof outline PennDraw.polygon(0.255, 0.70, 0.745, 0.70, 0.49, 0.90); // draw the house outline PennDraw.rectangle(250 / 500.0, 260 / 500.0, 120 / 500.0, 90 / 500.0); // draw the door outline PennDraw.rectangle(298 / 500.0, 220 / 500.0, 40 / 500.0, 50 / 500.0); PennDraw.point(270 / 500.0, 220 / 500.0); // draw a doorknob } }
Design and create your own piece of digital art using Java and the PennDraw library. Think of yourself as a creative designer when choosing the topic of your design. This is your very first program, so here are some guidelines:
Here are some ideas to get you started: