CSC 215

Fall '98

Section 701

Assignments

Week 1: September 15th

By September 15th: Please read chapter 1 in the textbook.

By September 22nd: Edit, compile, and run a program to print "Goodbye, world!" in the same way that the program hello.cpp prints "Hello, world!". Call the file containing your program goodbye.cpp. Use the program hello.cpp as a model. (10 points)

By September 29th: Please read chapters 2 and 3 in the textbook.

By September 30th: Edit, compile, and run a program called metric1.cpp that converts a measurement in inches to a measurement in meters. Your program should ask for the measure in inches, convert that to meters, and print out the number of meters. Note: There are 39.36 inches to a meter. Use convert1.cpp as a model.

By September 30th: Edit, compile, and run a program called metric2.cpp that converts either a measurement in inches or a measurement in feet to a measurement in meters. Your program should first ask for which sort of measurement is being converted. Use a character variable for this. It should then calculate the correct conversion and print that out. Use convert2.cpp as a model.

By October 6th: Please read chapter 4 in the textbook.

By October 7th: Edit, compile, and run a program called metric3.cpp that performs exactly the same conversion as metric2.cpp but that uses a separate function to do the conversion. Use convert4.cpp as a model. In addition, write the program so that it accepts both upper and lower case input and so that it prints an error message if the user specifies an unknown conversion type.

By October 7th: Edit, compile, and run a program called metric4.cpp that allows a user to perform conversions repeatedly. It should (at least) have a separate function to perform the conversion. Use convert5.cpp as a model.

By October 13th: Please read chapter 12 in the textbook.

By October 16th: Edit, compile, and run a program called loan1.cpp that repeatedly:

Compute the total amount paid in a separate function that is passed as parameters all the information it needs to do the computation and then returns the total amount paid. There are many ways to compute this total. One is to start with an amount set to the principal and then add to that amount the interest that accrues year by year. Another way is to use the following formula: total = principal*(1+rate)term.

In both cases, you will need a loop. If you use the second approach, I recommend writing a separate function for computing powers.

By October 20th: Edit, compile, and run a program called loan2.cpp that does the same thing as loan1.cpp but that uses three separate functions to get the required input. Make sure that the functions verify the input (eg, the principal amount should be greater than zero).

By October 27th: Please read chapter 5 in the textbook.

By October 30th: Edit, compile, and run a program called maxfile.cpp that reads from a file called posints.txt a list of positive integers and outputs the maximum. Use as a model the program sumfile.cpp.

By November 6th: Edit, compile, and run a program called charcount.cpp that reads text from a file whose name is supplied by the user and outputs out the number of lowercase letters and the number of uppercase letters. Some additional points:

You may write this program as a single main function. If you wish, you can make it more modular by specifying a separate function for opening the file.

By November 14th: Edit, compile, and run a program called student.cpp that reads input from a file containing grade data, computes various statistics on the scores, and prints out a report.

Your program should request the name of the input file. Each line of the input file will have the following items:

For each student, your program should print one line containing: After all of the student results are printed, print a summary line at the bottom giving: The program should be modular, that is, it should consist of a main function that calls three functions: By November 23rd: Edit, compile, and run a program called filestats.cpp that reads input from a file containing integers into an integer array and prints out: Write it so that there are at least the following functions:

Input and output files

An input file student.txt is now available with which to test your program.

Late policy: A programming assignment loses 10% for each day that it's late; that is, if an assignment is originally worth 20 points, it will be graded out of 18 points if it's late one day, out of 16 points if it's late two days, and so forth.

How to submit a program: Click the submit button at the bottom of this page. Please note that you need to have your shrike account activated before you can submit anything. If you haven't done so, go to ID Services and do so as soon as possible.

Submit an assignment