Tuesday, December 20, 2011

Exam #3 results

The final exams are graded. Due to time constraints, I counted the best three of four programs towards your final score. Also, there was one question on the sorts and searches page that I tossed since everyone missed it.

I will likely post final grades tomorrow night, after the last call deadline.

Grade distribution follows:

Last call

Comp 137 officially ended with the end of last night's exam. In the best interest of certain students, I am willing to accept lab submissions up until 6pm tomorrow (Wednesday) evening.

Any materials not in my Brookdale inbox by six o'clock tomorrow will be recorded as not completed. If you have not yet sent all of the minimum required lab assignments (labs 1-10), I strongly urge you to do so immediately.

Any student who does not successfully complete these minimum assignments will fail this course, regardless of test grades.

Tuesday, December 13, 2011

Lab 10 - counting digits

This assignment requires that you generate 100 pseudo-random numbers, between 0 and 9, inclusive. You need to use an array to keep track of how many times each digit is generated. The most efficient way to do this is to create one ten-integer array, named counts, and to increment the contents of the appropriate array location each time its value is randomly generated. That is, each time your code generates a 0, you increment the contents of counts[0]; each time your code generates a 1, you increment the contents of counts[1]; and so on.

Remember to seed your rand by calling srand first.

Monday, December 12, 2011

Homework 5 - average scores

Write a program that reads in an unknown number of integer values from a text file and stores them in a vector. Display the unsorted values then sort and sum the values. Display the sorted values, the average value, and total count to the user. Make sure to use an iterator to process the vector.

   string getFilename(string prompt)
   void readValuesFromFile(string filename,
      vector<int> &values)
   void displayValues(string leader,
      vector<int> &values,
      vector<int>::iterator pos)
   int sumValues(vector<int> &values,
      vector<int>::iterator pos)

Registration reminder

Register for the spring term before the end of the fall semester! You will have a better selection of classes and sections if you do. Also, you should be aware that if you wait too long, there is the possibility that a section you want could be cancelled due to insufficient enrollment.

Tuition payments are not due until January 5th.

Sorting

Sorting algorithms can be implemented in almost any programming language but have you ever considered that they could be implemented in folk dance?

Reading assignment - chapter 10

Read chapter 10, Applications of Arrays (Searching and Sorting) and the vector Type.

Due Date
Monday, December 12th, 6:00pm

Saturday, December 10, 2011

Wednesday, December 7, 2011

Exam #3 programming problems

I strongly suggest that each student develop a C++ solution to the following problems in preparation for the coding portion of the first exam. While I do not promise that the practical part of the exam will be *exactly* the same as any one of these problems, the actual test question will at least be very similar to one or more of these practice problems.

Watch this post - more to come!

Exam #3 preparation

Your final exam is scheduled in class for December 19th. Keep an eye on the blog for test preparation suggestions. Programming problems on exams are often very similar to the end of chapter exercises.

Monday, December 5, 2011

Lab 13 - climate tracker

As one of the requirements to earn an A- or higher, you must complete exercise 9 on pp 541-542 regarding temperature highs, lows, and averages. Please note that I have changed the requirements from the exercise in the book slightly: you are to track a single week's data, not an entire year's.

Updated!

You need to write three functions; these are their headers:

Lab 9 - election day

You are to complete exercise 7, p540, writing a program which contains four user-defined functions. One function reads in the data from the user; one sums the votes received by all candidates; one calculates the percentage of the total received by each individual candidate; and one displays a table of the final results.

These are the headers: