Laboratory 6

Whiling away the lab

Week of 14 March, 2005


Home | Resources | Homeworks | Slides | Labs | Contacts | Submit | Forums | Private


Objective

Being able to repeatedly execute statements of interest is a powerful programming mechanism. In this laboratory you will gain practice with the Java while looping statement.

 

Key Concepts

 

Getting Started

Using the procedures in the previous laboratories (i.e. right-click on the link and select "save as"), copy the files SeriesSum.java, IntervalSum.java, Upper.java, CharacterCounting.java, One.txt and Two.txt for your manipulation.  All four of the Java files need to be submitted for this lab.

 

Determining sums of numbers

The first two while examples are concerned with computing sums of consecutive numbers. Although simple in nature, they illustrate nicely while loop behavior.

 

Text conversion

Often programs analyze text to see if it has some particular property. The next example program counts the number of uppercase letters in the text that it extracts. The program extracts its values from the standard input, which by default comes from the keyboard.

Java is great!
This course is FANTASTIC.
This Line Has a Lot of Uppercase Letters
 

 

Using Input File Streams

Often programs examine data files. In this exercise, you will learn to use input file streams to extract data from a file. Other types of file processing will be considered later.

 

Finishing up