What's New
- Last regular class: Thursday, May 19.
- Final Exam: Tuesday, May 24 from 8-10am in Batmale 413 as usual, or Thursday, May 26 from 1-3pm
in Batmale 411 (you can take it either time) covering everything we've done this semester.
- The ACRC Computer Lab is going to be hiring student lab aides / tutors for the Fall.
They hire only on instructor recommendation. So if you want to work there, let me know.
You can get paid $9/hour if you are taking 6 or more units of classes next semester.
Miscellaneous Information:
Assignments:
- All homework assignments are to be submitted using
the Insight online course system
- Practice Problem 1: Algorithms due Thursday, 1/20
Solution available here
- Practice Problem 2: Hello World due Thursday, 1/27
Solution available here
- Practice Problem 3: Muni ridership calculator due Thursday, 2/10
Solution available here
- Programming Lab 1: Time Calculator due Thursday, 2/17
Solutions available here: Regular credit solution
and Extra credit solution
- Programming Lab 2: Rock - Paper - Scissors Game due Thursday 3/3
Solutions available here: Regular credit version and
Extra credit version. Plus, an alternative
regular-credit solution
- Practice Problem 4: Jackalope Populations due Thursday 3/10
Solution available here
- Programming Lab 3: Parallelogram Program due Thursday, 3/17
Solutions available here: regular credit version and
extra credit version.
- Programming Lab 4: Consumer Loan Program due Thursday, 4/7
Solution available here
- Programming Lab 5: Palindrome Program due Thursday, 4/14
Solutions available here: Regular credit version
and Extra credit version
- Programming Lab 6: De-Dup Program due Thursday, 4/21
Solutions available here: Regular Credit version
and Extra credit version
- Practice Problem 5: Car Class due Thursday, 5/5
Solution available here
- Programming Lab 7: Distance File due Thursday, 5/12
Solutions available here: Regular credit solution
and Extra credit solution
Class Notes:
Sample Programs:
Chapter 2: Fundamental Data Types
- HelloWorld.java: Demonstrates simple console output
- Echo.java: Here is an example demonstrating the use of variables, and of the
Scanner class for console input.
- Names.java: Solution to In-class exercise: inputs and outputs names.
- Hello World program using JOptionPane for GUI input of age
input
- CalcFormatDemo.java: Demonstrates calculations and
formatting with printf.
- GradeAverage.java: Solution to in-class exercise averaging grades
- Busses.java: Solution to in-class exercise with wedding guests on busses
- StringDemo.java: Shows various ways to manipulate strings.
Chapter 3: Decision Structures
- Interest.java calculates interest on an investment at one of 2 rates
- NamesAndAges.java: Solution to in-class exercise with simple if-statements
- MoreInterest.java A version of
the above program, with more if-statements, more interest rates.
- NamesAndAgesPart2.java: Solution to in-class exercise with
if-else if-else
- BooleanApp.java demonstrates Boolean values and
multi-way if-statements
- NamesAndAgesPart3.java: Solution to in-class exercise with
if-else if-else and logical and (&&)
- SwitchGrades.java demonstrates switch statements
- ZipCodes.java: Solution to in-class
exercise to determine city from ZIP code, using switch
Chapter 4: Loops
- Invest.java uses a loop to add up interest
on an investment over time
- Hellos.java: Solution to in-class
exercise repeating "hello" on screen
- Retire.java calculates results of monthly
retirement savings, using printf for formatting output
- NestedControlStructure.java inputs and shows student
info with if-else-if inside loop
- NestedAlt.java: Alternate version of above using "break"
- AverageNumbers.java: Solution to in-class
exercise to average and count numbers input by user
- Here's a document summarizing and demonstrating best
practices in code formatting.
- InvestFor.java: Solution to in-class
exercise. Same as Invest.java, but using a for-loop instead of a while-loop.
- RandomExercise.java: solution to in-class exercise.
Generates random numbers in a loop, stopping when 2 in a row match, outputs largest.
- AddMoney.java demonstrates switch statements, for
loops, and boolean varaibles
- InvestAgain.java: Variation of above Invest program that
allows user to repeat the calculation as many times as user wants.
- NestedBrackets.java: Solution to in-class exercise with nested loops,
to output brackets.
Chapter 5: Methods
- FunInterest.java demonstrates the definition and
use of a method.
- Area.java Solution to in-class exercise using a method to calculate
area of a rectangle
- RandomExerciseMethod.java - a variation of the
In-class exercise solution to generate random numbers: uses a void method.
- NestedBracketsMethod.java: solution to in-class exercise to use a
method with Nested Bracket exercise from Chapter 4.
- InflationBetter.java - Uses several methods, calculates
inflation rate.
- Groups.java - demonstrates using shared static class variables and
output with nested loops.
- GroupsBetter.java - Variation of above program, without shared
static class variable for numGroups.
- AddMoneyFun.java uses 2 methods with
loops, switch statements, etc. (a variation of the AddMoney.java program above)
- Solution to Days Out Exercise: DaysOut.java
- DrawRectangle.java: solution to in-class exercise to output a
rectangle, using methods.
- Blackjack.java uses several static methods and
instance varaibles.
Chapter 6: Arrays
- BasicArray.java - Inputs and averages an array
of doubles.
- NameArray.java Solution to in-class exercise
- ArrayElementArguments.java - Demonstrates how to pass an
element of an array into a method.
- ArrayParam.java - Demonstrates how array
parameters work
- ReturnArray.java - shows how to create an
array in a function and return it
- MethodToInputArray.java Solution to in-class exercise
with a method to return an array of numbers
- SearchGroup.java - Sequential search example, searches an array of
student IDs to see if user-entered ID is in the array.
- ArrayExp.java - Inputs and sorts an array of
ints.
- SortCommandLine.java Command-line argument variation of
ArrayExp.java
uses command-line to specify a list of names, searches that list to find a name.
- SearchName.java Solution to in-class exercise,
- QuarterlySales.java - a 2-Dimensional array example
- Pixels.java - Models screen pixels with a 2-D
array.
- JaggedArray.java - Shows how a 2-D array can be jagged:
have different numbers of columns for each row. Inputs test scores for courses - each course can have
a different number of tests.
Chapter 7: A First Look at Classes
- SimpleCourseTest.java - a simpler and
inferior version of CourseTest.
- SimpleTime.java and
SimpleTimeTest.java Solution to in-class exercise.
- CourseTest.java - a file which
defines two classes - the Course class and the CourseTest class with a main method to
test it.
- Time.java and
TimeTest.java Solution to in-class exercise.
- Bubble.java - a simple demonstration of static vs.
instance variables
- Solution to in-class exercise: Added a static Time object to Time class, to represent
the current time of day: TimeTest.java and
Time.java
- CarArray.java - Declares and manipulates an array of Car objects.
- CourseListProgram.java: creates an ArrayList of Course objects.
Chapte 8: File I/O
- GradeInput.java: demonstrates file output with formatting
- JunkMail.java: demonstrates file i/o
- Average.java: averages all numbers from a file. Solution to in-class
exercise
Last updated: 5/19 9:00am