Computer Science 100

Computational Expression

Gregory M. Kapfhammer

Color Scheme

Key Concept

Corresponding Diagram

In-Class Discussion

In-Class Activity

Details in the Textbook

Classes

Objects

Relationship between class and object?

Object-oriented programming

Examples of Java objects?

Computer graphics!

Computer Graphics

Displaying pixels on the screen

Using a coordinate system

Representing color with RGB values

Find a listing of RGB values on the Web

Can you connect the RGB values to a specific color?


creative commons licensed ( BY-NC-ND ) flickr photo shared by Russ Allison Loar

Use shapes to make it easier to display graphics

Use the JavaFX package

Save graphics to the filesystem

Any questions about computer graphics?

We will practice during upcoming assignments

See Section 3.9 for more details

Objects and Primitives

Similarities and differences?

Can you create a list for both of these?

What does this look like in memory?

Aliases for reference variables

Refer to Section 3.1 for more details and diagrams!

Is an RGB color value a primitive?

Is an RGB color value an object?

How did you know?

String Manipulation

Real world examples of string processing?

Purpose of and ways to index a string?

See Figure 3.1 for the methods provided by String


flickr photo shared by James Jordan under a Creative Commons ( BY-NC-ND ) license

Let's Try It!

String "mutations" change the content of strings

git pull download master

Ensure that your merge worked correctly

Finish the program from Listing 3.1 on page 106

Ensure that the program produces the correct output

Can you explain the output of this program?

Packages

What is a class library?

Application programming interface (API)

What are some examples of packages?

Check the online documentation!

Make sure to use an import!

Let's explore a new package!

Random Numbers

Provided by java.util.Random

Calculations based on a seed value

Study the source code in Listing 3.2

Will the program always produce this output?

See Figure 3.4 for examples of Random methods


flickr photo shared by pure9 under a Creative Commons ( BY-NC ) license

Formatting Output

What do you do if the output needs a special format?

The DecimalFormat and NumberFormat classes

You can format correct for currency and percentages!

See details in the text — may help on an assignment!

Enumerated Types

What to do if a variable only has a few possible "types"?

For instance, a letter grade has distinct values

Or, across the world, seasons have categories

You can use enumerated types to define these categories

See details in the text — may help on an assignment!

Any questions about this content?

We will practice these concepts

Work to master learning objectives

Schedule meeting during office hours

Finish the in-class examples soon