CPSC120B
Fundamentals of Computer Science I
Day 4 Notes
Input
Cool Computer Science Thing of the Day
Reading Questions
Quiz
Emacs Tip of the Day
C-x 2
split window vertically
C-x 3
split window horizontally
C-x 1
close other windows
C-x 0
close this window
C-x 0
useful in conjuction with run command
- The run command in the Emacs Commands file has been updated.
- Write program to convert inches to feet and inches
- Previously we would put in values, now we will use input, need to solve the problem abstractly, for any input
- Don’t for get to change the type
- Can have compound functions; don’t abuse this
- Problem solving by example, 14 inches is 1 foot and 2 inches
- Write program that substracts 12
- Constants and variables review
- Magic numbers review
- Print review
- Test with example input, test with new input 26 inches is 2 feet 2 inches
- Uh-oh, did it wrong, need to use mod
- What if the user enters invalid input? Who’s responsibility is it?
Type Conversion Functions
Lab