Assignment 2, perquack2 class hierarchy in Java, due 11:59 PM, Sunday March 16, 2014 Login into your account on acad/bill and do the following steps:

Size: px
Start display at page:

Download "Assignment 2, perquack2 class hierarchy in Java, due 11:59 PM, Sunday March 16, 2014 Login into your account on acad/bill and do the following steps:"

Transcription

1 CSC 243 Java Programming, Spring 2014, Dr. Dale E. Parson Assignment 2, perquack2 class hierarchy in Java, due 11:59 PM, Sunday March 16, 2014 Login into your account on acad/bill and do the following steps: 1. Do the following after logging into acad/bill (I will post it during the morning of Sunday March 2): cp ~parson/javalang/perquack2.problem.zip ~/JavaLang/perquack2.problem.zip cd ~/JavaLang unzip perquack2.problem.zip cd./perquack2 gmake clean test Initially you will get this far through the tests: ASSIGNMENT1 JAVA TESTS STARTED java perquack2.perquacky english.mthes.txt hermione harry ron < jtest1.tx t > jtest1.out 2>jtest1.error.out diff jtest1.out jtest1.ref > jtest1.dif diff jtest1.error.out jtest1.error.ref > jtest1.error.dif ASSIGNMENT2 JAVA TESTS STARTED java perquack2.testperquacky perquack2.perquacky english.mthes.txt hermione harry ron < jtest1.txt > jtest1.out 2>jtest1.error.out gmake: *** [test] Error 3 Notice the command line for the first assignment 2 test above. perquack2.perquacky is now the first command-line argument for program perquack2.testperquacky. TestPerquacky implements a plug-in loader similar to the one we went over in class for last year s CSC 243 project 2. TestPerquacky loads perquack2.perquacky (or whatever class appears on the command line) as a subclass of interface IPerquacky. The handout code solves the problems of assignment 1 as a starting point. Here is the error message from the first of two assignment 2 tests: -bash-3.00$ cat jtest1.error.out Class does not inherit from IPerquacky: perquack2.perquacky: class perquack2.perquacky The figure above shows the Java interface IPerquacky and three classes Perquacky, PerquackyException, and TestPerquacky handed out as the starting point of assignment 2. Perquacky continues to work as it did for assignment 1, giving identical output. I have refactored the play, page 1 Dr. Dale E. Parson, CSC 243, Spring, 2014,

2 playround and playplayer methods of assignment 1 into a single playword method that keeps track of the round and player by using additional data fields in the Perquacky object. The reason I made that change is to move the terminal I/O (input/output) interaction with the players out of the object methods of class Perquacky and into the test drivers (Perquacky.main and TestPerquacky.main), because when we get to designing a graphical user interface (GUI) for the game, the interaction with the players will reside in GUI classes, so it must be outside of the game code. The interaction loop that prints prompts to players and reads their data entries now resides in the test drivers in Perquacky.main and TestPerquacky.main. The figure below shows the interface and class structure that is the goal for this assignment. Not all of the work items appear in this class diagram, but they do appear in the following list of requirements. Please read the following list again, after all automated tests pass, because there is documentation to write as part of this assignment, and its absence will not show up in testing. Classes TestPerquacky and PerquackyException are complete as supplied, so you should not change them at all. Interface IPerquacky is complete except for Javadoc documentation that you must write in IPerquacky.java. Do not change any of the method declarations in IPerquacky and do not add any. 1. Make class Perquacky a direct subclass of interface IPerquacky using interface inheritance. That is a little different from the above diagram, where Perquacky is a subclass of abstract class PerquackyHelper using implementation inheritance, and PerquackyHelper is a subclass of IPerquacky. This is an intermediate step. You can find the syntax for making a class a subclass of an interface in my handout for the FillWord2 package from last year s Java course. 2. Go through Perquacky.java and change every occurrence of LinkedList<String> to List<String> except for the ones that say new LinkedList<String>. In other words, change all local variable declarations, object field declarations, and method parameter declarations that are currently LinkedList to the List interface. Do not change the new constructor calls, because you page 2 Dr. Dale E. Parson, CSC 243, Spring, 2014,

3 cannot construct a new object of an interface. An interface is a specification. Once this step is done, gmake clean test will pass these two tests: ASSIGNMENT1 JAVA TESTS STARTED and ASSIGNMENT2 JAVA TESTS STARTED. It will not pass ASSIGNMENT2 TESTS OF EXTENSION CLASS Perwhacky STARTED yet. 3. Write class Perwhacky that is a subclass of Perquacky. Perwhacky provides only two methods. The first is a constructor with a signature identical to Perquacky s constructor except that the constructor name is Perwhacky. The body of that constructor should just call Perquacky s constructor by using the super keyword with all of the constructor arguments. The second method is playword with the same signature as IPerquacky.playWord and Perquacky.playWord. Perwhacky.playWord must construct a String that is the reversal of its word argument esuoh becomes house and calls its base class Perquacky.playWord with that reversed String as the argument. Perwhacky forces the player to type words backwards. Once you have step 3 working, all of the tests should pass, including ASSIGNMENT2 TESTS OF EXTENSION CLASS Perwhacky STARTED. 4. Create abstract class PerquackyHelper that is a subclass of IPerquacky. MOVE all of the data fields at the top of class Perquacky, from vulnerablescore down through currentplayerwordset, into PerquackyHelper. Make sure to keep the Javadoc comments with the fields. Also, change the public and private modifiers for these fields into protected. All of the fields should be protected so that subclasses can access them. Later on we may make some of the constant fields variable so we can change scoring rules of games, but for now keep the static and final modifiers the way they are. MOVE the code for the Perquacky constructor into the PerquackyHelper constructor, and change the Perquacky to call the PerquackyHelper using super. MOVE all of the methods of Perquacky except playword and main into PerquackyHelper. Keep the public methods public, and make the private methods protected, since you may need to redefine them in subclasses that extend the game later on. Make Perquacky a subclass of PerquackyHelper. You can leave its inheritance to IPerquacky intact or take it out. Perquacky inherits from IPerquacky through PerquackyHelper. Declaring Perquacky as a subclass of IPerquacky is OK but optional. Your best bet is probably just to cp Perquacky.java PerquackyHelper.java and then edit the two files to change or remove fields and methods as required. You will need to change the class and constructor name for PerquackyHelper. At this point gmake clean test should work again. 5. Write Javadoc comments for the methods of tags as needed. When you have this done, after running a successful gmake clean test, run gmake javadoc to generate the HTML pages. You can then browse to where YOURID is your Unix login ID. Don t forget to prefix YOURID with a ~ symbol. Browse your Javadoc HTML pages to make sure IPerquacky does not have any missing or incorrect entries. page 3 Dr. Dale E. Parson, CSC 243, Spring, 2014,

4 Time management study survey: OPTIONAL 2% BONUS CREDITS I am collecting data for assessment that determines the associations between a) project start date, b) length of work sessions, c) time of day of work sessions, and d) conflicting schedule pressures, and student success on projects as measured by grades and grade improvements. You can earn half of these bonus points (1% additional for the project) by permitting me to collect file sizes, time stamps, time of change, and duration of work session. My automatic script uses a simple ls l command to list directory contents, and it keeps backup copies of your source files to determine amount of code changed per session. The log data goes to my account to keep your account from running out of file space. If you do not want to participate, run gmake optout to shut off data collection, and also notify me my using the subject line opt out. I will not collect your data, and if you have already turned some in, I will remove the files. You can earn an additional 1% bonus point by completing a survey in file survey.txt in the project directory. Please fully replace each ****** field with a number. To get this 1% you must also allow data collection for the previous 1%. This survey is not useful without the auto-collected log data. Thus, the total possible points for a project is 102%. The collected data in no way affects your grade, other than by contribution of bonus points. My assessment outlined in the first paragraph of this section could show an association between number of CSC courses that assign you big projects on the same week and the rate of problems encountered completing an assignment. I am looking for ways to improve success rates on projects in future semesters, and I need to collect data in survey.txt and by automatic data collection before I can analyze these data. This is not secret data mining, and I have no time or intention of analyzing the data until this summer. Again, if you wish to opt out of this optional part of assignments, there is no penalty. When you are all ready, do this from the assignment directory: gmake turnitin If it completes without an error message (after it prompts for a Carriage Return that you must enter), then your assignment has reached me. If you later make changes and want to turn in a revised assignment, just gmake turnitin again from the same directory. It will over-write any previous submission with the new one. Please start early, so you can come to see me with the problem if you get stuck. Notes on debugging. When gmake test runs a test like this: java perquack2.testperquacky perquack2.perquacky english.mthes.txt hermione harry ron < jtest1.txt > jtest1.out 2>jtest1.error.out diff jtest1.out jtest1.ref > jtest1.dif diff jtest1.error.out jtest1.error.ref > jtest1.error.dif page 4 Dr. Dale E. Parson, CSC 243, Spring, 2014,

5 If the java command stops with an error, your program has hit a run-time exception. Look at the bottom of the jtest1.error.out (or jtest2.error.out if that is what is on the command line) to see the error. If a diff command finds a difference between your output in the.out file and the expected output in the.ref file, look in the.dif file to see a listing of the differences. I often bring up two terminal windows and open the.out file in one and the.ref file in the other so I can inspect the differences. The.dif file tells me what line numbers to inspect. IPerquacky.java 1 // perquack2/iperquacky 2 // CSC 243 Java Programming Spring // Assignment package perquack2 ; 6 7 public interface IPerquacky { 8 public int getnumberofplayers(); 9 public String getplayername(int playerindex) throws PerquackyException; 10 public int getplayerscore(int playerindex) throws PerquackyException ; 11 public int getcurrentplayer(); 12 public String getcurrentplayerprompt(); 13 public String [][] getcurrentplayerwords(); 14 public void printcurrentplayerwords(); 15 public void playword(string word) throws PerquackyException ; 16 public boolean isrounddone(); 17 public boolean isgamedone(); 18 public int [] getwinners() ; 19 } PerquackyException.java 1 /* PerquackyException.java 2 An Exception thrown by a Perquacky-family game on an error. 3 Demonstration of Java interfaces and packages. 4 Dr. Dale Parson, CSC 243, Spring */ 6 7 package perquack2 ; 8 9 /** 10 Class PerquackyException is thrown by the Perquacky package classes 11 on any game error. 12 Professor Dale Parson 14 **/ 15 public class PerquackyException extends Exception { 16 // serialversionuid encodes MMDDYYYY of change to serializable state. 17 private static final long serialversionuid = L ; 18 /** page 5 Dr. Dale E. Parson, CSC 243, Spring, 2014,

6 19 * Construct an exception for Game with message text. 20 */ 21 public PerquackyException(String text) { 22 super(text); 23 } 24 } TestPerquacky.java 1 // perquack2/testperquacky 2 // CSC 243 Java Programming Spring // D. Parson's solution to the first Perquacky problem. 4 5 package perquack2 ; 6 import java.util.scanner ; 7 import java.util.list ; 8 import java.util.linkedlist ; 9 10 /** 11 This is the test driver for classes that implement interface 12 IPerquacky. It provides a main method that loads a 13 IPerquacky-derived class as a plug-in and runs that game. D. Parson 15 **/ 16 public class TestPerquacky { 17 /** 18 * Validate command line arguments, then construct and play 19 * a game of IPerquacky to completion. Command line usage is 20 * java perquack2.testperquacky IPerquackyCLASS dictionaryfilename seed players * where there must be 2 or more players. 22 **/ 23 public static void main(string [] args) { 24 String usage = 25 "java perquack2.perquacky IPerquackyCLASS dictionaryfilename seed players..."; 26 if (args.length < 5) { 27 System.err.println(usage); 28 System.exit(1); 29 } 30 List<String> players = new LinkedList<String>(); 31 for (int i = 3 ; i < args.length ; i++) { 32 players.add(args[i]); 33 } 34 try { 35 // Load class args[0] from the file 36 // system and run its 3-param cons. 37 Class <? extends 38 IPerquacky> puzzleclass 39 = Class.forName(args[0]). 40 assubclass(iperquacky.class); 41 Class<?> [] consparams = new Class<?> [3]; 42 consparams[0] = String.class ; // constructor's param type page 6 Dr. Dale E. Parson, CSC 243, Spring, 2014,

7 43 consparams[1] = Long.class ; // constructor's param type 44 consparams[2] = List.class ; // constructor's param type 45 // NOTE: consargs[2] must be a List<String> 46 Object [] consargs = new Object [3]; 47 consargs[0] = args[1]; 48 consargs[1] = new Long(args[2]) ; 49 consargs[2] = players; 50 java.lang.reflect.constructor<? 51 extends IPerquacky> newcons = 52 puzzleclass.getconstructor(consparams); 53 IPerquacky game = (IPerquacky) 54 newcons.newinstance(consargs); 55 Scanner cin = new Scanner(System.in); 56 while (! game.isgamedone()) { 57 System.out.print(game.getCurrentPlayerPrompt()); 58 String word = cin.nextline().trim().tolowercase(); 59 try { 60 game.playword(word); 61 } catch (PerquackyException pex) { 62 System.err.println("GAME ERROR: " + pex.getmessage()); 63 } 64 } 65 int [] winners = game.getwinners(); 66 if (winners.length == 1) { 67 System.out.println("WINNER IS: " 68 + game.getplayername(winners[0])); 69 } else { 70 for (int j = 0 ; j < winners.length ; j++) { 71 System.out.println("TIE FOR WINNER: " 72 + game.getplayername(winners[j])); 73 } 74 } 75 // Print out the scores. 76 System.out.println("SCORES:"); 77 for (int i = 0 ; i < game.getnumberofplayers() ; i++) { 78 System.out.println("\t" + game.getplayerscore(i) 79 + " " + game.getplayername(i)); 80 } 81 } catch (PerquackyException px2) { 82 System.err.println("GAME ERROR: " + px2.getmessage()); 83 } catch (java.lang.classnotfoundexception cnx) { 84 System.err.println("Class not found: " + args[0] 85 + ": " + cnx.getmessage()); 86 // cnx.printstacktrace(); 87 System.exit(3); 88 } catch (java.lang.classcastexception ccx) { 89 System.err.println("Class does not inherit from IPerquacky: " 90 + args[0] 91 + ": " + ccx.getmessage()); 92 System.exit(3); 93 } catch (java.lang.nosuchmethodexception nnx) { page 7 Dr. Dale E. Parson, CSC 243, Spring, 2014,

8 94 System.err.println("Class constructor not found: " + args[0] 95 + ": " + nnx.getmessage()); 96 System.exit(3); 97 } catch (java.lang.instantiationexception inx) { 98 System.err.println("Class constructor error: " + args[0] 99 + ": " + inx.getmessage()); 100 System.exit(3); 101 } catch (java.lang.illegalaccessexception anx) { 102 System.err.println("Class constructor access error: " + args[0] ": " + anx.getmessage()); 104 System.exit(3); 105 } catch (java.lang.reflect.invocationtargetexception vnx) { 106 System.err.println("Class constructor call error: " + args[0] ": " + vnx.getmessage()); 108 System.exit(3); 109 } 110 System.exit(0); 111 } 112 } page 8 Dr. Dale E. Parson, CSC 243, Spring, 2014,

Here are the steps to get the files for this project after logging in on acad/bill.

Here are the steps to get the files for this project after logging in on acad/bill. CSC 243, Java Programming, Spring 2014, Dr. Dale Parson Assignment 4, implementing undo, redo & initial GUI layout ASSIGNMENT due by 11:59 PM on Saturday April 19 via gmake turnitin ASSIGNMENT 5 (see page

More information

CSC 310 Programming Languages, Spring 2014, Dr. Dale E. Parson

CSC 310 Programming Languages, Spring 2014, Dr. Dale E. Parson CSC 310 Programming Languages, Spring 2014, Dr. Dale E. Parson Assignment 3, Perquacky in Python, due 11:59 PM, Saturday April 12, 2014 I will turn the solution back on Monday April 14, after which I will

More information

Here are the steps to get the files for this project after logging in on acad/bill.

Here are the steps to get the files for this project after logging in on acad/bill. CSC 243, Java Programming, Spring 2013, Dr. Dale Parson Assignment 3, cloning & serializing game state for save & restore commands ASSIGNMENT due by 11:59 PM on Thursday April 11 via gmake turnitin Here

More information

Here are the steps to get the files for this project after logging in on acad/bill.

Here are the steps to get the files for this project after logging in on acad/bill. CSC 243, Java Programming, Spring 2013, Dr. Dale Parson Assignment 5, handling events in a working GUI ASSIGNMENT due by 11:59 PM on Thursday May 9 via gmake turnitin Here are the steps to get the files

More information

Perform the following steps to copy and inspect my initial code handout.

Perform the following steps to copy and inspect my initial code handout. Java classes, interfaces and exceptions Assignment 2 for CSC 243, Spring, 2010, Dr. Dale E. Parson http://faculty.kutztown.edu/parson/spring2010/csc243spring2010.html Assignment 2 is due 11:59 PM on Thursday

More information

Introduction to Programming System Design CSCI 455x (4 Units)

Introduction to Programming System Design CSCI 455x (4 Units) Introduction to Programming System Design CSCI 455x (4 Units) Description This course covers programming in Java and C++. Topics include review of basic programming concepts such as control structures,

More information

There are several files including the start of a unit test and the method stubs in MindNumber.java. Here is a preview of what you will do:

There are several files including the start of a unit test and the method stubs in MindNumber.java. Here is a preview of what you will do: Project MindNumber Collaboration: Solo. Complete this project by yourself with optional help from section leaders. Do not work with anyone else, do not copy any code directly, do not copy code indirectly

More information

CSC 510 Advanced Operating Systems, Fall 2017

CSC 510 Advanced Operating Systems, Fall 2017 CSC 510 Advanced Operating Systems, Fall 2017 Dr. Dale E. Parson, Assignment 4, Benchmarking and analyzing a modified Assignment 1 running on System VMs on Type 1 and Type 2 hypervisors. This assignment

More information

CS 11 java track: lecture 3

CS 11 java track: lecture 3 CS 11 java track: lecture 3 This week: documentation (javadoc) exception handling more on object-oriented programming (OOP) inheritance and polymorphism abstract classes and interfaces graphical user interfaces

More information

CSC 543 Multiprocessing & Concurrent Programming, Fall 2016

CSC 543 Multiprocessing & Concurrent Programming, Fall 2016 CSC 543 Multiprocessing & Concurrent Programming, Fall 2016 Dr. Dale E. Parson, Midterm Exam Project, Assorted Thread Synchronization Problems This assignment is due by 11:59 PM on Wednesday November 2

More information

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

Project #1 rev 2 Computer Science 2334 Fall 2013 This project is individual work. Each student must complete this assignment independently. Project #1 rev 2 Computer Science 2334 Fall 2013 This project is individual work. Each student must complete this assignment independently. User Request: Create a simple magazine data system. Milestones:

More information

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

Project 1 Computer Science 2334 Spring 2016 This project is individual work. Each student must complete this assignment independently. Project 1 Computer Science 2334 Spring 2016 This project is individual work. Each student must complete this assignment independently. User Request: Create a simple movie data system. Milestones: 1. Use

More information

Exception Handling. Sometimes when the computer tries to execute a statement something goes wrong:

Exception Handling. Sometimes when the computer tries to execute a statement something goes wrong: Exception Handling Run-time errors The exception concept Throwing exceptions Handling exceptions Declaring exceptions Creating your own exception Ariel Shamir 1 Run-time Errors Sometimes when the computer

More information

Question: Total Points: Score:

Question: Total Points: Score: CS 170 Exam 1 Section 000 Spring 2015 Name (print): Instructions: Keep your eyes on your own paper and do your best to prevent anyone else from seeing your work. Do NOT communicate with anyone other than

More information

Exception Handling. Run-time Errors. Methods Failure. Sometimes when the computer tries to execute a statement something goes wrong:

Exception Handling. Run-time Errors. Methods Failure. Sometimes when the computer tries to execute a statement something goes wrong: Exception Handling Run-time errors The exception concept Throwing exceptions Handling exceptions Declaring exceptions Creating your own exception 22 November 2007 Ariel Shamir 1 Run-time Errors Sometimes

More information

(800) Toll Free (804) Fax Introduction to Java and Enterprise Java using Eclipse IDE Duration: 5 days

(800) Toll Free (804) Fax   Introduction to Java and Enterprise Java using Eclipse IDE Duration: 5 days Course Description This course introduces the Java programming language and how to develop Java applications using Eclipse 3.0. Students learn the syntax of the Java programming language, object-oriented

More information

CS61BL. Lecture 1: Welcome to CS61BL! Intro to Java and OOP Testing Error-handling

CS61BL. Lecture 1: Welcome to CS61BL! Intro to Java and OOP Testing Error-handling CS61BL Lecture 1: Welcome to CS61BL! Intro to Java and OOP Testing Error-handling About me Name: Edwin Liao Email: edliao@berkeley.edu Office hours: Thursday 3pm - 5pm Friday 11am - 1pm 611 Soda Or by

More information

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

Lesson 10: Quiz #1 and Getting User Input (W03D2) Lesson 10: Quiz #1 and Getting User Input (W03D2) Balboa High School Michael Ferraro September 1, 2015 1 / 13 Do Now: Prep GitHub Repo for PS #1 You ll need to submit the 5.2 solution on the paper form

More information

Exceptions and Libraries

Exceptions and Libraries Exceptions and Libraries RS 9.3, 6.4 Some slides created by Marty Stepp http://www.cs.washington.edu/143/ Edited by Sarah Heckman 1 Exceptions exception: An object representing an error or unusual condition.

More information

Self-test Java Programming

Self-test Java Programming Self-test Java Programming Document: e0883test.fm 16 January 2018 ABIS Training & Consulting Diestsevest 32 / 4b B-3000 Leuven Belgium TRAINING & CONSULTING INTRODUCTION TO THE SELF-TEST JAVA PROGRAMMING

More information

Portions adapted from A Visual Guide to Version Control. Introduction to CVS

Portions adapted from A Visual Guide to Version Control. Introduction to CVS Portions adapted from A Visual Guide to Version Control Introduction to CVS Outline Introduction to Source Code Management & CVS CVS Terminology & Setup Basic commands Checkout, Add, Commit, Diff, Update,

More information

Software and Programming 1

Software and Programming 1 Software and Programming 1 Week 9 Lab - Use of Classes and Inheritance 8th March 2018 SP1-Lab9-2018.ppt Tobi Brodie (Tobi@dcs.bbk.ac.uk) 1 Lab 9: Objectives Exercise 1 Student & StudentTest classes 1.

More information

CISC-124. Passing Parameters. A Java method cannot change the value of any of the arguments passed to its parameters.

CISC-124. Passing Parameters. A Java method cannot change the value of any of the arguments passed to its parameters. CISC-124 20180215 These notes are intended to summarize and clarify some of the topics that have been covered recently in class. The posted code samples also have extensive explanations of the material.

More information

CSC 343 Operating Systems, Fall 2015

CSC 343 Operating Systems, Fall 2015 CSC 343 Operating Systems, Fall 2015 Dr. Dale E. Parson, Assignment 4, analyzing swapping algorithm variations. This assignment is due via gmake turnitin from the swapping2015 directory by 11:59 PM on

More information

Example Program. public class ComputeArea {

Example Program. public class ComputeArea { COMMENTS While most people think of computer programs as a tool for telling computers what to do, programs are actually much more than that. Computer programs are written in human readable language for

More information

COMP 110 Programming Exercise: Simulation of the Game of Craps

COMP 110 Programming Exercise: Simulation of the Game of Craps COMP 110 Programming Exercise: Simulation of the Game of Craps Craps is a game of chance played by rolling two dice for a series of rolls and placing bets on the outcomes. The background on probability,

More information

CS164: Programming Assignment 5 Decaf Semantic Analysis and Code Generation

CS164: Programming Assignment 5 Decaf Semantic Analysis and Code Generation CS164: Programming Assignment 5 Decaf Semantic Analysis and Code Generation Assigned: Sunday, November 14, 2004 Due: Thursday, Dec 9, 2004, at 11:59pm No solution will be accepted after Sunday, Dec 12,

More information

Project #1 Computer Science 2334 Fall 2008

Project #1 Computer Science 2334 Fall 2008 Project #1 Computer Science 2334 Fall 2008 User Request: Create a Word Verification System. Milestones: 1. Use program arguments to specify a file name. 10 points 2. Use simple File I/O to read a file.

More information

ASSIGNMENT 5 Objects, Files, and a Music Player

ASSIGNMENT 5 Objects, Files, and a Music Player ASSIGNMENT 5 Objects, Files, and a Music Player COMP-202A, Fall 2009, All Sections Due: Thursday, December 3, 2009 (23:55) You MUST do this assignment individually and, unless otherwise specified, you

More information

Question: Total Points: Score:

Question: Total Points: Score: CS 170 Exam 1 Section 000 Spring 2015 Name (print): Instructions: Keep your eyes on your own paper and do your best to prevent anyone else from seeing your work. Do NOT communicate with anyone other than

More information

ASSIGNMENT NO 13. Objectives: To learn and understand concept of Inheritance in Java

ASSIGNMENT NO 13. Objectives: To learn and understand concept of Inheritance in Java Write a program in Java to create a player class. Inherit the classes Cricket_player, Football_player and Hockey_player from player class. The objective of this assignment is to learn the concepts of inheritance

More information

Timing ListOperations

Timing ListOperations Timing ListOperations Michael Brockway November 13, 2017 These slides are to give you a quick start with timing operations in Java and with making sensible use of the command-line. Java on a command-line

More information

CSC 343 Operating Systems, Fall 2015

CSC 343 Operating Systems, Fall 2015 CSC 343 Operating Systems, Fall 2015 Dr. Dale E. Parson, Assignment 2, modeling an atomic spin lock, a mutex, and a condition variable. This assignment is due via gmake turnitin from the criticalsection2015

More information

CSC 552 UNIX System Programming, Fall 2015

CSC 552 UNIX System Programming, Fall 2015 CSC 552 UNIX System Programming, Fall 2015 Dr. Dale E. Parson, Assignment 4, multi-threading a socket-based server loop & helper functions. This assignment is due via make turnitin from the wordcathreadc4/

More information

Logistics. Final Exam on Friday at 3pm in CHEM 102

Logistics. Final Exam on Friday at 3pm in CHEM 102 Java Review Logistics Final Exam on Friday at 3pm in CHEM 102 What is a class? A class is primarily a description of objects, or instances, of that class A class contains one or more constructors to create

More information

CSCI 355 LAB #2 Spring 2004

CSCI 355 LAB #2 Spring 2004 CSCI 355 LAB #2 Spring 2004 More Java Objectives: 1. To explore several Unix commands for displaying information about processes. 2. To explore some differences between Java and C++. 3. To write Java applications

More information

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

Due: 9 February 2017 at 1159pm (2359, Pacific Standard Time) CSE 11 Winter 2017 Program Assignment #2 (100 points) START EARLY! Due: 9 February 2017 at 1159pm (2359, Pacific Standard Time) PROGRAM #2: DoubleArray11 READ THE ENTIRE ASSIGNMENT BEFORE STARTING In lecture,

More information

CSCI 355 Lab #2 Spring 2007

CSCI 355 Lab #2 Spring 2007 CSCI 355 Lab #2 Spring 2007 More Java Objectives: 1. To explore several Unix commands for displaying information about processes. 2. To explore some differences between Java and C++. 3. To write Java applications

More information

Programming II (CS300)

Programming II (CS300) 1 Programming II (CS300) Chapter 04: Exception Handling MOUNA KACEM mouna@cs.wisc.edu Spring 2018 Creating Classes 2 Introduction Exception Handling Common Exceptions Exceptions with Methods Assertions

More information

CSC UNIX System, Spring 2015

CSC UNIX System, Spring 2015 ` CSC 352 - UNIX System, Spring 2015 Assignment 2, due by 11:59 on Friday March 6 via gmake turnitin. Dr. Dale E. Parson, http://faculty.kutztown.edu/parson The directory, source-file and makefile contents

More information

COMP 1210 Documentation Guidelines Page 1 of 7. Class documentation (Chapter 1):

COMP 1210 Documentation Guidelines Page 1 of 7. Class documentation (Chapter 1): COMP 1210 Documentation Guidelines Page 1 of 7 Class documentation (Chapter 1): Every class in your program should have a Javadoc tag that specifies the programs purpose, the project number, the author,

More information

Chapter 1 Lab Algorithms, Errors, and Testing

Chapter 1 Lab Algorithms, Errors, and Testing Chapter 1 Lab Algorithms, Errors, and Testing Lab Objectives Be able to write an algorithm Be able to compile a Java program Be able to execute a Java program using the Sun JDK or a Java IDE Be able to

More information

CS 201 Advanced Object-Oriented Programming Lab 6 - Sudoku, Part 2 Due: March 10/11, 11:30 PM

CS 201 Advanced Object-Oriented Programming Lab 6 - Sudoku, Part 2 Due: March 10/11, 11:30 PM CS 201 Advanced Object-Oriented Programming Lab 6 - Sudoku, Part 2 Due: March 10/11, 11:30 PM Introduction to the Assignment In this lab, you will finish the program to allow a user to solve Sudoku puzzles.

More information

CS 215 Software Design Homework 3 Due: February 28, 11:30 PM

CS 215 Software Design Homework 3 Due: February 28, 11:30 PM CS 215 Software Design Homework 3 Due: February 28, 11:30 PM Objectives Specifying and checking class invariants Writing an abstract class Writing an immutable class Background Polynomials are a common

More information

Object Oriented Programming and Design in Java. Session 2 Instructor: Bert Huang

Object Oriented Programming and Design in Java. Session 2 Instructor: Bert Huang Object Oriented Programming and Design in Java Session 2 Instructor: Bert Huang Announcements TA: Yipeng Huang, yh2315, Mon 4-6 OH on MICE clarification Next Monday's class canceled for Distinguished Lecture:

More information

Object Oriented Programming: In this course we began an introduction to programming from an object-oriented approach.

Object Oriented Programming: In this course we began an introduction to programming from an object-oriented approach. CMSC 131: Chapter 28 Final Review: What you learned this semester The Big Picture Object Oriented Programming: In this course we began an introduction to programming from an object-oriented approach. Java

More information

CSC207 Week 3. Larry Zhang

CSC207 Week 3. Larry Zhang CSC207 Week 3 Larry Zhang 1 Announcements Readings will be posted before the lecture Lab 1 marks available in your repo 1 point for creating the correct project. 1 point for creating the correct classes.

More information

Worksheet 3: Predictive Text Entry

Worksheet 3: Predictive Text Entry Worksheet 3: Predictive Text Entry MSc & ICY Software Workshop, Spring term 2015-16 Seyyed Shah and Uday Reddy Assigned: Tuesday 2 February Intermediate deadline : parts 1 and 2, Tuesday 9th February,

More information

Graphical Interface and Application (I3305) Semester: 1 Academic Year: 2017/2018 Dr Antoun Yaacoub

Graphical Interface and Application (I3305) Semester: 1 Academic Year: 2017/2018 Dr Antoun Yaacoub Lebanese University Faculty of Science Computer Science BS Degree Graphical Interface and Application (I3305) Semester: 1 Academic Year: 2017/2018 Dr Antoun Yaacoub 2 Crash Course in JAVA Classes A Java

More information

Note: This is a miniassignment and the grading is automated. If you do not submit it correctly, you will receive at most half credit.

Note: This is a miniassignment and the grading is automated. If you do not submit it correctly, you will receive at most half credit. Com S 227 Spring 2018 Miniassignment 1 40 points Due Date: Thursday, March 8, 11:59 pm (midnight) Late deadline (25% penalty): Friday, March 9, 11:59 pm General information This assignment is to be done

More information

CSC UNIX System, Spring 2015

CSC UNIX System, Spring 2015 CSC 352 - UNIX System, Spring 2015 Study guide for the CSC352 midterm exam (20% of grade). Dr. Dale E. Parson, http://faculty.kutztown.edu/parson We will have a midterm on March 19 on material we have

More information

Question: Total Points: Score:

Question: Total Points: Score: CS 170 Exam 1 Section 000 Spring 2014 Name (print):. Instructions Keep your eyes on your own paper and do your best to prevent anyone else from seeing your work. Do NOT communicate with anyone other than

More information

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

Tips from the experts: How to waste a lot of time on this assignment Com S 227 Spring 2018 Assignment 1 100 points Due Date: Friday, September 14, 11:59 pm (midnight) Late deadline (25% penalty): Monday, September 17, 11:59 pm General information This assignment is to be

More information

CS 170 Section 3, Spring 2015 Programming in Java Midterm Exam 1. Name (print):

CS 170 Section 3, Spring 2015 Programming in Java Midterm Exam 1. Name (print): Name (print): INSTRUCTIONS: o Keep your eyes on your own paper and do your best to prevent anyone else from seeing your work. o Do NOT communicate with anyone other than the professor/proctor for ANY reason

More information

CMSC 202. Exceptions

CMSC 202. Exceptions CMSC 202 Exceptions Error Handling In the ideal world, all errors would occur when your code is compiled. That won t happen. Errors which occur when your code is running must be handled by some mechanism

More information

The University of Melbourne Department of Computer Science and Software Engineering Software Design Semester 2, 2003

The University of Melbourne Department of Computer Science and Software Engineering Software Design Semester 2, 2003 The University of Melbourne Department of Computer Science and Software Engineering 433-254 Software Design Semester 2, 2003 Answers for Tutorial 7 Week 8 1. What are exceptions and how are they handled

More information

I pledge by honor that I will not discuss this exam with anyone until my instructor reviews the exam in the class.

I pledge by honor that I will not discuss this exam with anyone until my instructor reviews the exam in the class. Name: Covers Chapters 1-3 50 mins CSCI 1301 Introduction to Programming Armstrong Atlantic State University Instructor: Dr. Y. Daniel Liang I pledge by honor that I will not discuss this exam with anyone

More information

16-Dec-10. Consider the following method:

16-Dec-10. Consider the following method: Boaz Kantor Introduction to Computer Science IDC Herzliya Exception is a class. Java comes with many, we can write our own. The Exception objects, along with some Java-specific structures, allow us to

More information

Shell Interface Assignment

Shell Interface Assignment Page 1 of 9 Shell Interface Assignment Creating a Shell Interface Using Java This assignment consists of modifying a Java program so that it serves as a shell interface that accepts user commands and then

More information

************ THIS PROGRAM IS NOT ELIGIBLE FOR LATE SUBMISSION. ALL SUBMISSIONS MUST BE RECEIVED BY THE DUE DATE/TIME INDICATED ABOVE HERE

************ THIS PROGRAM IS NOT ELIGIBLE FOR LATE SUBMISSION. ALL SUBMISSIONS MUST BE RECEIVED BY THE DUE DATE/TIME INDICATED ABOVE HERE Program 10: 40 points: Due Tuesday, May 12, 2015 : 11:59 p.m. ************ THIS PROGRAM IS NOT ELIGIBLE FOR LATE SUBMISSION. ALL SUBMISSIONS MUST BE RECEIVED BY THE DUE DATE/TIME INDICATED ABOVE HERE *************

More information

CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 2: SEP. 8TH INSTRUCTOR: JIAYIN WANG

CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 2: SEP. 8TH INSTRUCTOR: JIAYIN WANG CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 2: SEP. 8TH INSTRUCTOR: JIAYIN WANG 1 Notice Class Website http://www.cs.umb.edu/~jane/cs114/ Reading Assignment Chapter 1: Introduction to Java Programming

More information

Introduction to Data Structures

Introduction to Data Structures 15-121 Introduction to Data Structures Lecture #1 Introduction 28 August 2019 Margaret Reid-Miller Today Course Administration Overview of Course A (very basic) Java introduction Course website: www.cs.cmu.edu/~mrmiller/15-121

More information

Introduction to Programming Using Java (98-388)

Introduction to Programming Using Java (98-388) Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;

More information

Write for your audience

Write for your audience Comments Write for your audience Program documentation is for programmers, not end users There are two groups of programmers, and they need different kinds of documentation Some programmers need to use

More information

Programming II (CS300)

Programming II (CS300) 1 Programming II (CS300) Chapter 04: Exception Handling MOUNA KACEM mouna@cs.wisc.edu Fall 2018 Creating Classes 2 Introduction Exception Handling Common Exceptions Exceptions with Methods Assertions and

More information

CS 116 Week 8 Page 1

CS 116 Week 8 Page 1 CS 116 Week 8: Outline Reading: 1. Dale, Chapter 11 2. Dale, Lab 11 Objectives: 1. Mid-term exam CS 116 Week 8 Page 1 CS 116 Week 8: Lecture Outline 1. Mid-term Exam CS 116 Week 8 Page 2 CS 116 Week 8:

More information

CMSC 341. Nilanjan Banerjee

CMSC 341. Nilanjan Banerjee CMSC 341 Nilanjan Banerjee http://www.csee.umbc.edu/~nilanb/teaching/341/ Announcements Just when you thought Shawn was going to teach this course! On a serious note: register on Piazza I like my classes

More information

F I N A L E X A M I N A T I O N

F I N A L E X A M I N A T I O N Faculty Of Computer Studies M257 Putting Java to Work F I N A L E X A M I N A T I O N Number of Exam Pages: (including this cover sheet( Spring 2011 April 4, 2011 ( 5 ) Time Allowed: ( 1.5 ) Hours Student

More information

Outline. Java Models for variables Types and type checking, type safety Interpretation vs. compilation. Reasoning about code. CSCI 2600 Spring

Outline. Java Models for variables Types and type checking, type safety Interpretation vs. compilation. Reasoning about code. CSCI 2600 Spring Java Outline Java Models for variables Types and type checking, type safety Interpretation vs. compilation Reasoning about code CSCI 2600 Spring 2017 2 Java Java is a successor to a number of languages,

More information

Inheritance and Interfaces

Inheritance and Interfaces Inheritance and Interfaces Object Orientated Programming in Java Benjamin Kenwright Outline Review What is Inheritance? Why we need Inheritance? Syntax, Formatting,.. What is an Interface? Today s Practical

More information

CS 315 Software Design Homework 3 Preconditions, Postconditions, Invariants Due: Sept. 29, 11:30 PM

CS 315 Software Design Homework 3 Preconditions, Postconditions, Invariants Due: Sept. 29, 11:30 PM CS 315 Software Design Homework 3 Preconditions, Postconditions, Invariants Due: Sept. 29, 11:30 PM Objectives Defining a wellformed method to check class invariants Using assert statements to check preconditions,

More information

Announcements. 1. Forms to return today after class:

Announcements. 1. Forms to return today after class: Announcements Handouts (3) to pick up 1. Forms to return today after class: Pretest (take during class later) Laptop information form (fill out during class later) Academic honesty form (must sign) 2.

More information

HHH Instructional Computing Fall

HHH Instructional Computing Fall Quick Start Guide for School Web Lockers Teacher log-on is the same as for Infinite Campus Student log-on is the same initial log on to the network except no school year is required before their user name

More information

AP Computer Science Summer Work Mrs. Kaelin

AP Computer Science Summer Work Mrs. Kaelin AP Computer Science Summer Work 2018-2019 Mrs. Kaelin jkaelin@pasco.k12.fl.us Welcome future 2018 2019 AP Computer Science Students! I am so excited that you have decided to embark on this journey with

More information

Computer Science E-50a: Introduction to Computer Science Using Java, I Handout #7 part 2

Computer Science E-50a: Introduction to Computer Science Using Java, I Handout #7 part 2 Computer Science E-50a: Introduction to Computer Science Using Java, I Handout #7 part 2 part 2 These problems are due prior to the start of lecture on Monday night, March 31. Part A The Reading You may

More information

CS159. Nathan Sprague

CS159. Nathan Sprague CS159 Nathan Sprague What s wrong with the following code? 1 /* ************************************************** 2 * Return the mean, or -1 if the array has length 0. 3 ***************************************************

More information

Chapter 1 Getting Started

Chapter 1 Getting Started Chapter 1 Getting Started The C# class Just like all object oriented programming languages, C# supports the concept of a class. A class is a little like a data structure in that it aggregates different

More information

ASSIGNMENT 5 Data Structures, Files, Exceptions, and To-Do Lists

ASSIGNMENT 5 Data Structures, Files, Exceptions, and To-Do Lists ASSIGNMENT 5 Data Structures, Files, Exceptions, and To-Do Lists COMP-202B, Winter 2009, All Sections Due: Tuesday, April 14, 2009 (23:55) You MUST do this assignment individually and, unless otherwise

More information

CS 200 Command-Line Arguments & Exceptions Jim Williams, PhD

CS 200 Command-Line Arguments & Exceptions Jim Williams, PhD CS 200 Command-Line Arguments & Exceptions Jim Williams, PhD This Week 1. Battleship: Milestone 3 a. First impressions matter! b. Comment and style 2. Team Lab: ArrayLists 3. BP2, Milestone 1 next Wednesday

More information

Chapter 6 Lab Classes and Objects

Chapter 6 Lab Classes and Objects Gaddis_516907_Java 4/10/07 2:10 PM Page 51 Chapter 6 Lab Classes and Objects Objectives Be able to declare a new class Be able to write a constructor Be able to write instance methods that return a value

More information

Final Exam. Name: Student ID Number: Signature:

Final Exam. Name: Student ID Number: Signature: Washington University Kenneth J. Goldman Final Exam CSE 132. Computer Science II May 7, 2007 Name: Student ID Number: Signature: Directions: This exam is closed book. You may use one 8 ½ x 11 inch page

More information

Java Review: Objects

Java Review: Objects Outline Java review Abstract Data Types (ADTs) Interfaces Class Hierarchy, Abstract Classes, Inheritance Invariants Lists ArrayList LinkedList runtime analysis Iterators Java references 1 Exam Preparation

More information

CSC116: Introduction to Computing - Java

CSC116: Introduction to Computing - Java CSC116: Introduction to Computing - Java Course Information Introductions Website Syllabus Computers First Java Program Text Editor Helpful Commands Java Download Intro to CSC116 Instructors Course Instructor:

More information

The design of an ADT should evolve naturally during the problem-solving process Questions to ask when designing an ADT

The design of an ADT should evolve naturally during the problem-solving process Questions to ask when designing an ADT Designing an ADT The design of an ADT should evolve naturally during the problem-solving process Questions to ask when designing an ADT What data does a problem require? What operations does a problem

More information

UNIT 3 ARRAYS, RECURSION, AND COMPLEXITY CHAPTER 11 CLASSES CONTINUED

UNIT 3 ARRAYS, RECURSION, AND COMPLEXITY CHAPTER 11 CLASSES CONTINUED UNIT 3 ARRAYS, RECURSION, AND COMPLEXITY CHAPTER 11 CLASSES CONTINUED EXERCISE 11.1 1. static public final int DEFAULT_NUM_SCORES = 3; 2. Java allocates a separate set of memory cells in each instance

More information

Chapter 6 Lab Classes and Objects

Chapter 6 Lab Classes and Objects Lab Objectives Chapter 6 Lab Classes and Objects Be able to declare a new class Be able to write a constructor Be able to write instance methods that return a value Be able to write instance methods that

More information

CSC 220 Object Oriented Multimedia Programming, Fall 2018

CSC 220 Object Oriented Multimedia Programming, Fall 2018 CSC 220 Object Oriented Multimedia Programming, Fall 2018 Dr. Dale E. Parson, Assignment 3, text menu on a remote-control Android, mostly array handling. This assignment is due via D2L Assignment Assignment

More information

Java is an objet-oriented programming language providing features that support

Java is an objet-oriented programming language providing features that support Java Essentials CSCI 136: Spring 2018 Handout 2 February 2 Language Basics Java is an objet-oriented programming language providing features that support Data abstraction Code reuse Modular development

More information

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

Tips from the experts: How to waste a lot of time on this assignment Com S 227 Spring 2018 Assignment 1 80 points Due Date: Friday, February 2, 11:59 pm (midnight) Late deadline (25% penalty): Monday, February 5, 11:59 pm General information This assignment is to be done

More information

Object Oriented Design. Object-Oriented Design. Inheritance & Polymorphism. Class Hierarchy. Goals Robustness Adaptability Flexible code reuse

Object Oriented Design. Object-Oriented Design. Inheritance & Polymorphism. Class Hierarchy. Goals Robustness Adaptability Flexible code reuse Object-Oriented Design Object Oriented Design Goals Robustness Adaptability Flexible code reuse Principles Abstraction Encapsulation Modularity March 2005 Object Oriented Design 1 March 2005 Object Oriented

More information

Question: Total Points: Score:

Question: Total Points: Score: CS 170 Exam 1 Section 001 Fall 2014 Name (print): Instructions: Keep your eyes on your own paper and do your best to prevent anyone else from seeing your work. Do NOT communicate with anyone other than

More information

Mathematics/Science Department Kirkwood Community College. Course Syllabus. Computer Science CSC142 1/10

Mathematics/Science Department Kirkwood Community College. Course Syllabus. Computer Science CSC142 1/10 Mathematics/Science Department Kirkwood Community College Course Syllabus Computer Science CSC142 Bob Driggs Dean Cate Sheller Instructor 1/10 Computer Science (CSC142) Course Description Introduces computer

More information

Programming Assignment 2 ( 100 Points )

Programming Assignment 2 ( 100 Points ) Programming Assignment 2 ( 100 Points ) Due: Thursday, October 16 by 11:59pm This assignment has two programs: one a Java application that reads user input from the command line (TwoLargest) and one a

More information

ICOM 4015 Advanced Programming Laboratory. Chapter 1 Introduction to Eclipse, Java and JUnit

ICOM 4015 Advanced Programming Laboratory. Chapter 1 Introduction to Eclipse, Java and JUnit ICOM 4015 Advanced Programming Laboratory Chapter 1 Introduction to Eclipse, Java and JUnit University of Puerto Rico Electrical and Computer Engineering Department by Juan E. Surís 1 Introduction This

More information

CS 170 Section 3, Spring 2015 Programming in Java Midterm Exam 1. Name (print):

CS 170 Section 3, Spring 2015 Programming in Java Midterm Exam 1. Name (print): Name (print): INSTRUCTIONS: o Keep your eyes on your own paper and do your best to prevent anyone else from seeing your work. o Do NOT communicate with anyone other than the professor/proctor for ANY reason

More information

Module Contact: Dr Gavin Cawley, CMP Copyright of the University of East Anglia Version 1

Module Contact: Dr Gavin Cawley, CMP Copyright of the University of East Anglia Version 1 UNIVERSITY OF EAST ANGLIA School of Computing Sciences Main Series UG Examination 2017-18 PROGRAMMING 1 CMP-4008Y Time allowed: 2 hours Answer FOUR questions. All questions carry equal weight. Notes are

More information

CSC 1051 Data Structures and Algorithms I

CSC 1051 Data Structures and Algorithms I Repetition CSC 1051 Data Structures and Algorithms I Dr. Mary-Angela Papalaskari Department of Computing Sciences Villanova University Course website: www.csc.villanova.edu/~map/1051/ Some slides in this

More information

Unix Jeopardy 3, 2/16/2016. CSC 352, UNIX Dr. D. Parson, Session 3 of Unix Jeopardy

Unix Jeopardy 3, 2/16/2016. CSC 352, UNIX Dr. D. Parson, Session 3 of Unix Jeopardy Unix Jeopardy 3, 2/16/2016 CSC 352, UNIX Dr. D. Parson, Session 3 of Unix Jeopardy Ini@al setup In one window: cd ~parson/unix/runcat2 Examples from February 9 outline on course page. mkdir ~/unix cd ~/unix

More information

BCIS 3630 Dr. GUYNES SPRING 2018 TUESDAY SECTION [JAN version] GRADER COURSE WEBSITE

BCIS 3630 Dr. GUYNES SPRING 2018 TUESDAY SECTION [JAN version] GRADER   COURSE WEBSITE COURSE WEBSITE http://www.steveguynes.com/bcis3630/bcis3630/default.html Instructor: Dr. Guynes Office: BLB 312H Phone: (940) 565-3110 Office Hours: By Email Email: steve.guynes@unt.edu TEXTBOOK: Starting

More information

Handout 4 Conditionals. Boolean Expressions.

Handout 4 Conditionals. Boolean Expressions. Handout 4 cs180 - Programming Fundamentals Fall 17 Page 1 of 8 Handout 4 Conditionals. Boolean Expressions. Example Problem. Write a program that will calculate and print bills for the city power company.

More information