1 / 25

Java Methods A& AB

Java Methods A& AB. Before We Begin…. Return your Karel J. Robot book! Go to: http://www.skylit.com/javamethods Click on “students” link under downloads section Download the student disk to your student drive. Chapter 1. Topics : - Hardware - Software and Programming overview

lorin
Download Presentation

Java Methods A& AB

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Java Methods A& AB

  2. Before We Begin… • Return your Karel J. Robot book! • Go to: http://www.skylit.com/javamethods • Click on “students” link under downloads section • Download the student disk to your student drive

  3. Chapter 1 • Topics: • - Hardware • - Software and Programming overview • - Computer Memory

  4. Chapter 1 • Students will: • - be able to identify and explain hardware components • - explain the relationship between hardware, software, and the internet • - explain what a programmer does • - will convert between numbering systems • - learn the significance of ASCII code

  5. Hardware • The most important piece: • Central Processing Unit (CPU) • - responsible for all mathematical computations • - 1995 processor -100 MegaHertz • How many computations is that? • Mega = 1 million • 100 million per second • Today’s computers – 4 GHz

  6. Hardware • Memory – where information is stored • RAM – random access memory • RAM is space for CPU to read and write data • RAM retrieves stored data from Hard Disk, and writes to HD to save info • More RAM means less # of times to retrieve data, so your computer is faster!

  7. Hardware • RAM cont’d: • An address bus is the channel from CPU to RAM – it sometimes can limit information processing! • - it’s random because any piece of data can be returned in a constant time, regardless of physical location • - not true for a magnetic discs (like a Hard Disk) or optical discs • they rely on moving parts, and retrieval time will depend on the location of the previous item found • Thus, the less we access it, the better!

  8. Hardware • Hard Disk • Memory stored on magnetic discs • Discs are stacked on each other, and rotate so that fixed “heads” can retrieve data • Stores large amounts of data • More RPM’s = faster retrieval

  9. Hardware • I/O devices • I/O is used to describe anything that has input or output • Input – keyboard, mouse, gamepad • Output – monitor, speakers

  10. Hardware • PC Board = printed circuit board • - a.k.a. motherboard • Brings it all together • Holds CPU, memory, I/O devices • Also holds CMOS • Holds basic instructions computer needs to initialize hardware and bootup • Does not require external power

  11. Software • The stuff that we write! • It can be thought of as information recorded on some medium • Layers of software on a computer • -BIOS, device drivers • - Operating System • - Software Applications

  12. Programmers • That’s us! • 5 steps a programmer typically follows: • 1. Defining the need • 2. Designing a flowchart • 3. Coding the software • 4. Debugging • 5. Beta testing

  13. The Internet • Simple version: • Beginning – ARPANET, 1969 – connected 2 computers • Today – internet relies on global T3 lines (~45 MB/sec transfer rate) to transmit data requests • Smaller “tributary” lines provide data locally • Your IP (internet protocol) is unique to your machine – you make a request, it travels along the route to the server where the website is hosted, then the information requested is returned to your IP

  14. Homework • Read Chapter 1 in book • Book will direct you online to finish chapter • Writing Assignment • Address the following 3 prompts: • 1. Explain the relationship between hardware and software • 2. Describe the origins of the internet, how it works, and how it relates to your answer for #1 • 3. Explain what a programmer does, and give some varied examples • 4. Explain yours understanding of computer memory • Min – 2 pages (dub space), Max – 3 pages • 5. Create a visual diagram of a computer labeling all of the components we took notes on (feel free to include components we didn’t talk about!)  add to your writing assignment • Your book will be an excellent source for this assignment

  15. Memory • How do computers represent information? • Fundamental level – binary! • CPU consist of transistors that have 2 states: • 0 – low voltage state • 1- high voltage state • Bit – one binary digit • Byte – eight bits • 1 byte has 256 different possibilities (2^8 = 256)

  16. Memory • How many combinations will 2 bits have? • 00, 01, 10, 11 – 22= 4 combinations • Reading binary: • From right to left, each digit is 2^place holder, starting with 0 • Ex) 0001 is 2^0 =1, 0010 is 2^1=2 • Q: What is 1101 in decimal?

  17. Number Systems • Programmers find it useful to be able to quickly convert between decimal and binary • 1 way:Example 1 - (Convert Decimal 44 to Binary)  subtract the largest power of two, and count that number as a 1

  18. Number Systems Example: 156 to binary  Keep remainders to right.. 2)156 02)78 02)39 12)19 12)9 12)4 02)2 0 1 156 = 10011100 • Easier method for large decimal numbers: • Division by 2: • Take a decimal number, and do long division by your base (in this case, base 2 for binary) • Keep track of remainders… divide until the quotient is 1 • Read from bottom to top for binary answer

  19. Numbering Systems • Try to convert the following • 00101110101011010010100101011001010010 • That is a bit too difficult – instead of trying to read that, programmers typically use a base 16 system, hexadecimal (groups of 4 binary numbers: 2^4 = 16) • 0123456789ABCDEF are the 16 hex digits • Why not just use the decimal system? • It is not a derived from a base 2 system

  20. Numbering systems • It is recommended to know these: • Decimal Hexadecimal Binary • 0 0 0000 • 1 1 0001 • 2 2 0010 • 3 3 0011 • 4 4 0100 • 5 5 0101 • 6 6 0110 • 7 7 0111 • 8 8 1000 • 9 9 1001 • 10 A 1010 • 11 B 1011 • 12 C 1100 • 13 D 1101 • 14 E 1110 • 15 F 1111

  21. Numbering systems • It is better to know how to convert: • Use remainder system to convert from decimal to hex (ex 1243): • 1243 / 16 = 77, remainder 11 (B) • 77 / 16 = 4, remainder 13 (D) • 4 / 16 = 0, remainder 4 • 1243 = 4DB in hexadecimal (or 04DB)

  22. Numbering Systems • Convert hex to decimal: try the Hex 11A3 • Start from right to left… multiply each by 16^ place value • So 3 * 16^0 = 3 • A(10) * 16^1 = 160 • 1 * 16^2 = 256 • 1 * 16^3 = 4096 • Answer: 4096+256+160+3 = 4515

  23. Number Systems • From binary to hex • Break binary into chunks of 4: • Ex) 101011 = 0010 1011 • Convert chunks into decimal • 0010 1011 = 2 11 = 2 B • From hex to Binary – do the opposite • 4A2F = 4 10 2 15 = 0100 1010 0010 1111

  24. Number Systems • Practice: • Convert the following to both decimal and hexadecimal: 10000011, 10010011, 10111011  • Convert the following Hex’s to both decimal and binary: 34, 5A, CAB

  25. homework • Numbering System Conversion Worksheet • Ch 1 Exercises - #1, 2, 5, 11, 12, 13, 14 • Create a program that converts: • From decimal to binary • From decimal to hexadecimal • From binary to hexadecimal • (the reverse of all of these) You can potentially write one method that takes a base number as a parameter  Worksheet due Tuesday; Exercises and program due Wednesday before class ends

More Related