Java Finish command line guessing game, then….

Slides:



Advertisements
Similar presentations
AP Computer Science Anthony Keen. Computer 101 What happens when you turn a computer on? –BIOS tries to start a system loader –A system loader tries to.
Advertisements

1 Todays Objectives Announcements Homework #1 is due next week Return Quiz 1 – answers are posted on the Yahoo discussion page site Basic Java Programming.
Picture It Very Basic Game Picture Pepper. Original Game import java.util.Scanner; public class Game { public static void main() { Scanner scan=new Scanner(System.in);
LAB SESSION 7 Graphical user interface Applet fundamentals Methods in applets Execution of an applet Graphics class.
Passing Streams to Functions. Passing Streams to Functions One Rule: always pass a stream as a reference.
CS18000: Problem Solving and Object-Oriented Programming.
Craps. /* * file : Craps.java * file : Craps.java * author: george j. grevera, ph.d. * author: george j. grevera, ph.d. * desc. : program to simulate.
Building Java Programs
MSc IT Programming Methodology (2). Word so far: ??? Guess a character: Assume the word is POP.
CIT 590 Intro to Programming Java lecture 3. Hashmaps The equivalent of python dictionaries. With both ArrayLists and Hashmaps, the syntax only allows.
Alice Variables Pepper. Set to Java look Edit / preferences restart.
More sophisticated behavior Using library classes to implement some more advanced functionality 4.0.
Random (1) Random class contains a method to generate random numbers of integer and double type Note: before using Random class, you should add following.
IC211 Lecture 8 I/O: Command Line And JOptionPane.
Web Proxy Server. Proxy Server Introduction Returns status and error messages. Handles http CGI requests. –For more information about CGI please refer.
20 Questions Assignment Intro James Wei Professor Peck March 19, 2014 Slides by James Wei.
Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington Review COMP 102 #
CPS 2231 Computer Organization and Programming Instructor: Tian (Tina) Tian.
By Nicholas Policelli An Introduction to Java. Basic Program Structure public class ClassName { public static void main(String[] args) { program statements.
CSC 204 Programming I Loop I The while statement.
REVIEW On Friday we explored Client-Server Applications with Sockets. Servers must create a ServerSocket object on a specific Port #. They then can wait.
Chapter 19 Designing the GUI front-end: the Model-View-Controller pattern.
Implementation of the Hangman Game in C++
1 - 1 CS230: Data Structures Spring 2007 Reading:Downey: Chapters 1, 2, 3, Sections , 4.13, , Chapters 5 and 6 Problem Set:Problem Set.
Discussion 4. Labs public MyPoint(double xInit, double yInit ) { MyPoint p = new MyPoint(0, 0); } ClassProblem.java recursive java.lang.StackOverflowError.
An Introduction to Programming and Object Oriented Design using Java 3 rd Edition. Dec 2007 Jaime Niño Frederick Hosch Chapter 18 Integrating user interface.
1 Lesson: Applets with User Input and Output with GUI ICS4M.
Georgia Institute of Technology More on Creating Classes part 2 Barb Ericson Georgia Institute of Technology Oct 2005.
BEGINNING PROGRAMMING.  Literally – giving instructions to a computer so that it does what you want  Practically – using a programming language (such.
Android Threads. Threads Android will show an “ANR” error if a View does not return from handling an event within 5 seconds Or, if some code running in.
Math Games Start Game Instructions for Teacher Question = Answer
LQCD Workflow Project L. Piccoli October 02, 2006.
Coding Time This is a starter activity and should take about 10 minutes [ slide 1 ] 1.Log in to your computer 2.Open IDLE 3.Start a script session (Select.
Georgia Institute of Technology More on Creating Classes part 1 Barb Ericson Georgia Institute of Technology Oct 2005.
More Sequences. Review: String Sequences  Strings are sequences of characters so we can: Use an index to refer to an individual character: Use slices.
Creating a GUI Class An example of class design using inheritance and interfaces.
Week 9 - Friday.  What did we talk about last time?  Static method practice  Finished the Game of Life.
Array Size Arrays use static allocation of space. That is, when the array is created, we must specify the size of the array, e.g., int[] grades = new int[100];
Methods What is a method? Main Method the main method is where a stand alone Java program normally begins execution common compile error, trying.
Computer Programming 12 Lesson 6 – Loop structure By: Dan Lunney.
Getting Started With Python Brendan Routledge
Georgia Institute of Technology More on Creating Classes Barb Ericson Georgia Institute of Technology June 2006.
Test 2 Review Outline.
CSC111 Quick Revision.
HW7(100pts+10bonus) The homework Due on May 11, 23:59:59
Lesson 4 - Challenges.
What’s cheating and what is not?
CS305J Introduction to Computing
Java Programming: Guided Learning with Early Objects
Engineering Innovation Center
Iterations Programming Condition Controlled Loops (WHILE Loop)
Repetition Chapter 6 12/06/16 & 12/07/16 1 1
HW11 Assignment Specification
Starting Out with Java: From Control Structures through Objects
An Introduction to Java – Part II
An Introduction to Java – Part I, language basics
Arrays We often want to organize objects or primitive data in a way that makes them easy to access and change. An array is simple but powerful way to.
Creating Functions Pepper.
Truth tables: Ways to organize results of Boolean expressions.
Java Lesson 36 Mr. Kalmes.
Truth tables: Ways to organize results of Boolean expressions.
Building Java Programs
Using Objects (continued)
Building Java Programs
More on Creating Classes
Just Basic Lessons 9 Mr. Kalmes.
slides created by Ethan Apter
Random Numbers while loop
int [] scores = new int [10];
Day 11 The Last Week!.
Presentation transcript:

Java Finish command line guessing game, then…

GuessingGameUI extends javax.swing.JFrame GUI Guessing Game GuessingGame GuessingGameUI extends javax.swing.JFrame GuessingGame target: int gameOver: boolean statusMsg: String - game: GuessingGame target: int gameOver: boolean + GuessingGameUI() + btnNewGameActionPerformed(evt: java.awt.event.ActionEvent): void + btnGuessActionPerformed(evt: java.awt.event.ActionEvent): void + processGuess(guess: int) + getMsg(): String + isGameOver(): boolean + newGame(): - setTarget(): void GuessingGameApp <no fields> + main(args: String): void

Important Points Remember that your GuessingGame class doesn't just run from start to finish, it responds to the requests from the UI Note that there is no main loop! Get your parameters and return types correct for you GuessingGame methods The UI passes information to the GuessingGame and updates the UI on the basis of what it gets back

Extending the game Ask the user for confirmation if they start a new game before the old game was finished Allow the user to set the upper bound for the random target Keep a count of the number of tries and display it on the GUI Keep a list of high scores (requires file handling, which you have not been taught but which is on the blog…) Other ideas? Please share…