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:

Monday, November 28, 2011

Reading assignment - chapter 9 cont'd

Read chapter 9, Arrays and Strings.

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

Lab 8 - string manipulation

You are to complete Lab 8, the programming assignment on page 11 of the course syllabus. You will need to use several of the functions of the string class in order to complete this assignment. I am inserting notes for the functions required in the bullet list of requirements below.

Your C++ program must:

Saturday, November 26, 2011

Reading assignment - chapter 9

Read chapter 9, Arrays and Strings, pages 496-502.

Due Date
Monday, November 28th, 6:00pm

Reading assignment - chapter 8

Read chapter 8, User-Defined Simple Data Types, Namespaces, and the string Type.

Due Date
Monday, November 28th, 6:00pm

Wednesday, November 23, 2011

Exam #2 program submission

As of dinner time last night, connectivity was restored to campus. The IT staff continues to monitor the situation any signs of instability or trouble and Brookdale email seems to be working just fine now.

Please be sure to email me your second exam source code files. I will be making my comments back to you in return emails.

Tuesday, November 22, 2011

Exam #2 results

For those who came to class and took the second exam, the tests are graded and five students earned full credit.

Since only half the class has taken the exam, I am not going to post solutions yet.

Grade distribution follows:

Friday, November 18, 2011

Exam #2 programming problems - part 2

I strongly suggest that each student develop a C++ solution to the this second set of practice problems in preparation for the coding portion of the second 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.

Note:
Keep an eye on this post as additional problems are highly likely!

Monday, November 14, 2011

Exam #2 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.

Sunday, November 13, 2011

Exam #2 preparation

Your second exam, on chapters 5 through 7 of the textbook, is scheduled for next Tuesday, November 22nd. Keep an eye on the blog this week for test preparation suggestions. Programming problems on exams are often very similar to the end of chapter exercises.

Monday, November 7, 2011

String manipulations

For lab 12, you need to request a date from the user, in the format "mm-dd-yyyy". This is a string but you will need to parse it into its component integers. This is how you go about doing that.

File access and user input

Usually you don't want to hard-code filenames into your projects: you want to let the user decide what the filenames should be. Here is an easy way to do just that.

Lab 12 - day of year

As one of the requirements to earn a B- or higher, you must complete exercise 5 on p 409, a program to calculate which day of the year the user entered. At the very minimum, you will need to write two functions. These are their headers:

   bool isLeapYear(int y)
   int countDays(int m, int d, bool leap)

Lab 7 - calculating grades

You are to complete exercise 9, pp 409-410, writing a program which contains three user-defined functions: generateOutputFile, calculateAverage, and calculateGrade. Please note that I have changed the requirements from the exercise in the book slightly, in order to have a more intuitive solution. These are the headers:

   void calculateAverage(ifstream& fin,
      ofstream& fout, double& average)
   char calculateGrade(double average)
   bool generateOutputFile()

Sunday, November 6, 2011

Reading assignment - chapter 7

Read chapter 7, User-Defined Functions II.

Due Date
Monday, November 7th, 6:00pm

Saturday, November 5, 2011

Register for classes

Priority registration is underway! In order to give yourself the best chance of getting all of the classes you need as well as the days and class meeting times you prefer, you should register early.

Tuition payments are not due until January 5th.

Friday, November 4, 2011

Jason and the for loop


No doubt the teacher noticed that his for loop printed all of the output on a single line. Yeah, that's why she looks so unimpressed.

Wednesday, November 2, 2011

Monday, October 31, 2011

Lab 11 - circle calculations

As one of the requirements to earn a B- or higher, you must complete exercise 6 on pp 341-342, which requires you to solve a set of problems regarding the calculation of properties of a circle.

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

   double radius(double x1, double y1,
                 double x2, double y2)
   double circumference(double r)
   double area(double r)

Homework 4 - is vowel

You are to complete exercise 2, p 340, writing a program which contains a user-defined function, isVowel. This is its header:

   bool isVowel(char c)

The user should be prompted to enter a character. Your function isVowel must determine whether the character is a vowel or not. Your code should recognize both uppercase and lowercase vowels.

Lab 6 - reverse digits function

You are to complete exercise 5, p 341, writing a program which contains a user-defined function, reverseDigit. This is its header:

   int reverseDigit(int value)

This problem should seem familiar: lab 5 required you to reverse the digits of an integer as well. The difference is that in the previous program you merely had to strip off the digits of the input number one at a time, working from right to left, and print them at the command line; in this program, not only do you need to reverse the digits, you need to store the digits as an integer. You will be doing the work in your user-defined function and returning the reversed number to main.

Saturday, October 29, 2011

Exam #1 results

I have finished grading the first exam. Several students did very well prior to the application of the curve. Several students did not. The five no-shows (Fs in the table) must see me in order to make arrangements for make up exams.

Grade distribution follows:

Wednesday, October 26, 2011

Exam #1 source code

These are solutions to the programming problems from this week's exam. Please note that the methods presented are not the only way to solve the problems assigned. If you used a different approach and your code generated a valid answer, you could still earn full credit.

Exam #1 short answers

I am still in the process of grading the exams from Monday night. In the meanwhile, you might like to review the following solutions to the short answer section of the exam. I am planning to also post some source code solutions to the programming problems presented on the test.

Tuesday, October 25, 2011

Reading assignment - chapter 6

Read chapter 6, User-Defined Functions I.

Due Date
Monday, October 31st, 6:00pm

Sunday, October 23, 2011

Whitespace... it's free!

I was reviewing today's batch of source code submissions and I noticed that an awful lot of people were not making good use of their whitespace. Please observe the following rules in your code:

Thursday, October 20, 2011

Exam #1 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.

Wednesday, October 19, 2011

Exam #1 pretest results

I reviewed Monday's pretest answers today. Looking at only the first page, the seven multiple choice questions, the class average was 51.6%. Three students tied for the highest score of 71.4%. All other scores were below 60%

Grade distribution follows:

Exam #1 pretest comments -
     part the second

These are the solutions to the last two programming problems at the end of Monday night's pretest.

Instead of responding to each student individually, I am providing the source code solutions. Please be sure to review and understand all of these solutions.

Exam #1 pretest comments -
     part the first

Quite a few students seemed to have difficulty with the questions requiring code to be written, whether on paper or in the computer. Instead of responding to each student individually, I am providing the source code solutions to the last four problems on the pretest. Questions 8 and 9 are solved here and questions 10 and 11 are in the next post.

Please be sure to review and understand all of these solutions.

Exam #1 preparation

Your first exam, on chapters 1 through 5 of the textbook, is scheduled on Monday. Keep an eye on the blog this week for test preparation suggestions. Programming problems on exams are often very similar to the end of chapter exercises.

Monday, October 17, 2011

Elaine Lapham Memorial Scholarship


The Brookdale Community College Foundation has announced that The Elaine Lapham Memorial Scholarship is available for the spring 2012 semester. The scholarship is in the amount of $500.

WebAdvisor - interval 3

Today is the end of the third WebAdvisor monitoring interval. Students with attendance issues, poor homework performance, and/or missing assignments should take this warning seriously.

Homework 3 - guess

You are to write a program that calculates a random number from 1 to 10. Ask the user to guess the number. If the user guesses correctly, display a congratulatory message. If the user displays an incorrect answer, give the user two more tries. If after three attempts the user still has not guessed the number, display a message to that effect and terminate the program.

Friday, October 14, 2011

Public service announcement #2

Notice to all students:

Though it does not affect our Comp137 class, Brookdale is NOT closed on Veterans Day. If you have Friday classes this semester, you have school on Friday, November 11th.

Newlines

It isn't necessary to write multiple cout statements when you want a line break. This code

cout << endl;
cout << "Your random # is " << num << "." << endl;
cout << endl;


could be rewritten using the newline character, \n

cout << "\nYour random # is " << num << ".\n"
     << endl;


These two code snippets generate the same output:

Homework 2 - random number -
      alternate input option

If you would like to write an enhanced version of the second homework assignment, you can read in a char (instead of an int) and you can switch on the character entered. If you apply the tolower() function to that input character, you can make your program transparently deal with case sensitivity:

c = tolower(c);

Wednesday, October 12, 2011

Brookdale 5K

Notice to all students:


The first annual Brookdale Community College 5K run/walk to raise money for scholarships for the International Center Study Abroad Program is scheduled for Sunday, October 30th at 9:00 at Thompson Park. The cost is $25, and if you register before the 14th it includes a commemorative T-shirt. All of the donations go to the program.

You can download a race application here and a sponsorship form here.

Tuesday, October 11, 2011

Quiz #1 - results

The results for this first quiz were fairly well mixed. Some students had a firm grip on the logical operators and produced complete and correct output. Some students had mostly correct output with one or two errors. Some students were able to correctly use cout to send text to the console but couldn't remember the truth tables. All in all, not unexpected results for a first quiz.

Monday, October 10, 2011

Enhanced telephone digits

Example 5-5 in the textbook (pp 241-242) asks the user to enter an uppercase character and returns the corresponding number from the telephone keypad. If you would prefer to make the code case-insensitive, you could add the following to the program in the book.

rand() and srand()

Sometimes you need to generate a random number. In C++, the easiest way to do this is to invoke the rand() function from the cmath library. This method returns a value from [0 - 32767] but you can use a little mathematical

Here are some examples and what they return:

Lab 5 - reverse digits

You are to complete exercise 2, p 300.

You will need to employ a while loop and use the modulus operator and integer division.

Lab 4 - Cartesian coordinate system

You are to complete exercise 7, p 226.

You will need to use a combination of if/else if and the logical AND operator to determine where the user's point is located in the Cartesian coordinate system.

Lab 3 - salary increases

You are to complete exercise 6, p 165.

Lab 2 - miles per gallon program

You are to finish completing exercise 20, p 27 by creating a working console application which implements the algorithm which you developed as the solution to the problem for Lab 1.