CSE 283 Introduction to Object Oriented Design

Barbara Nostrand, Ph.D.


CSE 283 Labs
Welcome to the site for CSE 283 Labs!

 

Lab 10: Projects

Prev | Next | Lab 10

Objectives

1. Practice performing file I/O.
2. Practice designing and implementing programs.

Introduction

Each of the following projects involves the use of file I/O. Your instructor will tell you which of them you are to do, and will provide any input files to be used to test your program.

Projects

10.1. Write a program that reads from a file of real numbers, and displays the minimum, maximum, average, and range of the numbers in the file. The user should be able to enter the name of the input file from the keyboard.

10.2. Write a program called List that reads the contents of a file and creates an exact copy of the file, except that each line is numbered. For example, if the input file contains the following text:

   'Twas brillig, and the slithy toves
      Did gyre and gimble in the wabe;
   All mimsy were the borogoves,
      And the mome raths outgrabe.
                           - Lewis Carroll

then the output file should appear something like this:

   1: 'Twas brillig, and the slithy toves
   2:    Did gyre and gimble in the wabe;
   3: All mimsy were the borogoves,
   4:    And the mome raths outgrabe.
   5:                         - Lewis Carroll

The user should be able to enter the names of the input and output files from the keyboard.

10.3. Using the pigLatin() method we wrote in Lab 6,  write a program that reads a file of words and translates each word in that file into pig latin.  The user should be able to enter the names of the input and output files from the keyboard. 

10.4. Write a text-analysis program that reads an essay or composition stored in a text file, and determines the number of words, the number of sentences, the average number of words per sentence, the average number of letters per word, and a complexity rating, using:

   complexity = 0.5 * averageSentenceLength + 0.5 * averageWordLength.

Based on these calculations, your program should assess the writing level of the essay as:

Grammar School if complexity < 6
Junior High if 6 <= complexity < 7
High School if 7 <= complexity < 8
College if 8 <= complexity < 9
Graduate if complexity >= 9

The user should be able to enter the name of the input file from the keyboard.

Don't forget to clean up your directory when you are all finished...

Prev | Next | Lab 10

 
  Home

Schedule

Help

Lab 0

Lab 1

Lab 2

Lab 3

Lab 4

Lab 5

Lab 6

Lab 7-8

Lab 9

Lab 10

Lab 11

Lab 12

Lab 13






Last modified: 2007 OCT 22
bnostran@syr.edu