COP2800 Homework #3 Assignment Spring 2013

Similar documents
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL

Lab 4. Name: Checked: Objectives:

Project #1 - Fraction Calculator

Preparation: Follow the instructions on the course website to install Java JDK and jgrasp on your laptop.

Programming Project: Building a Web Server

Lab 0: Compiling, Running, and Debugging

The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL

Lab 5 Sorting with Linked Lists

CS1150 Principles of Computer Science Methods

Municode Website Instructions

Access the site directly by navigating to in your web browser.

Lab 1 - Calculator. K&R All of Chapter 1, 7.4, and Appendix B1.2

OASIS SUBMISSIONS FOR FLORIDA: SYSTEM FUNCTIONS

CS1150 Principles of Computer Science Introduction (Part II)

Eastern Mediterranean University School of Computing and Technology Information Technology Lecture2 Functions

Faculty Textbook Adoption Instructions

The Java if statement is used to test the condition. It checks Boolean condition: true or false. There are various types of if statement in java.

Homework: Populate and Extract Data from Your Database

Assignment #5: Rootkit. ECE 650 Fall 2018

Populate and Extract Data from Your Database

Adverse Action Letters

CSCI L Topics in Computing Fall 2018 Web Page Project 50 points

Test Pilot User Guide

Entering an NSERC CCV: Step by Step

Student Handbook for E*Value

Systems & Operating Systems

CS1150 Principles of Computer Science Loops

Using the Swiftpage Connect List Manager

SmartPass User Guide Page 1 of 50

LAB 7 (June 29/July 4) Structures, Stream I/O, Self-referential structures (Linked list) in C

Computational Methods of Scientific Programming Fall 2008

You may receive a total of two GSA graduate student grants in your entire academic career, regardless of what program you are currently enrolled in.

Computer Science Programming Contest

Lab 1 - Calculator. K&R All of Chapter 1, 7.4, and Appendix B1.2 Iterative Code Design handout Style Guidelines handout

ClassFlow Administrator User Guide

Date: October User guide. Integration through ONVIF driver. Partner Self-test. Prepared By: Devices & Integrations Team, Milestone Systems

Ascii Art Capstone project in C

Project 3 Specification FAT32 File System Utility

Reading and writing data in files

TaiRox Mail Merge. Running Mail Merge

Using the Swiftpage Connect List Manager

Proper Document Usage and Document Distribution. TIP! How to Use the Guide. Managing the News Page

Managing Your Access To The Open Banking Directory How To Guide

html o Choose: Java SE Development Kit 8u45

CS1150 Principles of Computer Science Boolean, Selection Statements (Part II)

CS1150 Principles of Computer Science Midterm Review

Cityspan Database Instructions

Project 4: System Calls 1

Quick Tips

Integrating QuickBooks with TimePro

IFSP PDF Upload/Download Guidance

These tasks can now be performed by a special program called FTP clients.

Copy your Course: Export and Import

Create Your Own Report Connector

MATH PRACTICE EXAM 2 (Sections 2.6, , )

Code should compile and demonstrate proper programming style; e.g., whitespace, identifier naming, etc.

Procurement Contract Portal. User Guide

BI Publisher TEMPLATE Tutorial

CREATING A DONOR ACCOUNT

AP Computer Science A

DECISION CONTROL CONSTRUCTS IN JAVA

VMware AirWatch SDK Plugin for Apache Cordova Instructions Add AirWatch Functionality to Enterprise Applicataions with SDK Plugins

TRAINING GUIDE. Lucity Mobile

The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL

Configuring Database & SQL Query Monitoring With Sentry-go Quick & Plus! monitors

Assignment 10: Transaction Simulation & Crash Recovery

Your Project Plan and Smartsheet

The Login Page Designer

UiPath Automation. Walkthrough. Walkthrough Calculate Client Security Hash

Primitive Types and Methods. Reference Types and Methods. Review: Methods and Reference Types

Laboratory #13: Trigger

CS1150 Principles of Computer Science Introduction

Report Writing Guidelines Writing Support Services

UiPath Automation. Walkthrough. Walkthrough Calculate Client Security Hash

McGill University School of Computer Science COMP-206. Software Systems. Due: September 29, 2008 on WEB CT at 23:55.

The Mathematics of the Rubik s Cube

Qualtrics Instructions

Imagine for MSDNAA Student SetUp Instructions

1 Version Spaces. CS 478 Homework 1 SOLUTION

1on1 Sales Manager Tool. User Guide

Computer Information Systems Department. Computer Information Systems: Programming. o Work Experience, General. o Open Entry/Exit

Interfacing to MATLAB. You can download the interface developed in this tutorial. It exists as a collection of 3 MATLAB files.

REFWORKS: STEP-BY-STEP HURST LIBRARY NORTHWEST UNIVERSITY

Structure Query Language (SQL)

1 Getting and Extracting the Upgrader

ROCK-POND REPORTING 2.1

Importing an Excel Worksheet into SAS (commands=import_excel.sas)

1 Binary Trees and Adaptive Data Compression

PAY EQUITY HEARINGS TRIBUNAL. Filing Guide. A Guide to Preparing and Filing Forms and Submissions with the Pay Equity Hearings Tribunal

Author guide to submission and publication

Network Rail ARMS - Asbestos Risk Management System. Training Guide for use of the Import Asset Template

1 Getting and Extracting the Upgrader

Relius Documents ASP Checklist Entry

Using the Turnpike Materials ProjectSolveSP System (Materials & ProjectSolveSP Admin)

Step- by- Step Instructions for Adding a HotPot Activity 1. Click the Turn editing on button on the course home page.

HireRight: Step-by-Step Guide

CS602 Computer Graphics Mid Term Examination February 2005 Time Allowed: 90 Minutes.

Arius 3.0. Release Notes and Installation Instructions. Milliman, Inc Peachtree Road, NE Suite 1900 Atlanta, GA USA

Secure File Transfer Protocol (SFTP) Interface for Data Intake User Guide

Uploading Files with Multiple Loans

Transcription:

YOUR NAME: DATE: LAST FOUR DIGITS OF YOUR UF-ID: Please Print Clearly (Blck Letters) YOUR PARTNER S NAME: DATE: LAST FOUR DIGITS OF PARTNER S UF-ID: Please Print Clearly Date Assigned: 15 February 2013 IN CLASS Date Due: 01 March 2013 E-SUBMISSION f Parts II and III In this hmewrk assignment yu may wrk in grups f tw persns nly. Yu may nt cpy frm thers, and yu may nt cpy cde frm the Internet, textbk, r ther surces. Hwever, yu may study with thers r read yur textbk t determine general slutins. Then yu must cmplete the prblems as yur wn wrk, nt cpying thers wrk. Questins abut this hmewrk shuld be addressed t yur TA first. Yu can find yur TA s email, ffice hurs, etc. at the class website: http://www.cise.ufl.edu/~wchapman/cop2800/fficehurs.html This hmewrk has three parts: (I) Vcabulary Questins, (II) Regular Prgram, (III) Advanced Prgram. There is n penalty fr guessing. Part I. Vcabulary Questins [10 pints ttal] Vcabulary: (terms yu need t knw t discuss the subject intelligently) Define the fllwing terms using 1-3 sentences (and a diagram, if needed): [2 pints each] a. Duble (datatype in Java) b. Shrt (datatype in Java) c. Character array d. Re-cmpilatin e. Lp index Part II. Regular Prgram Use yur text editr (Ntepad++) t generate a file called "Part1.txt". Include this file in the ZIP file alng with the cde fr Parts II and III. Yu must have in the upper right-hand crner: (i) COP2800-S13-HW3-PartI, (ii) yur name, and (iii) last fur digits f yur UFID. [20 pints ttal] TASK: Create a Java Prgram that displays TicTacTe (this assignment is the first half secnd half that actually plays TicTacTe t appear in Assignment 4). Like Assignment #2, this

ne is designed t make yu think, s mst f the cde is nt prvided. Yu have t d mre wrk here but we allw yu t wrk in grups f tw, s that shuld make it easier fr yu. PROGRAMMING PROCEDURE: (1) Use the fllwing pseudcde (this is nt Java cde) as the basis fr making a Java Class called TicTacTe, with methds displayttt and updatettt. Cmments are in green typeface, and reserved keywrds are in bld blue; bld red typeface shws where yu shuld insert yur name and cde. The text that yu will utput t the screen is shwn in brwn typeface. (2) Enter the Java cde that yu make frm the example belw. (3) Save yur cde in file TicTacTe.java (save frequently t avid wrk lss), then cmpile using the Java tls that yu dwnladed t yur laptp cmputer. Make sure it runs. // Pseudcde fr COP2800 Assignment #3: First Half f TicTacTe Prgram // Objective: Build an interface and display fr TicTacTe Game // Designed and Cded by: <yur name> Date: 01 Mar 2013 Declare a public class called TicTacTe Ex: public class TicTacTe { public TicTacTe () { } Make a character array structured as TicTacTeArray[1..N][1..N] Ex: int N = 3; FOR TEST PURPOSES ONLY, WILL CHANGE LATER char[][] TicTacTeArray = new char[n][n]; The array TicTacTeArray shuld be available t all subclasses and their methds in the class TicTacTe The first dimensin f the array (indexed frm 0 t N-1) references the gamebard rw, and shuld be indexed using variable i The secnd dimensin f the array (indexed frm 0 t N-1) references the gamebard clumn, and shuld be indexed using variable j Fr this assignment, all array values will be initialized (set at the beginning f the prgram) t *. Only the values X, O, and * will be allwed in the array. At the start f the game, if N = 3, yur TicTacTeArray shuld lk like this: Clumn 0 1 2 TicTacTe +------ Step = 0 0 * * * Player = Rw 1 * * * 2 * * * Winner = Declare a public methd t display the TicTacTeArray bject as shwn abve, called displayttt, which yu will invke as TicTacTe.displayTTT(). Yu will need t be sure that each game is initialized as shwn abve, then each step (when a player enters a

symbl) is incremented. When the screttt methd (t be develped in Part III) is invked, if there is a winner, then the winner s symbl (X r O) is displayed t the right f Winner =. Because we are studying strings and characters, we will ask yu t cnvert each rw f the display (as shwn abve) t a string, then use System.ut.println() t display the string. Declare a public methd t update the TicTacTeArray bject shwn abve, called update, which yu will invke as TicTacTe.updateTTT(sym, rw, cl) where the argument sym is a char (character-valued) variable that can have values X r O and rw, cl are integer-valued variables that range frm 0 t N-1. In ther wrds, This methd will accept a character as an argument Ex: public static vid update(char sym, int rw, int cl) { cde fr the methd ges here } This methd will update the TicTacTeArray data structure by placing the play symbl sym in the rw and cl(umn) f the array dented as arguments t the methd. Make a test rutine (Test.java) that will test the crrect peratin f the TicTacTe class with methds displayttt and updatettt (this is up t yu t design and cde). After yu have designed, entered, cmpiled, and tested yur cde, then d the fllwing: (4) Make sure yur cde runs crrectly by using multiple test cases. (5) Submit yur cde electrnically with yur slutin t Part III, as described belw. Part III. Advanced Prgram [40 pints ttal] Prgramming with Arrays, Characters, and Strings. Perfrm the fllwing steps: (1) Create the fllwing structure with TicTacTe, and a Test2 class, as described belw. Subclass: UserTicTacTe is a subclass f the class TicTacTe that extends TicTacTe and uses the TicTacTeArray frm Part II. Methd 1: PrmptUser Prmpt the user fr an input character (an integer N frm 1 t 10 t start the prgram; r a symbl, rw number, r clumn number with which t update the array like this: Initial Prmpt: Symbl Prmpt: Rw Prmpt: Clumn Prmpt: Enter TicTacTe Array Size: Enter Symbl (X r O): Enter Rw t Place Symbl: Enter Cl t Place Symbl: Methd 2: CheckSymbl The initial prmpt and rw/clumn prmpts will read an int and check bunds t be sure the number is in range. If ut-f-range, then an errr message will be displayed and the user will be

prmpted again. If there are five cnsecutive errrs, the prgram will terminate. The symbl prmpt will read a char and will check t see if it is an X, O, r Q (quit the prgram). If an X r O is encuntered, then the methd will check t see which symbl was played previusly. If an X was played previusly, and the answer t the current symbl prmpt is nt an O r Q (quit the prgram), then an errr message (ILLEGAL SYMBOL) will be displayed and the user will be prmpted again. After five cnsecutive errrs, the prgram will terminate. A symmetric check will be perfrmed when an O was the previus symbl. Methd 3: ScreTTT by checking (every time the TicTacTeArray is updated) fr any rws, clumns, r majr/minr diagnals that have N X s r N O s. If these are fund then the array is displayed with X r O as the winner, as apprpriate. Ties will be detected in Assignment #4, when we add sme intelligence t the prgram. Class: Test2 (i) will run the PrmptUser methd t first set up the array size (by prmpting fr N), then (ii) will run the game by prmpting fr sym, rw, and cl variables and (iii) checking fr errrs, (iv) updating the TicTacTeArray, and scring using ScreTTT. (2) Be careful abut the way yur methds are invked [Hint: Remember hw we invked class.methd in Assignment #1.] (3) Dcument yur cde fully (as in the example in Part II). Cmpile yur cde and get it running, then test it thrughly t be sure it wrks befre yu submit yur cde. Part IV. Extra Credit (text file like Part I, submit nline) [10 pints each] EC-1. What cnditins will the cde in Parts II and III nt detect? Describe exactly why this happens, and hw the cde culd be fixed (if needed) s it des detect these cnditins. EC-2. What can yu say (supprted by analysis) abut the size N f the TicTacTe array? (Hint: Hw much lnger will it take t play the game as N increases by a factr f tw?) Please d this part electrnically. Use yur text editr (Ntepad++) t generate a file called "Part4.txt". Include this file in the ZIP file alng with the cde fr Parts II and III. Yu must have in the upper right-hand crner: (i) COP2800-S13-HW3-PartIV, (ii) yur name, and (iii) last fur digits f yur UFID.

Electrnic Submissin f Parts II and III. Put all files yu created in Parts I thrugh III in a single ZIP file. Yur ZIP file shuld cntain all the files specified in Parts I thrugh III. Submit this ZIP file electrnically per the instructins at: http://www.cise.ufl.edu/~wchapman/cop2800/submit Part V. Evaluatin f Submitted Cde Grading: Cde des nt cmpile r run = 0 pints. Cde cmpiles but des nt run = < 20 percent f pints. Cde runs but wrng results = 21 t 50 percent f pints. Cde runs with crrect results but n dcumentatin (e.g., green cmments in Part II) = 51 t 70 percent f pints. Cde cmpiles and runs, crrect results, dcumentatin present = 71 t 100 percent f pints.