CS 145 Lecture 15 – More colliding
Agenda meet JFrame and company collide circles collide rectangles Code CollisionUtilities.java package lecture; import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; public class CollisionUtilities { public static void main(String[] args) throws FileNotFoundException { Scanner in = new Scanner(new File(“/home/cjohnson/Desktop/lines.txt”)); while (in.hasNextDouble()) { double leftA = in.nextDouble(); double rightA = in.nextDouble(); double leftB = in.nextDouble(); double rightB = […]
CS 145 Lecture 14 – Testing and conditionals via collision detection
Agenda lab switcharoo collision detection test-driven development Collision detection Code CollisionUtilities.java package lecture; import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; public class CollisionUtilities { public static void main(String[] args) throws FileNotFoundException { Scanner in = new Scanner(new File(“/home/cjohnson/Desktop/lines.txt”)); while (in.hasNextDouble()) { double leftA = in.nextDouble(); double rightA = in.nextDouble(); double leftB = in.nextDouble(); double rightB = […]
CS 491 Lecture 15 – Wevents Part IV
Agenda schedule mobile OS talks inserting and editing adding a cache marshalling compound data detecting a network connection pushing changes Problem We mentioned last time that the advantage of an IntentService + ResultReceiver over an AsyncTask is only seen when the background task does more than update the UI, like maintain a local cache. Such […]
CS 491 Lecture 14 – Wevents Part III
Agenda write an AsyncTask AsyncTask vs. IntentService + ResultReceiver handling ResultReceiver configuration changes saving instance state adding a ListActivity hello, JSON add events AsyncTask In these days of big data, complex computation, and networks, we have need to perform background tasks whose results affect the UI. As UI stuff can only be done on the […]
CS 145 Lecture 13 – Loop tricks
Agenda which loop when? conditioning on sentinel values fencepost loops nested loops Code ForAWhile.java package lecture; import java.util.Scanner; public class ForAWhile { public static void main(String[] args) { // String command = “notdone”; // for (Scanner in = new Scanner(System.in); !command.equals(“done”); command = in.next()) { // } String command = “notdone”; Scanner in = new […]
CS 145 Lab 7
Reminder Show your completed lab 6 checkpoints to your instructor or TA in the first 20 minutes of this lab. All code for this lab should go in a package named lab7. Cards Each of today’s problems involves a deck of cards. Though we use card terminology, you do not need to have ever touched […]
CS 145 Exam 1
Exam 5-point summaries of individual question and overall scores.
CS 145 Lecture 12 – Conditionals and file input
Agenda generating an ordinal number if/else if reading from files (brief treatise on exceptions) test-driven development categorizing light Code Ordinals.java package lecture; import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; public class Ordinals { public static void main(String[] args) throws FileNotFoundException { Scanner in = new Scanner(new File(“/home/cjohnson/Desktop/ordinals.txt”)); while (in.hasNextInt()) { int i = in.nextInt(); String expected […]
Homework 2 – wettstaj
Guess All The Megaman Bosses! This app was going to be really cool if i could have finished it. The basic idea was that, when you type in a word, it would search a premade database for the list of bosses. Every time you typed in a correct boss it would populate a text field […]
CS 491 Homework 3 – due before 11/4
See the PDF.