Back To: [Trinity College]
[Computer Science Department]
[CPSC 115 Introduction to Computing] Code Examples for CPSC 115 Introduction to Computing
Code Examples for CPSC-115 Introduction to Computing
GUT
Inheritance
Branching Code
- 10-02-08 OutputToFile.java - Program that reads strings in from file until the end of the file is reached.
- 10-02-08 InputFromFile.java - Program that reads strings in from file until the end of the file is reached.
- 10-02-08 InputStudentGrades.java - Program that reads in student names followed by three integer grades to show how to read data of mixed types from file.
- 09-30-08 NestedLoop.java - Program that shows the nested loop implementation for processing an unknown number of students with an unknown number of grades.
- 09-30-08 ProteinTest.java - Simple program that we developed in class to show the use of a for loop to step through the amino acids in a protein.
- 09-25-08 WhileLoopTest.java - Simple program that we developed in class to show the use of a while loop.
- 09-25-08 DoLoopTest.java - Simple program that we developed in class to show the use of a do loop.
- 09-23-08 Divisible.java - Simple program that we developed in class to show the use of a switch statement that contains an operation in the switch condition.
- 09-23-08 GradeSwitch.java - Simple program that we developed in class to show the use of a switch statement. Shows printing a statement based on a letter grade.
- 09-18-08 IfTest.java - Simple program that we developed in class to show nested if-then. Shows printing the letter grade that corresponds to an integer grade.
- 09-18-08 TicketCost.java - Simple program that we developed in class to show if-then-else structure.
Sequential (Simple) Code
- 09-17-08 MemoryTest.java - Simple program that we developed in lab. Shows the difference between primitive types and instances of classes.
- 09-16-08 TypeTest.java - Simple program that we developed in class. Shows the attempted narrowing of variables and calling of a few String methods.
- 09-16-08 ScannerTest.java - Demonstrates the proper use of the Scanner class to read input from the keyboard. Shows the proper use of the nextLine method to "eat" the extra carriage return when reading string data after numeric data.
- 9-17-08 ScannerTest1.java - Demonstrates the use of two instances of the Scanner class to read input from the keyboard. One instance reads string data and one reads numeric data and the other to read strings. This gets us around the problem of having to "eat" the extra carriage return when reading string data after numeric data.
- 09-03-08 TheClass.java - Simple program that we developed in Lab 1. Uses a string, calls two string methods, and outputs several lines.
- 09-11-08 VideoCalculator.java - One solution to lab 2 that shows the use of information for three videos as used on YouTube. Information includes the video id, author, length in seconds, size in MB, rating and a tag. Note the organization of the code, the use of comments and white space.
Send Dr. Ellis Mail.
http://www.cs.trincoll.edu/~hellis2/CPSC115/codeexamples.html
Copyright © Heidi J. C. Ellis