Unit 1 Coding

Java Software Solutions for AP* Computer Science A

  • Authors: John Lewis, William Loftus, and Cara Cocking

  • Publisher: Addison-Wesley

  • Copyright: 2006

  • Instructors may modify slides for teaching.

Chapter 1: Computer Systems

Overview of Computer Systems

  • Focuses on:

    • Components of a computer

    • Interaction between components

    • Storage and manipulation of information

    • Programming and programming languages

    • Graphic systems

Objectives (1.0-1.1)

  • Differentiate between hardware and software.

  • Explain how hardware components, especially memory, execute programs and manage data.

  • Identify two categories of software.

  • Explain two methods to store and manage data.

  • Understand significance of ASCII and Unicode Tables.

  • Convert between binary and decimal systems.

Hardware and Software

Software

  • Programs and data.

  • A program is a series of instructions.

Hardware

  • Physical, tangible components of a computer:

    • Keyboard, monitor, disks, wires, chips, etc.

  • Hardware and software are interdependent.

CPU and Main Memory

  • Central Processing Unit (CPU): Executes program commands.

  • Main Memory/Primary storage: Primary storage for active programs and data (Synonymous with RAM).

    • Examples: Intel® Core™ i9-14900KS Processor, AMD Ryzen™ Threadripper™ PRO 7995WX.

Secondary Memory Devices

  • Provide long-term storage, examples include:

    • Floppy Disk

    • Hard Disk

    • Writable CD/DVD

    • Flash Drives

  • Data moves between main and secondary memory as needed.

Input/Output Devices

Input Devices

  • Examples: Keyboard, Mouse, Scanner, Touch Screen.

Output Devices

  • Examples: Monitor, Printer.

  • Facilitate user interaction with the computer.

Software Categories

Operating System (OS)

  • Controls machine activities.

  • Provides user interface.

  • Manages CPU, memory, etc.

  • Examples: Windows 10, Unix, Linux, macOS.

Application Programs

  • General term for other types of software (e.g., word processors, games).

  • GUI common in OS and applications.

Analog vs. Digital Data Storage

Analog

  • Continuous representation of data.

    • Example: Music on vinyl records.

    • You have to go through the whole thing for one spot in the track, which can be time-consuming and less efficient compared to digital formats that allow for precise access to specific sections.

Digital

  • Data is broken into pieces, represented by numbers.

    • Example: Music on CDs (digitized and sampled).

    • You can skip to each part

Machine Language

  • Binary representation of data (e.g., 0s and 1s).

Digital Information

  • Computers store various data types digitally:

    • Numbers, text, graphics, video, audio.

Representing Text Digitally

  • Each character is stored as a number, including punctuation:

ASCII Table

  • A table mapping decimal values to characters (e.g., whitespace, alphabets, symbols).

Binary Numbers and Bit Permutations

  • Bit: Smallest unit of data (0 or 1).

  • Each bit doubles possible permutations:

    • Example: 3 bits yield 8 unique combinations.

Permutations of bits are used to store values

Bit permutations

  • Each permutation can be represented with a particular item

  • 2 to the power of N bits

Memory Storage

Main memory

  • Volatile; data lost without power.

  • Organized in unique addressing.

  • Main memory and disks are direct access- information reached directly without the need to search sequentially, allowing for faster data retrieval and improved performance in computing tasks.

  • Sequential access device is data in a linear order, so you cant skip to get to other places

Secondary memory

  • Non-volatile; retains information without power.

Storing Information

  • Large values are stored in consecutive memory locations/cells

  • Memory cells store a fixed number of bits (e.g., 8 bits or 1 byte).

Storage Capacity

  • Expressed in KB, MB, GB, and TB, indicating bytes held.

The Central Processing Unit

  • Comprised of:

    • Arithmetic/Logic Unit

    • Control Unit

    • Registers for temporary storage.

  • Follows fetch-decode-execute cycle:

    • Fetch, Decode, Execute instructions.

IP and Internet Addresses

  • Each computer has a unique IP address:

    • IPv4 example: 204.192.116.2

    • IPv6 example: 2001:0:ad38:90d7:cc50:1f7b:b666:6ed.

Software and Programming Languages

Objectives

  • Understanding problem-solving steps.

  • History of Java as an object-oriented programming language.

  • Identifying types of comments and rules for identifiers.

Problem Solving

  • Steps to solve problems through programming:

    • Understand, dissect, design, implement, test.

Java Overview

  • Java is an object-oriented language developed by Sun Microsystems since 1995.

  • Structure of a Java program consists of classes and methods.

Comments and Identifiers

  • Use of comments to document code:

    • Types: single-line, multi-line, Javadoc comments.

  • Identifiers: Names that refer to variables or functions.

Reserved Words and Whitespace

  • Reserved words have special meaning in Java (e.g., class, public).

  • Whitespace aids in readability but is ignored by the compiler.

Programming Languages Levels

  • Four levels: Machine language, Assembly language, High-level language, Fourth-generation language.

Compiler vs. Interpreter

  • Compiler translates source code to machine language.

  • Java translates to bytecode, then interpreted to machine language.

Graphics in Java

Duplicate Points

  • Understanding pixel representation and color mixing.

  • Each pixel identified using a coordinate system.