# Teleprinters - [Teleprinters in 1932 - YouTube](https://youtu.be/n-eFFd5BmpU?si=lz6-q655F_GOIt8g) - [Parts of a Teleprinter - YouTube](https://www.youtube.com/watch?v=-2gXC-ZPKCM) # ASCII - [ASCII Table - ASCII Character Codes, HTML, Octal, Hex, Decimal](https://www.asciitable.com/) # Strings and Chars ## Remember ```java char c = 'c' // single quotes String s = "Hello" // double quotes ```` ## This Idea is More Useful than You Might Think ```java for (int i= 0; i<26; i++) { System.out.println(Character.toString(i + 65)); } ``` ## Caesar Cipher The following code will print ifmmp!xpsme or hello world shifted one character to the right. To make it work as a Caesar cipher you'll need to make it leave spaces as they are and to wrap around to the beginning as you pass z. ```java String a = "Hello World"; a = a.toLowerCase(); for (int i = 0 ; i < a.length(); i++) { System.out.print((char) (a.charAt(i) + 1)); } ``` Write a program that allows users to enter a string and have it output shifted n characters. Write a complimentary program that will decode a string. ## Rot13 What does the following code do? ```java public class Rot13 { public static void main(String[] args) { String s = "A sample string"; for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); if (c >= 'a' && c <= 'm') c += 13; else if (c >= 'A' && c <= 'M') c += 13; else if (c >= 'n' && c <= 'z') c -= 13; else if (c >= 'N' && c <= 'Z') c -= 13; System.out.print(c); } System.out.println(); } } ``` # Floating Point Numbers Remember: the number of bits in the exponent determines the range, in the mantissa the precision ## Exercise Use the table to determine the size and the sign of the floating point numbers. Each has a 8 bit mantissa and a 4 bit exponent | | | Exponent | | | -------- | --- | ----------------- | ----------------- | | | | <0 | >0 | | Mantissa | <0 | Negative, "small" | Negative, "large" | | | >0 | Positive, "small" | Positive, "large" | Remember that <0 means starts with 1, >0 means starts with 0 1) 011010001101 2) 101100000011 3) 010110000011 4) 101100001100 %% 1) 0.1015625 2) -5 3) 5.5 4) -0.0390625 (-5/128) %%