COMP 170 Scala
1.0
Index
Site
1. Context
1.1. Motivation for This Book
1.2. Resources Online
1.3. Downloading Text, Source Code, and Videos
1.4. Computer Science, Broadly
1.5. Chapter Review Questions
2. C# Data and Operations
2.1. A Sample Scala Program
2.2. Lab: Editing, Compiling, and Running with Xamarin Studio
2.3. Arithmetic
2.4. Variables and Assignment
2.5. Syntax Template Typography
2.6. Strings, Part I
2.7. Writing to the Console
2.8. C# Program Structure
2.9. Combining Input and Output
2.10. String Special Cases
2.11. Substitutions in Console.WriteLine
2.12. Value Types and Conversions
2.13. Learning to Solve Problems
2.14. Lab: Division Sentences
2.15. Chapter Review Questions
3. Defining Functions of your Own
3.1. A First Function Definition
3.2. Multiple Function Definitions
3.3. Function Parameters
3.4. Multiple Function Parameters
3.5. Returned Function Values
3.6. Two Roles: Writer and Consumer of Functions
3.7. Local Scope
3.8. Static Variables
3.9. Not using Return Values
3.10. Library Classes
3.11. Static Function Summary
3.12. Chapter Review Questions
4. Basic String Operations
4.1. String Indexing
4.2. Some Instance Methods and the Length Property
4.3. A Creative Problem Solution
4.4. Lab: String Operations
4.5. Chapter Review Questions
5. Decisions
5.1. Conditions I
5.2. Simple
if
Statements
5.3.
if
-
else
Statements
5.4. More Conditional Expressions
5.5. Multiple Tests and
if
-
else
Statements
5.6. If-statement Pitfalls
5.7. Compound Boolean Expressions
5.8. Nested
if
Statements
5.9. Chapter Review Questions
6. While Loops
6.1. While-Statements
6.2. While-Statements with Sequences
6.3. Interactive
while
Loops
6.4. Short-Circuiting && and ||
6.5. While Examples
6.6. More String Methods
6.7. User Input: UI
6.8. Greatest Common Divisor
6.9. Do-While Loops
6.10. Number Guessing Game Lab
6.11. Chapter Review Questions
7. Foreach Loops
7.1.
foreach
Syntax
7.2.
foreach
Examples
7.3. Chapter Review Questions
8. For Loops
8.1. For-Statement Syntax
8.2. Examples With
for
Statements
8.3. Lab: Loops
8.4. Chapter Review Questions
9. Files, Paths, and Directories
9.1. Files As Streams
9.2. Writing Files
9.3. Reading Files
9.4. Path Strings
9.5. Directory Class
9.6. File Class
9.7. Command Line Execution
9.8. FIO Helper Class
9.9. Chapter Review Questions
10. Arrays
10.1. One Dimensional Arrays
10.2. Musical Scales and Arrays
10.3. Linear Searching
10.4. Sorting Algorithms
10.5. Binary Searching
10.6. Lab: Arrays
10.7. Lab: Performance
10.8. Multi-dimensional Arrays
10.9. Chapter Review Questions
11. Lists
11.1. List Syntax
11.2. .Net Library (API)
11.3. Chapter Review Questions
12. Dictionaries
12.1. Dictionary Syntax
12.2. Dictionary Efficiency
12.3. Dictionary Examples
12.4. Lab: File Data and Collections
12.5. Chapter Review Questions
13. Classes and Object-Oriented Programming
13.1. A First Example of Class Instances: Contact
13.2. Class Instance Examples
13.3. The Rational Class
13.4. Planning A Class Structure
13.5. Classes And Structs
13.6. Defining Operators (Optional)
13.7. Chapter Review Questions
14. Testing
14.1. Assertions
14.2. Attributes
14.3. Testing the Constructor
14.4. Testing Rational Comparisons
14.5. Testing Rational Arithmetic
14.6. Testing Rational Conversions (to other types)
14.7. Testing the Parsing Feature
14.8. Running the NUnit Tests
15. Interfaces
15.1. Rationals Revisited
15.2. csproject Revisited
15.3. Chapter Review Questions
16. Recursion
17. Data Structures
18. Appendix
18.1. Development Tools
18.2. Xamarin Studio
18.3. Command Line Introduction
18.4. Precedence of Operators
18.5. Homework: Grade Calculation
18.6. Homework: Grade Calculation from Individual Scores
18.7. Homework: Grade File
18.8. Homework: Book List
18.9. Group Project
18.10. Lab: Version Control
18.11. Mercurial and Teamwork
18.12. Acknowledgments
Page
2. C# Data and Operations
Source
2. C# Data and Operations
ΒΆ
2.1. A Sample Scala Program
2.2. Lab: Editing, Compiling, and Running with Xamarin Studio
2.2.1. Goals
2.2.2. Steps
2.2.2.1. For further reinforcement
2.3. Arithmetic
2.3.1. Csharp
2.3.2. Division and Remainders
2.3.2.1. Divisible by 17 Exercise
2.3.2.2. Mixed Arithmetic Exercise
2.4. Variables and Assignment
2.4.1. Literals and Identifiers
2.4.1.1. Assignment Exercise
2.4.1.2. Another Assignment Exercise
2.5. Syntax Template Typography
2.5.1. Declaration Syntax Options
2.5.2. Assignment Syntax
2.6. Strings, Part I
2.6.1. String Concatenation
2.6.1.1. Four Copies Exercise
2.6.1.2. Sum String Exercise
2.6.1.3. Ints and Strings Added
2.7. Writing to the Console
2.8. C# Program Structure
2.8.1. Indentation Help
2.8.2. Compiler Error Help
2.8.3. Sequential Execution
2.8.3.1. Play Computer Exercise
2.8.3.2. Another Play Computer Exercise
2.9. Combining Input and Output
2.9.1. Reading from the Keyboard
2.9.2. Numbers and Strings of Digits
2.9.3. Example Projects and the Source Repository
2.9.4. Running our Xamarin Studio Examples Solution
2.9.5. Copying and Modifying Our Example Xamarin Studio Projects
2.9.5.1. Interview Exercise/Example
2.9.5.2. Exercise for Addition
2.9.5.3. Exercise for Quotients
2.10. String Special Cases
2.10.1. Multiline String Exercise
2.11. Substitutions in Console.WriteLine
2.11.1. Output With
+
2.11.2. String Format Operation
2.11.2.1. Format Reading Exercise
2.11.2.2. Exercise for Format
2.11.2.3. Madlib Exercise
2.11.3. Overloading
2.12. Value Types and Conversions
2.12.1. Type int
2.12.2. Type long
2.12.3. Type double
2.12.4. Numeric Types and Limits
2.12.5. Casting
2.12.6. Type char
2.12.7. Type Boolean or bool
2.12.8. Overflow to Positive Exercise
2.13. Learning to Solve Problems
2.14. Lab: Division Sentences
2.14.1. Overview
2.14.2. Requirements
2.14.3. Xamarin Studio Reminders and Fixes
2.15. Chapter Review Questions