Computer Science I
Dr. Tom Hicks - Trinity University - CSCI 1320-  Fall 2020

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


P
R
E
-
S
E
M
E
S
T
E
R




Maybe Prepare Your Computer
Before Semester Begins?

 

Install vdi.trinity.edu

Install ZOOM

How o Upload Files To Mars DropBox
(VMWare Installation Directions Included)

Transferring-Files-Into-My-Mars-DropBox-From-Win.pdf

Transferring-Files-Into-My-Mars-DropBox-From-Mac.pdf

Transferring-Files-Into-My-Mars-DropBox-From-Linux.pdf
# Topic(s) Reading Assignments
 & Handouts
Laboratory Assignment

#1

8/25

TU


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
 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-Slides

Read Chapter 1

 

 

CH-1A-Intro-To-CS-Scala-HW.zip

 


# 2

8/27

TH


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



Ch-2A-Intro-Linux-Slides

Read Chapter 2

Ch-2A-Linux-HW.zip


# 3

9/1

TU


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


 

PCS1-Ch-2B-Scala-Basics-Slides.pdf PCS1-Ch-2B-Scala-Basics-HW.zip

# 4

9/3

TH

  

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-Slides.pdf



PCS1-Ch-2C-Numeration-HW.zip


# 5

9/8

TU

 

Install Scala

Practice

 


Practice 2A, 2B, & 2C

# 6

9/10

TH


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-Slides.pdf

 

Read Chapter 3

Installing-Java-Scala-On-Windows-10.pdf

Installing-Java-Scala-On-A-Mac.pdf

 

 

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


# 7

9/15

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-Slides.pdf

Read Chapter 3



PCS1-Ch-3B-Basic-Loops-HW.zip

# 8

9/17

TH

 

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-Slides.pdf

Read Chapter 4


PCS1-Ch-4A-Functions-1.zip


# 9

9/22

TU

 

GetInt Function

Creating A Complex Function
In Stages

Read Chapter 4


Study For Exam

# 10

9/24

TH

   Exam I  


Read Chapter 4

PCS1-Ch-4B-Functions-2.zip

# 11

9/29

TU

 

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

 


PCS1-Ch-4C-Functions-3-Slides.pdf

Read Chapter 4
PCS1-Ch-4C-Functions-3.zip
Due 10/6

# 12

10/1

TH



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

Read Chapter 5
PCS1-Ch-5-Recursion.zip
Due 10/6

# 13

10/6

TU

 
Chapter 6-A
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



 

 


# 14

10/8

TH


Chapter 6-A
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

PCS1-Ch-6A-Array-Utilities-HW.zip
Do Diagnostic Levels 1-12 By 10/15

# 15

10/13

TU

More Array Processing

PCS1-Ch-6A-Array-Utilities-Slides.pdf
PCS1-Ch-6A-Array-Utilities-HW.zip
Do Diagnostic Levels 1-12 By 10/15

# 16

10/15

TH

 
Chapter 6-B
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


PCS1-Ch-6B-Array-Sequential-Bubble-HW.zip
Do Diagnostic Levels 1-16 By 10/15


# 17

10/20

TU


Binary Search
Sequential Search
val x = Array.range(1, 10)
val x = Array.range(0, 10, 2)
val x = Array.fill(3)("foo")
val x = Array.tabulate(5)(n => n * n)
val x = "Hello".toArray
val xs = Array.tabulate(5)(_ * 2)
Recordings/Help-Session-1.mp4



   
Work On Non-Recursive
Binary Search


# 18

10/22

TH

EventLoop
Menu Processing



Recordings/Help-Session-2.mp4
   

PCS1-Ch-6C.zip


# 19

10/27

TU




 














# 20

10/29

TH


   Exam II  



 
# 21

11/3

TU

 
Exam II











# 22

11/5

TH





   
 

# 23

11/10

TU




 

# 24

11/12

TH

   

 








 

# 25

11/17

TU

 



 
 

# 26

11/19

TH








# 27

11/24

TU


THANKSGIVING

   

   

# 28

11/26

TH

THANKSGIVING

   

# 29

12/1

TU

   Exam III 

   

# 30

12/8

TH

 

   




RD

12/9

M




READING DAY





    READING DAY





    READING DAY



RD

12/10

TU



    READING DAY




    READING DAY




    READING DAY


+

No Assignments Will Be Accepted After Noon on 12/9