Due Date: Two Program Demonstrations (Testing and Debugging): End of Lab

Size: px
Start display at page:

Download "Due Date: Two Program Demonstrations (Testing and Debugging): End of Lab"

Transcription

1 CSC 111 Fall 2005 Lab 6: Methods and Debugging Due Date: Two Program Demonstrations (Testing and Debugging): End of Lab Documented GameMethods file and Corrected HighLow game: Uploaded by midnight of lab day Documented Programs Improving Upon Craps Game: Uploaded as part of next homework. Introduction The purpose of this lab is three-fold: to gain debugging experience with the BlueJ debugger, to gain further experience in using methods in Java, and to reinforce using Java selection instructions (if-else) and repetition instructions (while, do-while, for loop). The lab will ask you to improve upon the program you developed last week for playing the game of Craps. This lab will require that style guidelines for programming be followed. The style guidelines for this class can be found on the class webpage in the left hand menu. Make sure your programs adhere to these guidelines before submission. There is also a gradesheet available for this lab if you would like to see how this lab will be graded and what points are given or deducted for. This gradesheet is available on the lab webpage. The first thing you should do for this lab is to create a directory called lab6 under your c:\userdata\csc111 directory. Once this is done, start BlueJ. If a project is already open, close it by using the Project menu, Close, and then make a new project for this lab by using Project menu, New Project. This project should be saved as a new project under the directory c:\userdata\csc111\lab6 and should be called Lab6Project. Close the Lab6Project and download the following files from the class website into your c:\userdata\csc111\lab6\lab6project directory: TestGameMethods.java HighLow.java Finally, reopen BlueJ and reopen the project called Lab6Project. The files you just downloaded should appear in your project.

2 Creating a Set of Useful Game Methods This week, the first thing that we need to do is to develop a class that contains several useful game methods. These methods will support betting in games and asking a player whether or not they want to continue playing a game. Since these operations happen in a lot of games, it will be useful to put these methods in their own class. Since both methods we will develop (getting a bet and asking to play again) require interacting with the user, you have the option of doing input and output using either System.out.println / Scanner (for textual interaction) or JOptionPane (for GUI interaction). --- Step 1 (Writing Methods) --- This part of the lab asks that you write several methods for enhancing game play. Your goal should be to correctly implement a specifications list that I give you. In Step 2, techniques for testing and verifying that your methods work are demonstrated. Create a new class in BlueJ called GameMethods. This class will hold the two new methods that are useful for allowing bets to be placed and for asking whether a player want to play another game or quit. In this GameMethods class, you should create two methods: Method 1: getbet - The first method should be called getbet. It should take two customization parameters, the first being a String representing a message to present to the user asking for their bet, and the second being an int representing the limit that the user can bet up to. The getbet method should return an integer that is the value the user wants to bet. This method will prompt the user with the passed in String and return the integer amount that corresponds to the bet that was typed in. You can assume that a user enters an integer. However, you should check to make sure that their bet is valid less than or equal to the limit passed in and greater than or equal to zero. If the bet is invalid, reprompt and re-read what they type until a valid bet is entered. Here s an example of a bet message box. The String passed in as the message to show was You have $100.\nEnter your bet:. The bet limit value that was passed in was 100.

3 Method 2: playagain The second method you write should be called playagain. It should take a single parameter, a String representing a message to present to the user asking if they want to play the game again. The method should return a boolean indicating whether or not the player wants to play again. Return true if they do want to play and false otherwise. To implement the playagain method, you should use one of the following approaches. If you are writing a text-based program (using System.out.println / Scanner), then you should present to the user the message passed in as a parameter, followed by the message Do you want to play again (yes/no)?. Message passed in as parameter to playagain goes here. Do you want to play again (yes/no)? You should then read in what the user types from the keyboard. Assume they will type in either yes or no (in lowercase) and have an if/else statement that compares what they typed in against yes and no and returns true or false from the method appropriately. If you are writing a GUI-based program, you can use a JOptionPane dialog called a confirmation dialog. This dialog box displays a message and two buttons, one yes and one no, and the button that is pressed is returned back to the program as an integer. If the Yes button is clicked, a zero (0) is returned. If the No button is clicked, a one (1) value is returned. Your play again method should show the dialog box and convert the integer 0 or 1 value into the appropriate true or false boolean value to return. Here s a small code segment that displays a confirmation dialog box and stores the result in a variable. int choice = JOptionPane.showConfirmDialog(null, stringwithmessagegoeshere, Play again?, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (choice == 0) // they hit Yes { } else // they hit No { } An example of a confirm dialog in my program is shown on the next page:

4 --- Step 2 (Testing) --- Once you have finished the two methods in GameMethods, you can use the program. TestGameMethods to test whether or not your methods work as you think they should Compile TestGameMethods and execute it by running its main method. It should make calls to both getbet and playagain so that you can see if your methods work as you would expect. Once you feel that your methods are working correctly, demonstrate to one of the instructors an execution of the TestGameMethods program. --- Step 3 (Debugging) --- Now that you have a working set of methods in GameMethods, I would like you to help me debug a game program that I wrote. I have tried to write a Java program that plays a variant of the game High-Low. In this game, a card is randomly drawn from a deck of cards and the user is asked to make a bet. The size of the bet should correspond to how sure the player feels that the next card drawn from the pack will be higher than the first card drawn. As an example, if a 2 is the first card drawn, it would be good to make a really high bet as it is very likely that the next card will be higher than 2. On the other hand, if a King was drawn, then a zero bet is probably the best thing to play as there is only a small chance of the next card being higher. After the bet is made, the following rules are followed in the game: If the next card is higher, the player wins his bet. If the next card is lower, the player loses his bet. If it is a tie (the same card is drawn), the player wins half of his bet. Unfortunately, my game has an error in it. It looks to me that it s not updating the players bank correctly during game play. My game is located in the class called HighLow. Note that my game program makes use of your GameMethods class. If you haven t already made sure your methods work correctly, then go back to Step 2 and do that. Use the Java debugger as demonstrated in class (inserting break points and stepping through instructions) to determine where the error is in my program. The error is not in the convertcardtoname method. You may need to test several execution paths to find the error. Once you have found the error, correct the program so that HighLow works

5 correctly and demonstrate the corrected program and your use of the debugger to one of the instructors. --- Step 4 (Updating Code) --- This part of the lab is not due by the end of the lab, but rather should be uploaded as part of the next homework. However, it is probably to your advantage to start on this part during the lab. In the final part of the lab, you should improve upon your Craps game from last week by adding in betting and repeated game play. To start off on this part of the lab, you should create a new class called ImprovedCrapsGame in your lab6 project, delete all of the code from ImprovedCrapsGame, and then copy all of the code from your lab 5 CrapsGame file into ImprovedCrapsGame. Your new program should play Craps exactly like the Craps program from last week, but now with the ability to bet before a game and to play the game repeatedly. You should assume that the user starts with $ as his bank (his balance to bet with). The player may wager up to the total amount in his bank before starting a game. If the user wins the game, the amount he bet should be added to the user s bank, otherwise, the amount should be subtracted from the user s bank. After every game, the user should be asked whether or not they want to continue playing the game. The game ends when the user decides to quit or when the user runs out of money (the bank hits 0). A step-by-step description of the required updates is below: The program should start by displaying a welcome message, just as in lab 5. Once the player (clicks OK/hits return) on the welcome message, the user should be prompted to enter a bet as shown in the figure below. Since you ve already written a getbet method, you should just be able to make a call to that method as appropriate. Make sure you send in a message that resembles the one shown in the example below and that you send in the correct limit to the getbet method (the user s current bank value). Once a valid bet is entered, the game should play exactly like it did last week. When the game has been won or lost, you need to do two things:

6 1. Update the user s bank variable appropriately by placing instructions that change the bank value in any situation where the user wins or loses. 2. Provide the ability to play again. If after updating the player s bank there is no money left, the game should quit. Otherwise, if there is money left, you should ask the user if he or she would like to play again. To provide the ability to play again, you should make use of your playagain method. An example window with a play again message is shown below. If the user wants to play again, then the program should loop back and start a new game. Otherwise the program should exit. Remember that there are several things that need to be done to start a new game (think about: in what state are many of the variables in the game and do they need to change to restart and function correctly?). A new bet should be asked for at the beginning of every new game as well. Turn-In Checklist Exactly what do I turn-in to receive credit for this lab? These requirements should be met by the end of the lab: Ensure that you have demonstrated to the instructor or lab TA that your methods work correctly by using the TestGameMethods program. Ensure that you have demonstrated to the instructor or lab TA that you have successfully debugged the HighLow program. Make sure your GameMethods methods are documented correctly and follow the Java programming style guidelines. Upload your GameMethods file and the corrected HighLow game through Blackboard. Select your lab section once you login to Blackboard, and then choose the Assignments menu. There should be an option to upload Lab6 at that point. Continued On Next Page

7 These requirements should be met by the next homework due date: Make sure you have implemented the correct code to include allowing bets and a play again prompt in Craps. Make sure everything required in the gradesheet works as expected. Ensure there are comments at the top of your program indicating the name of the program, a brief description of the program, your name, and today s date. Make sure your programs follow the style guidelines as specified on the class webpage. Upload your improved Craps program through Blackboard as part of your next homework.

Lab 1: Silver Dollar Game 1 CSCI 2101B Fall 2018

Lab 1: Silver Dollar Game 1 CSCI 2101B Fall 2018 Lab 1: Silver Dollar Game 1 CSCI 2101B Fall 2018 Due: Tuesday, September 18, 11:59 pm Collaboration Policy: Level 1 (review full policy for details) Group Policy: Individual This lab will give you experience

More information

CMSC 150 INTRODUCTION TO COMPUTING LAB WEEK 3 STANDARD IO FORMATTING OUTPUT SCANNER REDIRECTING

CMSC 150 INTRODUCTION TO COMPUTING LAB WEEK 3 STANDARD IO FORMATTING OUTPUT SCANNER REDIRECTING CMSC 150 INTRODUCTION TO COMPUTING LAB WEEK 3 STANDARD IO FORMATTING OUTPUT SCANNER REDIRECTING INPUT AND OUTPUT Input devices Keyboard Mouse Hard drive Network Digital camera Microphone Output devices.

More information

Review Chapter 6 in Bravaco. Short Answers 1. This type of method does not return a value. a. null b. void c. empty d. anonymous

Review Chapter 6 in Bravaco. Short Answers 1. This type of method does not return a value. a. null b. void c. empty d. anonymous Assignment 3 Methods Review CSC 123 Fall 2018 Notes: All homework must be submitted via e-mail. All parts of assignment must be submitted in a single e-mail with multiple attachments when required. Notes:

More information

Lab 1 Implementing a Simon Says Game

Lab 1 Implementing a Simon Says Game ECE2049 Embedded Computing in Engineering Design Lab 1 Implementing a Simon Says Game In the late 1970s and early 1980s, one of the first and most popular electronic games was Simon by Milton Bradley.

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 Fall 2018 Miniassignment 1 40 points Due Date: Friday, October 12, 11:59 pm (midnight) Late deadline (25% penalty): Monday, October 15, 11:59 pm General information This assignment is to be done

More information

Classwork 7: Craps. N. Duong & R. Rodriguez, Java Crash Course January 6, 2015

Classwork 7: Craps. N. Duong & R. Rodriguez, Java Crash Course January 6, 2015 Classwork 7: Craps N. Duong & R. Rodriguez, Java Crash Course January 6, 2015 For this classwork, you will be writing code for the game Craps. For those of you who do not know, Craps is a dice-rolling

More information

CIS 162 Project 4 Farkle (a dice game)

CIS 162 Project 4 Farkle (a dice game) CIS 162 Project 4 Farkle (a dice game) Due Date at the start of class on Monday, 3 December (be prepared for quick demo and zybook test) Before Starting the Project Read chapter 10 (ArrayList) and 13 (arrays)

More information

CS 1110, LAB 1: PYTHON EXPRESSIONS.

CS 1110, LAB 1: PYTHON EXPRESSIONS. CS 1110, LAB 1: PYTHON EXPRESSIONS Name: Net-ID: There is an online version of these instructions at http://www.cs.cornell.edu/courses/cs1110/2012fa/labs/lab1 You may wish to use that version of the instructions.

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

Conditional Programming

Conditional Programming COMP-202 Conditional Programming Chapter Outline Control Flow of a Program The if statement The if - else statement Logical Operators The switch statement The conditional operator 2 Introduction So far,

More information

CS 170 Java Programming 1. Week 10: Loops and Arrays

CS 170 Java Programming 1. Week 10: Loops and Arrays CS 170 Java Programming 1 Week 10: Loops and Arrays What s the Plan? Topic 1: A Little Review Use a counted loop to create graphical objects Write programs that use events and animation Topic 2: Advanced

More information

CSCI 1301: Introduction to Computing and Programming Spring 2018 Project 3: Hangman 2.0 (A Word Guessing Game)

CSCI 1301: Introduction to Computing and Programming Spring 2018 Project 3: Hangman 2.0 (A Word Guessing Game) Introduction In this project, you are going to implement the word guessing game, Hangman 2.0. Your program is going to get a random word from an enumerated list (instructions below) and then let the user

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

Programming assignment A

Programming assignment A Programming assignment A ASCII Minesweeper Official release on Feb 14 th at 1pm (Document may change before then without notice) Due 5pm Feb 25 th Minesweeper is computer game that was first written in

More information

COMP 202 Java in one week

COMP 202 Java in one week COMP 202 Java in one week... Continued CONTENTS: Return to material from previous lecture At-home programming exercises Please Do Ask Questions It's perfectly normal not to understand everything Most of

More information

The NetBeans IDE is a big file --- a minimum of around 30 MB. After you have downloaded the file, simply execute the file to install the software.

The NetBeans IDE is a big file --- a minimum of around 30 MB. After you have downloaded the file, simply execute the file to install the software. Introduction to Netbeans This document is a brief introduction to writing and compiling a program using the NetBeans Integrated Development Environment (IDE). An IDE is a program that automates and makes

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

CpSc 1011 Lab 5 Conditional Statements, Loops, ASCII code, and Redirecting Input Characters and Hurricanes

CpSc 1011 Lab 5 Conditional Statements, Loops, ASCII code, and Redirecting Input Characters and Hurricanes CpSc 1011 Lab 5 Conditional Statements, Loops, ASCII code, and Redirecting Input Characters and Hurricanes Overview For this lab, you will use: one or more of the conditional statements explained below

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

Lab 1 Implementing a Simon Says Game

Lab 1 Implementing a Simon Says Game ECE2049 Embedded Computing in Engineering Design Lab 1 Implementing a Simon Says Game In the late 1970s and early 1980s, one of the first and most popular electronic games was Simon by Milton Bradley.

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 Fall 2017 Miniassignment 1 50 points Due Date: Monday, October 16, 11:59 pm (midnight) Late deadline (25% penalty): Tuesday, October 17, 11:59 pm General information This assignment is to be

More information

Static Methods. Why use methods?

Static Methods. Why use methods? Static Methods A method is just a collection of code. They are also called functions or procedures. It provides a way to break a larger program up into smaller, reusable chunks. This also has the benefit

More information

Lecture 9. Assignment. Logical Operations. Logical Operations - Motivation 2/8/18

Lecture 9. Assignment. Logical Operations. Logical Operations - Motivation 2/8/18 Assignment Lecture 9 Logical Operations Formatted Print Printf Increment and decrement Read through 3.9, 3.10 Read 4.1. 4.2, 4.3 Go through checkpoint exercise 4.1 Logical Operations - Motivation Logical

More information

CS 142 Style Guide Grading and Details

CS 142 Style Guide Grading and Details CS 142 Style Guide Grading and Details In the English language, there are many different ways to convey a message or idea: some ways are acceptable, whereas others are not. Similarly, there are acceptable

More information

Lab 1 Introduction to UNIX and C

Lab 1 Introduction to UNIX and C Name: Lab 1 Introduction to UNIX and C This first lab is meant to be an introduction to computer environments we will be using this term. You must have a Pitt username to complete this lab. The doc is

More information

CSCI 136 Data Structures & Advanced Programming. Fall 2018 Instructors Bill Lenhart & Bill Jannen

CSCI 136 Data Structures & Advanced Programming. Fall 2018 Instructors Bill Lenhart & Bill Jannen CSCI 136 Data Structures & Advanced Programming Fall 2018 Instructors Bill Lenhart & Bill Jannen Administrative Details Lab 1 handout is online Prelab (should be completed before lab): Lab 1 design doc

More information

Slide 1 CS 170 Java Programming 1 Testing Karel

Slide 1 CS 170 Java Programming 1 Testing Karel CS 170 Java Programming 1 Testing Karel Introducing Unit Tests to Karel's World Slide 1 CS 170 Java Programming 1 Testing Karel Hi Everybody. This is the CS 170, Java Programming 1 lecture, Testing Karel.

More information

IT115: Introduction to Java Programming 1. IT115: Introduction to Java Programming. Tic Tac Toe Application. Trina VanderLouw

IT115: Introduction to Java Programming 1. IT115: Introduction to Java Programming. Tic Tac Toe Application. Trina VanderLouw IT115: Introduction to Java Programming 1 IT115: Introduction to Java Programming Tic Tac Toe Application Trina VanderLouw Professor Derek Peterson Colorado Technical University Online October 28, 2011

More information

CSC 101: Lab #8 Digital Video Lab due date: 5:00pm, day after lab session

CSC 101: Lab #8 Digital Video Lab due date: 5:00pm, day after lab session Name: Lab Date and Time: Email Username: Partner s Name: CSC 101: Lab #8 Digital Video Lab due date: 5:00pm, day after lab session Pledged Assignment: This lab document should be considered a pledged graded

More information

EECE.2160: ECE Application Programming Spring 2018 Programming Assignment #6: Using Arrays to Count Letters in Text Due Wednesday, 4/4/18, 11:59:59 PM

EECE.2160: ECE Application Programming Spring 2018 Programming Assignment #6: Using Arrays to Count Letters in Text Due Wednesday, 4/4/18, 11:59:59 PM Spring 2018 Programming Assignment #6: Using Arrays to Count Letters in Text Due Wednesday, 4/4/18, 11:59:59 PM 1. Introduction In this program, you will practice working with arrays. Your program will

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

EAS230: Programming for Engineers Lab 1 Fall 2004

EAS230: Programming for Engineers Lab 1 Fall 2004 Lab1: Introduction Visual C++ Objective The objective of this lab is to teach students: To work with the Microsoft Visual C++ 6.0 environment (referred to as VC++). C++ program structure and basic input

More information

CpSc 1111 Lab 6 Conditional Statements, Loops, the Math Library, and Random Numbers What s the Point?

CpSc 1111 Lab 6 Conditional Statements, Loops, the Math Library, and Random Numbers What s the Point? CpSc 1111 Lab 6 Conditional Statements, Loops, the Math Library, and Random Numbers What s the Point? Overview For this lab, you will use: one or more of the conditional statements explained below scanf()

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 2017 Assignment 1 80 points Due Date: Thursday, February 2, 11:59 pm (midnight) Late deadline (25% penalty): Friday, February 3, 11:59 pm General information This assignment is to be done

More information

CS 211 Programming Practicum Fall 2018

CS 211 Programming Practicum Fall 2018 Due: Wednesday, 11/7/18 at 11:59 pm Infix Expression Evaluator Programming Project 5 For this lab, write a C++ program that will evaluate an infix expression. The algorithm REQUIRED for this program will

More information

(First is used here)

(First is used here) Solo Complete all four programs by yourself Print programs 1, 2, 3, and 4, staple them together (or lose points) and turn in to your section leader or Rick if Cody is your SL from 9:55-10:01 am Wednesday,

More information

CMPSCI 187 / Spring 2015 Hangman

CMPSCI 187 / Spring 2015 Hangman CMPSCI 187 / Spring 2015 Hangman Due on February 12, 2015, 8:30 a.m. Marc Liberatore and John Ridgway Morrill I N375 Section 01 @ 10:00 Section 02 @ 08:30 1 CMPSCI 187 / Spring 2015 Hangman Contents Overview

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

Discussion 1H Notes (Week 3, April 14) TA: Brian Choi Section Webpage:

Discussion 1H Notes (Week 3, April 14) TA: Brian Choi Section Webpage: Discussion 1H Notes (Week 3, April 14) TA: Brian Choi (schoi@cs.ucla.edu) Section Webpage: http://www.cs.ucla.edu/~schoi/cs31 More on Arithmetic Expressions The following two are equivalent:! x = x + 5;

More information

Lab 4: Super Sudoku Solver CSCI 2101 Fall 2017

Lab 4: Super Sudoku Solver CSCI 2101 Fall 2017 Due: Wednesday, October 18, 11:59 pm Collaboration Policy: Level 1 Group Policy: Pair-Optional Lab 4: Super Sudoku Solver CSCI 2101 Fall 2017 In this week s lab, you will write a program that can solve

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

CSCI 1301: Introduction to Computing and Programming Spring 2019 Lab 10 Classes and Methods

CSCI 1301: Introduction to Computing and Programming Spring 2019 Lab 10 Classes and Methods Note: No Brainstorm this week. This lab gives fairly detailed instructions on how to complete the assignment. The purpose is to get more practice with OOP. Introduction This lab introduces you to additional

More information

Guessing Game with Objects

Guessing Game with Objects Objectives Lab1: Guessing Game with Objects Guessing Game with Objects 1. Practice designing and implementing an object-oriented program. 2. Use Console I/O in Java. Tasks 1. Design the program (problem

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

CS3901 Intermediate Programming and Data Structures Winter 2008 (Q2 AY 08) Assignment #5. Due: noon Tuesday, 3 March 2008

CS3901 Intermediate Programming and Data Structures Winter 2008 (Q2 AY 08) Assignment #5. Due: noon Tuesday, 3 March 2008 CS3901 Intermediate Programming and Data Structures Winter 2008 (Q2 AY 08) Assignment #5 Due: noon Tuesday, 3 March 2008 Objective Practice with Java Create a CircularLinkedList implementation of List

More information

ACORN.COM CS 1110 SPRING 2012: ASSIGNMENT A1

ACORN.COM CS 1110 SPRING 2012: ASSIGNMENT A1 ACORN.COM CS 1110 SPRING 2012: ASSIGNMENT A1 Due to CMS by Tuesday, February 14. Social networking has caused a return of the dot-com madness. You want in on the easy money, so you have decided to make

More information

Control Statements: Part 1

Control Statements: Part 1 4 Let s all move one place on. Lewis Carroll Control Statements: Part 1 The wheel is come full circle. William Shakespeare How many apples fell on Newton s head before he took the hint! Robert Frost All

More information

ASSIGNMENT 1 First Java Assignment

ASSIGNMENT 1 First Java Assignment ASSIGNMENT 1 First Java Assignment COMP-202B, Winter 2012, All Sections Due: Sunday January 29th, 2012 (23:30) Please read the entire pdf before starting. You must do this assignment individually and,

More information

CS 210 Fundamentals of Programming I Spring 2015 Programming Assignment 4

CS 210 Fundamentals of Programming I Spring 2015 Programming Assignment 4 CS 210 Fundamentals of Programming I Spring 2015 Programming Assignment 4 20 points Out: February 18/19, 2015 Due: February 25/26, 2015 Reminder: This is a programming assignment, and work on this assignment

More information

CSC 101 Spring 2010 Lab #8 Report Gradesheet

CSC 101 Spring 2010 Lab #8 Report Gradesheet CSC 101 Spring 2010 Lab #8 Report Gradesheet Name WFU Username Lab Section: A B C D Partner s Name (if you had one): Topic Points Notes Pre-lab questions 20 total - 5 at 4 points each Lab report questions

More information

CS 211 Programming Practicum Spring 2017

CS 211 Programming Practicum Spring 2017 Due: Tuesday, 3/28/17 at 11:59 pm Infix Expression Evaluator Programming Project 5 For this lab, write a JAVA program that will evaluate an infix expression. The algorithm REQUIRED for this program will

More information

Programming Language. Control Structures: Repetition (while) Eng. Anis Nazer Second Semester

Programming Language. Control Structures: Repetition (while) Eng. Anis Nazer Second Semester Programming Language Control Structures: Repetition (while) Eng. Anis Nazer Second Semester 2017-2018 Repetition statements Control statements change the order which statements are executed Selection :

More information

Com S 227 Spring 2018 Assignment points Due Date: Thursday, September 27, 11:59 pm (midnight) "Late" deadline: Friday, September 28, 11:59 pm

Com S 227 Spring 2018 Assignment points Due Date: Thursday, September 27, 11:59 pm (midnight) Late deadline: Friday, September 28, 11:59 pm Com S 227 Spring 2018 Assignment 2 200 points Due Date: Thursday, September 27, 11:59 pm (midnight) "Late" deadline: Friday, September 28, 11:59 pm (Remember that Exam 1 is MONDAY, October 1.) General

More information

CSE 142, Autumn 2010 Midterm Exam, Friday, November 5, 2010

CSE 142, Autumn 2010 Midterm Exam, Friday, November 5, 2010 CSE 142, Autumn 2010 Midterm Exam, Friday, November 5, 2010 Name: Section: TA: Student ID #: You have 50 minutes to complete this exam. You may receive a deduction if you keep working after the instructor

More information

Java Coding 3. Over & over again!

Java Coding 3. Over & over again! Java Coding 3 Over & over again! Repetition Java repetition statements while (condition) statement; do statement; while (condition); where for ( init; condition; update) statement; statement is any Java

More information

Web API Lab. The next two deliverables you shall write yourself.

Web API Lab. The next two deliverables you shall write yourself. Web API Lab In this lab, you shall produce four deliverables in folder 07_webAPIs. The first two deliverables should be pretty much done for you in the sample code. 1. A server side Web API (named listusersapi.jsp)

More information

Course Outline. Introduction to java

Course Outline. Introduction to java Course Outline 1. Introduction to OO programming 2. Language Basics Syntax and Semantics 3. Algorithms, stepwise refinements. 4. Quiz/Assignment ( 5. Repetitions (for loops) 6. Writing simple classes 7.

More information

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

King Abdulaziz University Faculty of Computing and Information Technology Computer Science Department King Abdulaziz University Faculty of Computing and Information Technology Computer Science Department CPCS202, 1 st Term 2016 (Fall 2015) Program 5: FCIT Grade Management System Assigned: Thursday, December

More information

In this lab, you will learn more about selection statements. You will get familiar to

In this lab, you will learn more about selection statements. You will get familiar to Objective: In this lab, you will learn more about selection statements. You will get familiar to nested if and switch statements. Nested if Statements: When you use if or if...else statement, you can write

More information

CSCD 255 HW 2. No string (char arrays) or any other kinds of array variables are allowed

CSCD 255 HW 2. No string (char arrays) or any other kinds of array variables are allowed CSCD 255 HW 2 Design a program called cscd255hw2.c which reads in a strictly positive integer (1 or greater) from the user. The user will then be prompted with a menu of choices (this menu should be repetitively

More information

Name: Checked: Preparation: Response time experiment accessing the system clock

Name: Checked: Preparation: Response time experiment accessing the system clock Lab 9 Name: Checked: Objectives: Practice using the conditional operator; switch statements; do and for loops. Explore the use of dialog boxes (JOptionPane) and learn how to implement a simple experimental

More information

The for Loop. Lesson 11

The for Loop. Lesson 11 The for Loop Lesson 11 Have you ever played Tetris? You know that the game never truly ends. Blocks continue to fall one at a time, increasing in speed as you go up in levels, until the game breaks from

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

Introduction to Computer Science Unit 3. Programs

Introduction to Computer Science Unit 3. Programs Introduction to Computer Science Unit 3. Programs This section must be updated to work with repl.it Programs 1 to 4 require you to use the mod, %, operator. 1. Let the user enter an integer. Your program

More information

Introduction to Computers and Engineering Problem Solving 1.00 / Fall 2004

Introduction to Computers and Engineering Problem Solving 1.00 / Fall 2004 Introduction to Computers and Engineering Problem Solving 1.00 / 1.001 Fall 2004 Problem Set 1 Due: 11AM, Friday September 17, 2004 Loan Calculator / Movie & Game Rental Store (0) [100 points] Introduction

More information

Program #7: Let s Play Craps!

Program #7: Let s Play Craps! Program #7: Let s Play Craps! Due Date: July 18, 2000 1 The Problem Craps is a game played with a pair of dice. In the game of craps, the shooter (the player with the dice) rolls a pair of dice and the

More information

Repetition Structures

Repetition Structures Repetition Structures Chapter 5 Fall 2016, CSUS Introduction to Repetition Structures Chapter 5.1 1 Introduction to Repetition Structures A repetition structure causes a statement or set of statements

More information

Hello World! Computer Programming for Kids and Other Beginners. Chapter 1. by Warren Sande and Carter Sande. Copyright 2009 Manning Publications

Hello World! Computer Programming for Kids and Other Beginners. Chapter 1. by Warren Sande and Carter Sande. Copyright 2009 Manning Publications Hello World! Computer Programming for Kids and Other Beginners by Warren Sande and Carter Sande Chapter 1 Copyright 2009 Manning Publications brief contents Preface xiii Acknowledgments xix About this

More information

EECS2031 Winter Software Tools. Assignment 1 (15%): Shell Programming

EECS2031 Winter Software Tools. Assignment 1 (15%): Shell Programming EECS2031 Winter 2018 Software Tools Assignment 1 (15%): Shell Programming Due Date: 11:59 pm on Friday, Feb 9, 2018 Objective In this assignment, you will be writing four shell programs. The first program

More information

1.00/1.001 Tutorial 1

1.00/1.001 Tutorial 1 1.00/1.001 Tutorial 1 Introduction to 1.00 September 12 & 13, 2005 Outline Introductions Administrative Stuff Java Basics Eclipse practice PS1 practice Introductions Me Course TA You Name, nickname, major,

More information

CSCE 145 Exam 1 Review. This exam totals to 100 points. Follow the instructions. Good luck!

CSCE 145 Exam 1 Review. This exam totals to 100 points. Follow the instructions. Good luck! CSCE 145 Exam 1 Review This exam totals to 100 points. Follow the instructions. Good luck! Chapter 1 This chapter was mostly terms so expect a fill in the blank style questions on definition. Remember

More information

Programming Problems 15th Annual Computer Science Programming Contest

Programming Problems 15th Annual Computer Science Programming Contest Programming Problems 15th Annual Computer Science Programming Contest Department of Mathematics and Computer Science Western Carolina University March 0, 200 Criteria for Determining Scores Each program

More information

Part 1. Summary of For Loops and While Loops

Part 1. Summary of For Loops and While Loops NAME EET 2259 Lab 5 Loops OBJECTIVES -Understand when to use a For Loop and when to use a While Loop. -Write LabVIEW programs using each kind of loop. -Write LabVIEW programs with one loop inside another.

More information

CMPSC 111 Introduction to Computer Science I Fall 2016 Lab 8 Assigned: October 26, 2016 Due: November 2, 2016 by 2:30pm

CMPSC 111 Introduction to Computer Science I Fall 2016 Lab 8 Assigned: October 26, 2016 Due: November 2, 2016 by 2:30pm 1 CMPSC 111 Introduction to Computer Science I Fall 2016 Lab 8 Assigned: October 26, 2016 Due: November 2, 2016 by 2:30pm Objectives To enhance your experience with designing and implementing your own

More information

Assignment Checklist. Prelab Activities. Lab Exercises. Labs Provided by Instructor. Postlab Activities. Section:

Assignment Checklist. Prelab Activities. Lab Exercises. Labs Provided by Instructor. Postlab Activities. Section: 7 Arrays Now go, write it before them in a table, and note it in a book. Isaiah 30:8 To go beyond is as wrong as to fall short. Confucius Begin at the beginning, and go on till you come to the end: then

More information

The name of our class will be Yo. Type that in where it says Class Name. Don t hit the OK button yet.

The name of our class will be Yo. Type that in where it says Class Name. Don t hit the OK button yet. Mr G s Java Jive #2: Yo! Our First Program With this handout you ll write your first program, which we ll call Yo. Programs, Classes, and Objects, Oh My! People regularly refer to Java as a language that

More information

CS 211 Programming Practicum Spring 2018

CS 211 Programming Practicum Spring 2018 Due: Thursday, 4/5/18 at 11:59 pm Infix Expression Evaluator Programming Project 5 For this lab, write a C++ program that will evaluate an infix expression. The algorithm REQUIRED for this program will

More information

CpSc 1111 Lab 9 2-D Arrays

CpSc 1111 Lab 9 2-D Arrays CpSc 1111 Lab 9 2-D Arrays Overview This week, you will gain some experience with 2-dimensional arrays, using loops to do the following: initialize a 2-D array with data from an input file print out the

More information

Introduction to Computer Programming

Introduction to Computer Programming Introduction to Computer Programming Lecture #7 - Conditional Loops The Problem with Counting Loops Many jobs involving the computer require repetition, and that this can be implemented using loops. Counting

More information

Chapter 6. Repetition Statements. Animated Version The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Chapter 6. Repetition Statements. Animated Version The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 6 Repetition Statements Animated Version required for reproduction or display. Chapter 6-1 Objectives After you have read and studied this chapter, you should be able to Implement repetition control

More information

Check out how to use the random number generator (introduced in section 4.11 of the text) to get a number between 1 and 6 to create the simulation.

Check out how to use the random number generator (introduced in section 4.11 of the text) to get a number between 1 and 6 to create the simulation. Chapter 4 Lab Loops and Files Lab Objectives Be able to convert an algorithm using control structures into Java Be able to write a while loop Be able to write an do-while loop Be able to write a for loop

More information

Programming Project 1

Programming Project 1 Programming Project 1 Handout 6 CSCI 134: Fall, 2016 Guidelines A programming project is a laboratory that you complete on your own, without the help of others. It is a form of take-home exam. You may

More information

Getting Started. Excerpted from Hello World! Computer Programming for Kids and Other Beginners

Getting Started. Excerpted from Hello World! Computer Programming for Kids and Other Beginners Getting Started Excerpted from Hello World! Computer Programming for Kids and Other Beginners EARLY ACCESS EDITION Warren D. Sande and Carter Sande MEAP Release: May 2008 Softbound print: November 2008

More information

Chapter 4 Lab. Loops and Files. Objectives. Introduction

Chapter 4 Lab. Loops and Files. Objectives. Introduction Chapter 4 Lab Loops and Files Objectives Be able to convert an algorithm using control structures into Java Be able to write a while loop Be able to write a do-while loop Be able to write a for loop Be

More information

COP 3014: Spring 2018 Homework 5

COP 3014: Spring 2018 Homework 5 COP 3014: Spring 2018 Homework 5 Total Points: 100 Due: Friday 03/23/2018 1 Objective The objective for this assignment is to make sure You understand and can work with C++ arrays. You are comfortable

More information

CS 2316 Pair 1: Homework 3 Enigma Fun Due: Wednesday, February 1st, before 11:55 PM Out of 100 points

CS 2316 Pair 1: Homework 3 Enigma Fun Due: Wednesday, February 1st, before 11:55 PM Out of 100 points CS 2316 Pair 1: Homework 3 Enigma Fun Due: Wednesday, February 1st, before 11:55 PM Out of 100 points Files to submit: HW3.py This is a PAIR PROGRAMMING assignment: Work with your partner! For pair programming

More information

Claremont McKenna College Computer Science

Claremont McKenna College Computer Science Claremont McKenna College Computer Science CS 51 Handout 4: Problem Set 4 February 10, 2011 This problem set is due 11:50pm on Wednesday, February 16. As usual, you may hand in yours until I make my solutions

More information

CpSc 111 Lab 5 Conditional Statements, Loops, the Math Library, and Redirecting Input

CpSc 111 Lab 5 Conditional Statements, Loops, the Math Library, and Redirecting Input CpSc Lab 5 Conditional Statements, Loops, the Math Library, and Redirecting Input Overview For this lab, you will use: one or more of the conditional statements explained below scanf() or fscanf() to read

More information

Introduction. Overview of 201 Lab and Linux Tutorials. Stef Nychka. September 10, Department of Computing Science University of Alberta

Introduction. Overview of 201 Lab and Linux Tutorials. Stef Nychka. September 10, Department of Computing Science University of Alberta 1 / 12 Introduction Overview of 201 Lab and Linux Tutorials Stef Nychka Department of Computing Science University of Alberta September 10, 2007 2 / 12 Can you Log In? Should be same login and password

More information

CS 150 Lab 10 Functions and Random Numbers

CS 150 Lab 10 Functions and Random Numbers CS 150 Lab 10 Functions and Random Numbers The objective of today s lab is to implement functions and random numbers in a simple game. Be sure your output looks exactly like the specified output. Be sure

More information

Lab 4: Imperative & Debugging 12:00 PM, Feb 14, 2018

Lab 4: Imperative & Debugging 12:00 PM, Feb 14, 2018 CS18 Integrated Introduction to Computer Science Fisler, Nelson Lab 4: Imperative & Debugging 12:00 PM, Feb 14, 2018 Contents 1 Imperative Programming 1 1.1 Sky High Grades......................................

More information

: Principles of Imperative Computation. Fall Assignment 5: Interfaces, Backtracking Search, Hash Tables

: Principles of Imperative Computation. Fall Assignment 5: Interfaces, Backtracking Search, Hash Tables 15-122 Assignment 3 Page 1 of 12 15-122 : Principles of Imperative Computation Fall 2012 Assignment 5: Interfaces, Backtracking Search, Hash Tables (Programming Part) Due: Monday, October 29, 2012 by 23:59

More information

VISUAL GUIDE to. RX Scripting. for Roulette Xtreme - System Designer 2.0. L J Howell UX Software Ver. 1.0

VISUAL GUIDE to. RX Scripting. for Roulette Xtreme - System Designer 2.0. L J Howell UX Software Ver. 1.0 VISUAL GUIDE to RX Scripting for Roulette Xtreme - System Designer 2.0 L J Howell UX Software 2009 Ver. 1.0 TABLE OF CONTENTS INTRODUCTION...ii What is this book about?... iii How to use this book... iii

More information

CS 201 Advanced Object-Oriented Programming Lab 4 - Asteroids, Part 2 Due: February 24/25, 11:30 PM

CS 201 Advanced Object-Oriented Programming Lab 4 - Asteroids, Part 2 Due: February 24/25, 11:30 PM CS 201 Advanced Object-Oriented Programming Lab 4 - Asteroids, Part 2 Due: February 24/25, 11:30 PM Introduction to the Assignment In this lab, you will complete the Asteroids program that you started

More information

CMSC 201 Fall 2016 Lab 09 Advanced Debugging

CMSC 201 Fall 2016 Lab 09 Advanced Debugging CMSC 201 Fall 2016 Lab 09 Advanced Debugging Assignment: Lab 09 Advanced Debugging Due Date: During discussion Value: 10 points Part 1: Introduction to Errors Throughout this semester, we have been working

More information

CS 112: Intro to Comp Prog

CS 112: Intro to Comp Prog CS 112: Intro to Comp Prog Importing modules Branching Loops Program Planning Arithmetic Program Lab Assignment #2 Upcoming Assignment #1 Solution CODE: # lab1.py # Student Name: John Noname # Assignment:

More information

printf( Please enter another number: ); scanf( %d, &num2);

printf( Please enter another number: ); scanf( %d, &num2); CIT 593 Intro to Computer Systems Lecture #13 (11/1/12) Now that we've looked at how an assembly language program runs on a computer, we're ready to move up a level and start working with more powerful

More information

COP 3014: Fall 2017 Homework 4

COP 3014: Fall 2017 Homework 4 COP 3014: Fall 2017 Homework 4 Total Points: 200 Due: Wednesday 11/01/2017 1 Objective The objective for this assignment is to make sure You understand and can work with C++ arrays. You are comfortable

More information

AP Computer Science Homework Set 1 Fundamentals

AP Computer Science Homework Set 1 Fundamentals AP Computer Science Homework Set 1 Fundamentals P1A. Using MyFirstApp.java as a model, write a similar program, MySecondApp.java, that prints your favorites. Your program should do the following: a. create

More information

ROCK PAPER SCISSORS Rock Paper Scissors Lab Project Using C or C++

ROCK PAPER SCISSORS Rock Paper Scissors Lab Project Using C or C++ ROCK PAPER SCISSORS Rock Paper Scissors Lab Project Using C or C++ Copyright 2014 Dan McElroy Project Definition Truth Tables Topics Covered Keyboard Character Input (C and C++) Converting Characters to

More information