Principles Of Computer Science I
Dr. Tom Hicks - Trinity University - CSCI 1320 -  Fall 2017 - Tentative Schedule - 12:45 TT

All Labs/Assignments Are Due The Next Class Period Unless Specified Otherwise!

# Topic(s) Reading Assignments
 & Handouts
Laboratory Assignment

#1

8/24

TH


Introduction To Class
Discuss Course Outline

Chapter 1

Computer Science
Computer Programming
Designing, Writing, Testing Debugging, Maintaining
CS Salaries
CS - Young Science
Charles Babbage
Ada Lovelace
Alan Turing - Turing Award
Alonzo Church - Lamda Calculus
Eniac
Software
BIOS Software
Operating Systems
Hardware
Motherboard, Processor, Cooling Fan,
Machine Language
Processor Cycles
Binary Digits (0,1) - Bit
Processor Instruction Set
Voltage
Transistors
von Neumann Architecture
Memory
Bus
Assembly Language
Assembler
Compilers
High-Level Languages
Scala
Interpreter
Scala - Java Virtual Machine
Scala Portability
Scala Multiplatform
Martin Odersky - Creator Scala
Scala - open source
Programming Paradigms
Imperative Paradigm
Functional Paradigm
Object Oriented Paradigm
Scala - Hybrid Language
Basic Integer Operations
Integer Division
math.pow(2,3) - Exponentiation
Int - Integer Variables
Double - Double Variables
Order Of Operations - Correct
Modulus
REPL - Read-Evaluate-Print-Loop
Numeric Literal - 0,5,3
res0 - result0
Strings - String Variables
Line Comments //
Block Comments /*   */
val vs. var ??
String Concatenation +
print & println
Int - +/- 2 billion - 4 bytes
var - variable - can be changed
val - constant - no change
Double - decimal numbers
double - float - not exact

 

Course Outline

PCS1-Ch-1A-Intro-Scala  PDF  Slides 

Read Chapter 1

 

Questionnaire

PCS1-Ch-1A-Intro-Scala-HW


# 2

8/29

TU


Chapter 2
Linux & Tools

GUI
Valid Directory Names
Command Line Interface
Putty - Free!
clear - clear console window
Bit - binary digit
Byte 8 bits - 1 char
Directory/Folder
Text File
ASCII
Binary File - Executable
ls - list files
Linux File Permissions
Hidden Files (start with .)
Wild Cards (*)
mkdir - create directory
cat - display ascii-text files
cd - Change Directory
cp - Copy Files
rmdir - Delete Empty Directory
rm - Delete File Or Directory
mv - Move Files
chmod - Change File Permissions
rwx - binary -421
exit - close terminal window
man - help system man pages
compile a scala program
redirect output >
less - cycle through file
whoami - linux groups
ping
rsh - remote shell disabled
telnet - disabled
df - disk free
find - display a list of files
grep - search files for text
head - top of file
tail - bottom of file
who - logged in?

vi command line  editor
why use
2 modes
i - enter input mode
ESC - enter command mode
ESC:wq - save & exit
ESC:w - save & stay
ESC:q! - exit & discard changes
a - input after cursor
arrow keys - command mode
:50 - go to line 50
I - input mode at beginning of line
A - input mode at end of line
x - delete char
dd - delete line
yy - yank to clipboard
P - paste before cursor line
p - paste after cursor line
J - join cursor line with following line
/tom - search for tom
- repeat last command
u - undo
:r a.scala - read file into editor



PCS1-Ch-2A-Linux PDF Slides

Read First Half Of Chapter 2

PCS1-Ch-2ALinux-HW

CS1-Ch-1B-Install-Putty-1
Optimal

# 3

8/31

TH

 

Quiz 1 - Chapter 1

Chapter 2B
Basics & Scripts
 
Byte - 8 bits
Short - 2 bytes - 16 bits
Int - 4 bytes - 32 bits
Long - 8 bytes - 64 bits
Char - 8 bits - single quotes
String - double quotes - \n
String - \\ - \' - \"
Boolean - true = false
Float - 4 bytes - 32 bits
Double - 4 bytes - 32 bits
.toString Conversion
.toInt Conversion
.toByte Conversion
.toLong Conversion
.toFloat Conversion
.toDoubleConversion
6 Logical Operators
<, <=,  >, >=, ==, !=
AND &&, OR || , NOT !
String Concatenation
String Repeat
Tuples ( , , )
2-tuple 5 -> 9
readInt
readDouble
readLine
Interactive Program
Scripts vs Applications
Scripts -> no scalac
shortcuts & abbreviations

 


CS1-Ch-2B-Scala-Basics-Slides  PDF  Slides


InstallScalaMac

Transferring Files To My CSCI-1320

Read More Of Chapter 2

CS1-Ch-2B-Scala-Basics-HW

# 4

9/5

TU

 
Chapter 2C
Numeration & Basics

Decimal Numeration System
Decimal Counting Numbers
Binary Numeration System
Binary Counting Numbers
Euler Process
Convert Base 10 to Base 2
Convert Base 2 to Base 10
Octal Numeration System
Octal Counting Numbers
Euler Process
Convert Base 10 to Base 8
Convert Base 8 to Base 2
Convert Base 2 to Base 8
Convert Base 8 to Base 10
Hexadecimal Numeration System
Hexadecimal Counting Numbers
Euler Process
Convert Base 16 to Base 10
Convert Base 10 to Base 162
Convert Base 16 to Base 2
Convert Base 2 to Base 16
Storage Of Positive Integers
Sign Bit - High Bit
Bits Numbered From Zero
Sign Magnitude - Negative Integers
One's Complement - Negative Integers
Two's Complement - Negative Integers
.toBinaryString
.toOctalString
.toHexString
Addition Of Base Two Numbers
Subtraction Of Base Two Numbers
Math Defaults -> Int & Double
Why Know?

 

PCS1-Ch-2C-Numeration  PDF  Slides

Read The Rest Of Chapter 2



PCS1-Ch-2C-Numeration-HW



# 5

9/7

TH

 
Quiz 1 - Chapter 2A & 2B

Chapter 3-A
Conditional Logic
 
George Boole
Linux GUI Editor gedit&
Multiple Windows
if then
if then else
Amusement Park Program
Testing A Program
String Equivalence eq
Mathematical Order Operations
Food Cost Calculation Program
Good Error Messages
Test!
match statement

 

PCS1-Ch-3A-Conditional-Logic  PDF  Slides

Transferring Files To My CSCI-1320

Read At Least Half Of Chapter 3

PCS1-Ch-3A-Conditional-Logic-HW

# 6

9/12

TU

 

Chapter 3-B - Chapter 8
Loops

length - String
.toUpperCase
.toLowerCase
.substring(N,M)
short-cuts
+=, -=, *=, /=, %=
while - pretest loop
When To Use While Loop
Examples
do while - posttest loop
When To Use Do While Loop
Examples
for - fixed repetition loop
When To Use For Loop
Examples
formatted printf ("%5d"
formatted printf ("%5.2f"
str(N) - Returns String Character
  

  PCS1-Ch-3B-Basic-Loops PDF  Slides

Read The Rest Of Chapter 3

 

PCS1-Ch-3B-Basic-Loops-HW
Due 9/19

# 7

9/14

TH


Chapter 3-B - Chapter 8
Loops

length - String
.toUpperCase
.toLowerCase
.substring(N,M)
short-cuts
+=, -=, *=, /=, %=
while - pretest loop
When To Use While Loop
Examples
do while - posttest loop
When To Use Do While Loop
Examples
for - fixed repetition loop
When To Use For Loop
Examples
formatted printf ("%5d"
formatted printf ("%5.2f"
str(N) - Returns String Character

Practice Loops in Class
 
 


HW3B-Student.zip

PCS1-Ch-3B-Basic-Loops-HW
Due 9/19

# 8

9/19

TU



Chapter 4
Functions With Explicit Returns
max(x,y) - Return Largest Of Two Ints
Function Format
max(x,y,z) - Return Largest Of Three Ints
areaTriangle (height, base) - Return Area
volumeTriangularPrism (triangleHeight: Double, triangleBase: Double, prismHeight: Double)
upChar - Return Capital
secondsToTimeString(totalSeconds:Int)

PCS1-Ch-4A-Functions-1  PDF  Slides

TomH-HW-4A-Functions-1-Student.zip

Read At Least Half Of Chapter 4

PCS1-Ch-4A-Functions-1-HW


# 9

9/21

TH

Functions With Explicit Returns

TomH-HW-4B-Functions-2-HW-Student.zip

 

# 10

9/26

TU


Quiz On 2C, 3A & 3B

Chapter 4
Functions Without Explicit
Returns
Non-Funcional Functions
def Menu1( ):Unit =
def Menu2( )
def greetings(who:String)
isInteger(str:String):Boolean =

Tuple Review
Functions That Return Tuples
def squares1 (no:Int) : (Int, Int) =
def getOfficer( ): (String, String, String) =
var x = getOfficer()
var (name, rank, serialNo) = getOfficer()
getLong( )
getDouble( )
Write Good Tests
Test Functions Well
Program Decompostition
Function Naming
Top Down Design
Programming Paradigm
Imperative Paradigm
Functional Paradigm
Object Oriented Paradigm
Scala - Multi-Paradigm Language

Optional Arguments

Chapter 5
Introduction To Recursion
Basics Of Recursion
  
PCS1-Ch-4C-Functions-3  Slides  PDF

TomH-HW-4C-Functions-3-Student.zip
PCS1-Ch-4C-Functions-HW
Due 10/3

# 11

9/28

TH

Exam I


PCS1-Ch-4C-Functions-3  Slides  PDF

TomH-HW-4C-Functions-3-Student.zip
PCS1-Ch-4C-Functions-HW
Due 10/3

# 12

10/3

TU


Chapter 5
Introduction To Recursion
Basics Of Recursion
Optional Arguments
Right To Left
Overloading A Function
Signatures
Random Numbers
util.Random.nextInt(5)
util.Random.setSeed(4)
General Case
Simpler Case
Trivial Case
def fact(n:Int):Int =
def fib(n:Int):Int =

def summation(n:Int):Int =
def countDown(n:Int):
def sumInputPositive( ):Int =

def sumCountAverage ( ): (Int, Int, Double) =




 PCS1-Ch-5-Recursion  Slides  PDF

TomH-HW-5-Recursion-Student.zip

Read The Chapter 5

 


PCS1-Ch-5-Recursion-HW

# 13

10/5

TH


Chapter 6
One Dimensional Arrays
import io.StdIn._
Optional Arguments
Arrays & Lists ==> containers
Scala Arrays & Lists ==> Sequences
Tuple - data may be of different types
Array/List - data of same type
 var arr = Array[Int] (7,4,6,2)
Array is contiguous block of memory
Array elements numbered from 0
arr(2) = 22
Loop To Graphically Display Array
def displayIntArray(arr:Array[int])
Arrays are Mutable
Out Of Bound Errors
PCS1-Ch-6A-Array-Utilities  Slides  PDF

TomH-HW-6A-Array-Utilities-Student.zip

Read  Chapter 6


PCS1-Ch-6A-Array-Utilities-HW

# 14

10/10

TU

 
Chapter 6
Built In Array & List Functions
System.nanoTime
arr.drop(n)
arr.init
arr.head
arr.last
arr.slice(f,l)
arr.splitAt(n)
arr.take(n)
arr,tajeRight(n)
arr.contains(n)
arr.isEmpty
arr.nonEmpty
arr.startsWith(arr)
srr.indexOf(n)
arr.diff(arr1)
arr.reverse

 

PCS1-Ch-6B-Array-Sequential-Bubble  Slides  PDF

TomH-HW-6B-Array-Sequential-Bubble-Student.zip
PCS1-Ch-6B-Array-Sequential-Bubble-HW

# 15

10/12

TH

 

Quiz On Recursive & Non-Recursive Functions
(4A, 4B, 4C, 5)

Review Array Processing

BubbleSort1
BubbleSort2
BubbleSort3

Big O Notation
Order N
Order N
2
Order N Log N

 

 

CS1-Ch-6C-Array-Insertion-Menu-HW


# 16

10/17

TU


Binary Search Thoughts
Insertion Sort Thoughts

Lists & List Processing
var arr = Array.tabulate(4)(I => 0)
val arr = Array.tabulate(5)(n => 1)
val arr = Array.tabulate(10)(n => n)
val arr = Array.tabulate(11)(n => n -5)

for(item <- arr) printf ("%5d", item)
Functional Programming Uses Lists
Lists & Arrays Are Parametric Types
var lst = List (2,3,4)
var lst = List[Int] = Nil
var lst = 3 :: 4 :: 5 :: Nil
Cons ==> ::
Nil at end of list
1::(2::(3::Nil))
val names = List ("Eggen", "Myers", "Massingil", "Chang")

Create Function readInts
Evoke Function readInts
lst.indexOf(n)
lst.find(_>0)
lst.find(_==4)
lst.find(_!=4)
var lst = List.tabulate(4)(I => 0)

val lst = List.tabulate(5)(n => 1)
val lst = List.tabulate(10)(n => n)
val lst = List.tabulate(11)(n => n -5)
var lst = List.tabulate(5)(i => 2*i + 1)
var lst = List.tabulate(5)(k => k * 3 - 1)
println( lst(2) + " - " + lst(3) + " - " + lst(1) )
val lst = List.tabulate(5)(N => N * 2 + 1)
for(item <- lst) printf ("%5d", item)
lst.drop(n)
lst.init
lst.head
lst.last
lst.slice(2, 5)
lst.splitAt(3)
lst.take(3)
lst.takeRight(3)
lst.contains(5)
var l:List[Int] = Nil
l.isEmpty
l.nonEmpty lst.nonEmpty
lst.startsWith(List(1,3))
lst.indexOf(7)
lst.lastIndexOf(7)
lst.diff(List(1, 2, 3))
lst.reverse



   
PCS1-Ch-6E-Lists  Slides  PDF


Read Chapter 7



PCS1-Ch-6E-Arrays-Lists-HW

Add Binary Search To
Lab 6C
Due 10/24

Add Insertion Sort
To Lab 6C
Due 10/24




# 17

10/19

TH


Quiz On Arrays & Built-In Array Functions
Study Our Arrays Too! (6A, 6B. 6C)

Chapter 7
Iteration 1 to 5
Iteration.sum (1 to 5).sum
Iteration.product (1 to 5).product

Loop Iteration Lists/Arrays
for(elem <- lst) printf ("%5d", elem)
val V = Vector (1, 2, 3)

Vectors Immutable
val L = List (1, 2, 3)
Lists Immutable
var A = Array(1,2,3)

Arrays Mutable
val v4 = v3 :+ 4
val v5 = v3 :+ 4 :+ 5
var vec = for (i <- 1 to 6) yield 0
var vec = for (i <- 1 to 6) yield 5
var vec = for (i <- 1 to 6) yield 2 * i + 3
printf(vec(2))
for (elem <- vec) printf ("%5d", elem)

Vectors --> Better Parallel Processing
Multiple Generators
for ( i <- 1 to 5; c <- 'A' to 'C' ) println ( i + " " + c )
Multidimensional Arrays
var matrix1 = Array ( Array(1,2,3), Array(4,5,6) )
var noCols = matrix1 .length
var noCols = matrix1 (0).length
def displayMatrix(arr:Array[Array[Int]], message:String="")

Adding Matricies
Subtraction Matricies
Multiplying Matricies


PCS1-Ch-7A-2-Dim-Arrays-Vectirs  Slides  PDF

    Read Chapter 7

Chapter 7 is the end of the material for Exam II

HW-6D-Code.zip
PCS1-Ch-6D-Array-Insertion-Binary-Search-HW

PCS1-Ch-7A-2-Dim-Arrays-Vectors-HW
Due 10/26

# 18

10/24

TU

Review

Intro To Text Files




PCS1-Ch-9A-Text-File-Basics  Slides  PDF
 

Chapter 8 is  Loops
We interfused the content earlier

Read Chapter 9


   
PCS1-Ch-7A-2-Dim-Arrays-Loops-HW
Due 10/26


PCS1-Ch-9A-Text-File-Basics-HW
Due 11/2

# 19

10/26

TH

Text Files
Cesar Encryption
TomH-HW-9B.zip
PCS1-Ch-9A-Text-File-Basics-HW
Due 11/2

PCS1-Ch-9B-Encrypt-Decrypt-HW

Due 11/7

Study For Your Exam

# 20

10/31

TU


Exam II



PCS1-Ch-9A-Text-File-Basics-HW
Due 11/2

PCS1-Ch-9B-Encrypt-Decrypt-HW
Due 11/7

# 21

11/2

TH

Prparing For ScalaFX

Introduction To Classes

PCS1-Ch-10A-Classes  Slides  PDF

Eclipse-Windows-ScalaFX

25/25 Extra Credit

Read Chapter 10


PCS1-Ch-9B-Encrypt-Decrypt-HW
Due 11/7

# 22

11/7

TU




Watch & Take Good Notes

First GUI

Scene & Nodes

Location & Multiple Nodes

   
 

# 23

11/9

TH

   
Scalafx

More About Classes

 

Watch & Take Good Notes

Events & Handlers

PCS1-Ch-11A-ScalaFX-HW

 


# 24

11/14

TU

Scalafx

In-Class-Lab

Watch & Take Good Notes

Text Controls

Text Control Interactions

Button Controls

 

   PCS1-Ch-11B-ScalaFX-HW
In Class Lab


# 25

11/16

TH

 

//Review PrintWriter
import java.io._
var op = new PrintWriter(new File("Julia.txt"))
op.write("Julia Riley\n")
for (recNo <- 1 to 5)
{
   op.write(recNo.toString + "\n")
}
op.close

class Stack
Push, Pop, Empty, Display
LIFO - Last In First Out
FIFO - First In First Out

Prefix
Infix
Postfix

What May You Use On The Practicum Portion Of The Exam?
Practicum Time?



   Watch & Take Good Notes

List Selection Controls


List Selection Interactions

Picker Controls

Picker Control Interactions

Table View I

Table View II

Tree View

Menus I

Menus 2

Menus 3

PCS1-Ch-10A-Classes-Slides

PCS1-Ch-11C-ScalaFX-HW

 


# 26

11/21

TU


Work On Scalafx Outside Of Class



   Watch & Take Good Notes



Menus 4


Picker Controls

Layouts, Panes, & Border Panes

Graphics & Basic Shapes

   
Polygons

Curve Shapes


 
  

 


# 27

11/23

TH


Thanksgiving

 

 
PCS1-Ch-10B-Infix-Postfix-Prefix-Slides

 


# 28

11/28

TU


Prefix
Infix
Postfix

Create Postfix & Prefix Expressions
Stack ==> Verify (), {}, & [] are OK
Stack ==> Evaluate Postfix
Stack ==> Form Postfix




PCS1-Ch-10B-Infix-Postfix-Prefix-Slides


PCS1-Ch-11C-ScalaFX-HW
Will Not Be Accepted After 12/5

PCS1-Ch-11D-ScalaFX-HW
Will Not Be Accepted After 12/5



# 29

11/30

TH


Exam III
 
PCS1-Ch-11E-ScalaFX-HW
Will Not Be Accepted After 12/5

PCS1-Ch-12A-ScalaFX-HW
Will Not Be Accepted After 12/5

# 30

12/5

TU

     In Class Graphics Problem
You may use your hand written notes &
Ch-11A, Ch-11B, Ch-11C, Ch-11D, Ch-11E, Ch-12A





 
 

R

12/6

M





    READING DAY






    READING DAY






    READING DAY



R

12/7

TU





    READING DAY






    READING DAY






    READING DAY


+

No Late Assignments Will Be Accepted After Noon on 12/6