teaching machines

CS 145 Preassignment 2 – due before 10/19

See the PDF. When you download speccheck_pre2.jar, make sure the filename ends in “.jar”.

CS 145 Lecture 9

Agenda compound booleans logical operators && and || ensuring a number in a range stopping a command loop projectiles writing our own String.indexOf if/else statements Code LogicalFun.java package lecture; import java.util.Scanner; public class LogicalFun { public static void main(String[] args) { boolean isMrRight; boolean isTall = false; boolean isDark = false; boolean isHandsome = false; […]

CS 145 Lecture 8

Agenda an example animation finish summing compound booleans logical operators && and || Code Summer.java package lecture; public class Summer { public static void main(String[] args) { System.out.println(sum(100)); } public static int sum(int n) { int runningTotal = n; while (n > 0) { n = n – 1; runningTotal = runningTotal + n; } […]

CS 145 Lab 5

Reminder Submit your already completed checkpoints from lab 4 in the first 20 minutes of this lab. Lab will not be held on October 12 to give you time to study and because your instructor is out of town. Submit any unfinished checkpoints from lab 5 on October 19. Hurdles When you’re first learning to […]

CS 145 Lecture 7

Topics Covered what does this do? generating a random spelunking workout for loop = while loop, but more compact sum numbers 1 to n an acrostic editor mouse trails What does this do? public static String ?(??) { return text + ” :)”; } public static ? ??(String text) { return text.length() == 0; } […]

CS 145 Lab 4

Last lab we looked at methods. Grasping this idea of pushing out sequences of instructions to these standalone “subprograms” is of utmost importance to your proper understanding of computer science and programming. It’s so important that this week’s lab does not introduce any new topics. Please take the time to ask questions and resolve any […]

CS 145 Lecture 6

Topics Covered what does this do? facing off the computer in guess-a-number generating a random spelunking workout an acrostic editor calculating average cell phone payment What does this do? public static String ?(??) { return text + ” :)”; } public static ? ??(String text) { return text.length() == 0; } public static ? ??(String […]

CS 145 Homework 1 – due before Tuesday, 10/4

See the PDF. Download speccheck_hw1.jar. Internet Explorer has an annoying habit of renaming this file. Make sure it ends in *.jar and not *.zip.

CS 145 Lecture 5

Agenda revisiting method anatomy put yourself in the method’s shoes: what am I trying to do? what do I need to give back? what outside information do I need in order to perform my job? how arguments are passed method improv Code GeometryFun.java package lecture; import java.util.Scanner; public class GeometryFun { public static void main(String[] […]

CS 145 Lecture 4

Agenda finish up KML example don’t repeat yourself method anatomy method’s beauty: minimize bug potential encapsulate small, testable units make calling code more readable some more examples Code Placemarker.java package lecture; import java.util.Scanner; public class Placemarker { public static void main(String[] args) { System.out.println(“<?xml version=\”1.0\” encoding=\”UTF-8\”?>”); System.out.println(“<kml xmlns=\”http://www.opengis.net/kml/2.2\”>”); System.out.println(“<Document>”); System.out.println(“<Style id=\”seethrough\”><PolyStyle><color>7fffffff</color></PolyStyle></Style>”); handlePlacemark(); handlePlacemark(); handlePlacemark(); System.out.println(“</Document>”); […]

1 32 33 34 35