CS112 - INTRODUCTION TO PROGRAMMING

Similar documents
CS112 - INTRODUCTION TO PROGRAMMING. Programming Project #2 - Due Monday, March 10, at the start of class

CPS122 - OBJECT-ORIENTED SOFTWARE DEVELOPMENT

CPS122 - OBJECT-ORIENTED SOFTWARE DEVELOPMENT

CS 374 Fall 2014 Homework 2 Due Tuesday, September 16, 2014 at noon

CS 134 Programming Exercise 2:

Database Use & Design

CSE 143: Computer Programming II Winter 2019 HW6: AnagramSolver (due Thursday, Feb 28, :30pm)

CS : Programming for Non-Majors, Fall 2018 Programming Project #5: Big Statistics Due by 10:20am Wednesday November

Animations involving numbers

Programming Project 1

CS 463 Project 1 Imperative/OOP Fractals

Due: 9 February 2017 at 1159pm (2359, Pacific Standard Time)

CS 31: Intro to Systems Binary Arithmetic. Martin Gagné Swarthmore College January 24, 2016

CS 1803 Pair Homework 4 Greedy Scheduler (Part I) Due: Wednesday, September 29th, before 6 PM Out of 100 points

CS112 Lecture: Defining Classes. 1. To describe the process of defining an instantiable class

Express Yourself. The Great Divide

Tips from the experts: How to waste a lot of time on this assignment

Claremont McKenna College Computer Science

CS2112 Fall Assignment 4 Parsing and Fault Injection. Due: March 18, 2014 Overview draft due: March 14, 2014

Managing Your Grade Book This lesson will show you how to set up your grade book columns and have Canvas calculate your final grades for you.

1. The Normal Distribution, continued

CS 1044 Project 1 Fall 2011

(Simple) JavaScript Framework Homework

CSE 143: Computer Programming II Summer 2017 HW5: Anagrams (due Thursday, August 3, :30pm)

CS Problem Solving and Object-Oriented Programming

Decision Logic: if, if else, switch, Boolean conditions and variables

CS 2110 Fall Instructions. 1 Installing the code. Homework 4 Paint Program. 0.1 Grading, Partners, Academic Integrity, Help

Soda Machine Laboratory

New York University Computer Science Department Courant Institute of Mathematical Sciences

Homework 3 Solutions

CMSC 201 Spring 2017 Lab 05 Lists

CS 315 Software Design Homework 1 First Sip of Java Due: Sept. 10, 11:30 PM

CS112 Lecture: Introduction to Karel J. Robot

CS : Programming for Non-majors, Fall 2018 Programming Project #2: Census Due by 10:20am Wednesday September

Lesson 10: Quiz #1 and Getting User Input (W03D2)

CS 134 Programming Exercise 3:

Program Submission Guidelines CIS/CMSC 274

3. A Periodic Alarm: intdate.c & sigsend.c

CS 3204 Operating Systems Programming Project #2 Job / CPU Scheduling Dr. Sallie Henry Spring 2001 Due on February 27, 2001.

Name: Checked: Preparation: Use variables to output a personalized message

CS 051 Homework Laboratory #2

Introduction to Programming with JES

Exam Datastrukturer. DIT960 / DIT961, VT-18 Göteborgs Universitet, CSE

CS 342 Software Design Spring 2018 Term Project Part II Development of Question, Answer, and Exam Classes

CS 241 Data Organization. August 21, 2018

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "

CPSC 121 Some Sample Questions for the Final Exam Tuesday, April 15, 2014, 8:30AM

6.01, Spring Semester, 2008 Assignment 3, Issued: Tuesday, February 19 1

CS112 Lecture: Defining Instantiable Classes

CS 104 (Spring 2014) Final Exam 05/09/2014

COMP 250. Lecture 27. hashing. Nov. 10, 2017

Programming Standards: You must conform to good programming/documentation standards. Some specifics:

Assignments 3 & 4. COMP248/Winter Assignment 3 & 4 Page 1 of 7

Lab 4: Bash Scripting

} Evaluate the following expressions: 1. int x = 5 / 2 + 2; 2. int x = / 2; 3. int x = 5 / ; 4. double x = 5 / 2.

CMPSC 111 Introduction to Computer Science I Fall 2016 Lab 2 Assigned: September 7, 2016 Due: Wednesday, September 14, 2016 by 2:30 pm

CSC-105 Exam #1 October 10, 2013

CMSC 201 Spring 2019 Lab 06 Lists

CSC258: Computer Organization. Memory Systems

EconPortal Instructor Quick Start for Krugman/Wells Macroeconomics, 3e

Chapter 2 First Java Programs

New York University Computer Science Department Courant Institute of Mathematical Sciences

Fall CSEE W4119 Computer Networks Programming Assignment 1 - Simple Online Bidding System

TUTORIAL. Ve r s i on 1. 0

C++ Style Guide. 1.0 General. 2.0 Visual Layout. 3.0 Indentation and Whitespace

Homework 1 Excel Basics

Project 1 Computer Science 2334 Spring 2016 This project is individual work. Each student must complete this assignment independently.

:

CS 2316 Homework 9a Login Due: Friday, November 2nd, before 11:55 PM Out of 100 points. Premise

Pipelining. Comp 120, Spring /3 Lecture. Forget Comp 120 Let s Solve a Real Problem. INPUT: dirty laundry

Project #3. Computer Science 2334 Fall Create a Graphical User Interface and import/export software for a Hurricane Database.

CS164: Midterm I. Fall 2003

Lab 3: Call to Order CSCI 2101 Fall 2017

CMSC 201 Spring 2017 Project 1 Number Classifier

Assignment Marking Criteria

Educational Fusion. Implementing a Production Quality User Interface With JFC

Assignment III: Graphing Calculator

King Abdulaziz University Faculty of Computing and Information Technology Computer Science Department

Hardware Description and Verification Lava Exam

CISC 181 Lab 2 (100 pts) Due: March 4 at midnight (This is a two-week lab)

Project 3 Restaurant or Store

CS 31: Introduction to Computer Systems. 03: Binary Arithmetic January 29

Where we are going (today)

Introduction to Java Unit 1. Using BlueJ to Write Programs

Java Style Guide. 1.0 General. 2.0 Visual Layout. Dr Caffeine

Lab 1 Introduction to UNIX and C

Pipelining. With all those 411 problem sets, I haven t had a minute to do laundry. Now that s what I call dirty laundry. Comp 411.

1 Getting started with Processing

Excel Basics Rice Digital Media Commons Guide Written for Microsoft Excel 2010 Windows Edition by Eric Miller

n! = 1 * 2 * 3 * 4 * * (n-1) * n

CS112 Lecture: Working with Numbers

CS 2316 Individual Homework 5 Joint Probability Out of 100 points

Project #1 rev 2 Computer Science 2334 Fall 2013 This project is individual work. Each student must complete this assignment independently.

Read every line of the exam sheet before programming!

CIS 121 Data Structures and Algorithms with Java Spring 2018

Remaining Enhanced Labs

CS 2316 Individual Homework 4 Greedy Scheduler (Part I) Due: Wednesday, September 18th, before 11:55 PM Out of 100 points

[ the academy_of_code] Senior Beginners

The Program Specification:

Pipelining. Quiz 2 (next week) will cover materials through Tuesday s lecture. Lab 3 is due tonight. what Seymour Cray taught the laundry industry

Transcription:

CS112 - INTRODUCTION TO PROGRAMMING Programming Project #2 - Due Wednesday, March 2, at the start of class Purposes: 1. To give you further experience with Java arithmetic and the use of the Math class. 2. To give you further experience with drawing in Java using the methods of the Graphics class. Introduction This project is based on a variant of problems 5.21 and 5.22 in Wu. As you recall, problem 5.21 was the basis for Lab 5 in this course. What you will do for this project is to create a Java applet that - as a minimum - displays a nice clock and two input fields labelled Hours and Minutes. When the user enters a time into these fields and presses the Enter key on the keyboard, the clock will be set to the new time. Example: Your program must consist of a minimum of two classes: an applet class and a clock class. The latter will be based on the class you created in Lab 5, but with various improvements, as discussed below. You may enjoy looking at versions of a similar project created by students in previous years, linked off the course home page. After the projects are completed, your applet will be posted on the department s web server so that fellow students, parents, friends, etc. can see what you ve created as well. 1

Evaluation Your grade on this project will be based on three criteria: 1. Correct, neat, and visually pleasing operation. (maximum 40-60 points, depending on options chosen) 2. Good methodology, including documentation, use of comments, overall structure, choice of names, and good use of white space to aid readability (indentation and blank lines). (maximum 20 points) 3. A project quiz, to be given on the due date. (maximum 20 points) A blank project cover sheet is attached and should be stapled to the front of your project submission. Requirements Minimal requirements - up to 40 points for correct operation Fulfill the requirements as stated above. Improve the appearance of the clock you created in Lab 5 in some or all of the following ways: Add numbers and/or markers around the face of the clock Improve the appearance of the clock hands. We ll discuss possibilities for this in class. Use color to make the clock more visually appealing. Other creative possibilities of your own devising Credit will be based on the aesthetics of the finished product. It is more beneficial to do what you do well than to do lots of things sloppily. Full credit will require doing all of the above, while demonstrating that you understand the formulas for positioning hands, markers etc. and that you have learned something beyond what we have explicitly covered in class or lab. Option 1 (Maximum of 5 additional points when added to the minimal requirements) Each clock should display the time both in digital form and in analog form. The digital time should be displayed before the label, just below the clock. Refer back to the discussion of formatting integers in class to be sure that times are correctly formatted - e.g. 1:03 should be displayed as 1:03, not 1:3 or 01:03. This must be handled by the clock object - not separately by the applet. (I.e. the clock object must display the digital time in its paint() method.) The following illustrates what this might look like: Option 2 (Maximum of 5 additional points when added to the minimal requirements - can be done with or without Option 1) Consider the task of drawing hash marks and time labels as in the example on page 1. This could be done by a series of statements like: graphics.drawstring("1", calculated X position for 1:00 hour label, calculated Y position for 1:00 hour label); graphics.drawline(calculated start X for 1:00, calculated start Y for 1:00, calculated finish X for 1:00, calculated finish Y for 1:00); 2

graphics.drawstring("2", calculated X position for 2:00 hour label, calculated Y position for 2:00 hour label); graphics.drawline(calculated start X for 2:00, calculated start Y for 2:00, calculated finish X for 2:00, calculated finish Y for 2:00);... graphics.drawstring("12", calculated X position for 12:00 hour label, calculated Y position for 12:00 hour label); graphics.drawline(calculated start X for 12:00, calculated start Y for 12:00, calculated finish X for 12:00, calculated finish Y for 12:00); It would be much nicer, however, if this were done using a for loop: for (int hour = 1; hour <= 12; hour ++) { calculate position for hour label and hash marks graphics.drawstring(""+hour, calculated X position, calculated Y position); graphics.drawline(calculated start X, calculated start Y, calculated finish X, calculated finish Y); } Where the positions for each hour label and hash mark are calculated based on the hour and the diameter of the clock. Implement both the drawing of 12 hash marks and 12 hour labels this way. (Hint: it is easy to calculate the position for the center of each label. It will take a bit of tweaking to get the label position to come out exactly right - especially the centering of the hour labels at 6:00 and 12:00, and the fact that the right hand side of the hour label is close to the clock for 7:00-11:00, while the left hand side of the hour label is close to the clock for 1:00-5:00. See the Hello class from Lab 5 for an example of how to center a label) The maximum of 5 points for this option will be given for hour labels and hash marks positioned perfectly symmetrically and elegant code. Option 3 (Maximum of 10 additional points when added to the minimal requirements - can be done with or without Options 1 and/or 2) North America encompasses a total of 8 time zones - listed here in order from east to west: Newfoundland, Atlantic, Eastern, Central, Mountain, Pacific, Alaska, and Hawaii. Information on converting times between these can be found at http://atm.geo.nsf.gov/ieis/time.html (all but Newfoundland) and http://www.education.gov.nf.ca/liv_rel_time.htm (Newfoundland Time). Modify your applet as follows: Instead of displaying one clock, display eight clocks - each showing the time in a different time zone. The label below each clock should indicate its time zone. One clock (Eastern Standard or the time zone of your home) should be displayed noticeably bigger than the other clocks (e.g. perhaps twice as big). The user will input the time in this zone, and the 8 clocks will each be set to the corresponding time in their zone. (Be sure your labelling of the input fields makes it clear to the user what zone the input is supposed to be in.). You don t need to worry about daylight savings time - after all, it s still winter! If you do this option, you ll need to take into account issues like the fact that the time 1 hour before 1 is 12, and the fact that Newfoundland time differs from EST by 1 hours 30 minutes. Also, give some time to making your overall screen layout aesthetically pleasing. Implementation Notes: 1. To start the project, copy the Project2 folder from the common volume to your server volume. This folder contains a BlueJ project and the applet class you will need to use (Project2.java). This class can be used essentially as is (with some aesthetic adjustments, 3

perhaps) unless you do the multiple clocks. You will need to create the Clock class and an html file to actually run the applet. Of course, you wouldn t forget to add appropriate comments to the Project2.java file as well! 2. If you do the multiple clocks option, you will need to add a considerable amount of additional code to Project2.java to handle the extra clocks. This will require adding instance variables for each clock changing the comment Create the clock to Create the clocks and adding code to create, add, and position each clock to this section. arranging to call settime() for each clock when the user enters a new value. possibly changing the setbounds() calls for the hours and minutes labels and hoursin and minutesin text fields to change their position on the overall screen. 3. If you do the multiple clocks option, each clock should be set to show the correct initial time relative to 12:45 in your primary time zone (EST or a different zone you have chosen). (I.e. if your Eastern time zone clock shows 12:45 initially, your Atlantic time zone clock should show 1:45, your Central time zone clock should show 11:45, Mountain 10:45, etc.) When the user updates the time, all clocks should be set to show the correct time relative to the new time the user entered in the primary time zone. Hint: This is most easily handled by adding two instance variables (say deltahours and deltaminutes) to each clock, which record the amount of time by which the clock s time zone differs from the primary time zone - e.g. if the primary time zone is Eastern, deltahours for Atlantic would be 1, while deltaminutes would be 0; for Newfoundland, deltahours would be 1 and deltaminutes would be 30. Include this information as two additional parameters to the constructor and specify the correct values for each clock as it is constructed. Use each clock s settime() method to set it to its equivalent to 12:45 Eastern at startup. 4. A demonstration of the functionality you are expected to achieve if you do all options is accessible from the course web page. Please note that this example does not use color or other features to produce good aesthetics - it simply behaves correctly. (Maximal credit requires more than this), For maximal credit, your project should be both functional and aesthetic. (But a beautiful program that does not work correctly is not a beautiful thing!) Turn in the following, neatly stapled in the order listed: 1. Project Coversheet (attached) 2. Documentation including Problem Statement and Design Document. (Note: you did similar documents in Lab 5, but the ones you turn in with the project should reflect the requirements of this project, not the lab.) 3. Printout of the java sources for the classes you created, and of your html file. Note that you are just to turn in a single program, reflecting the highest option you did. However, you will probably find it wise to attempt options successively, and to save a copy of an option before moving on to the next in the case of catastrophic error. Be sure you have deleted unnecessary boilerplate code creaetd by BlueJ. Leave on server: The BlueJ project folder containing an executable form of your classes. Also, drag the Project2 folder - with its name changed to your username2 to the CS112 Drop Box, following the procedure that will be demonstrated in class. (Note: you may not make any changes to the files in the folder after you have turned the project in! However, you may change the submitted version in the Drop Box prior to the due date by replacing it with a new version. 4

CS112 - INTRODUCTION TO PROGRAMMING - PROJECT TWO Option(s) attempted-check all that apply: 1 2 3 Author I. Correct Operation / Neat and Aesthetically-Pleasing Output II. Methodology 1.External documentation exhibits clear understanding of the problem and demonstrates good planning for solving it. 2.Prologue comments for files, classes and methods make the purpose of each item clear. 3.Identifiers (class, method, and variable names) clearly describe the item they name and follow OO naming conventions. 4.Features of the Java language and class library are used appropriately and efficiently. 5.Whitespace (indentation and blank lines) follows a consistent convention and makes the overall structure of the program clear by enhancing its readability. 6.Overall methodology results in a program that is easily understandable and obviously correct Definitely 5 Mostly 3 Partially or not at all 0 III. Quiz OVERALL TOTAL (Max 100) 5