Showing posts with label lab assignments. Show all posts
Showing posts with label lab assignments. Show all posts

Tuesday, December 20, 2011

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 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

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:

Monday, November 7, 2011

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()

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)

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.

Monday, October 10, 2011

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.

Lab 1 - miles per gallon algorithm

You are to complete exercise 20, p 27.

You need to type up the algorithm you would use to solve the problem presented.

Submit your algorithm as a text attachment to an email to me.

Due Date:
Thursday, October 13th, 8:00am

Grades

Final grades for this class will be determined according to the following criteria:
  • Test average
  • Lab assignments
  • Homework

Sunday, October 9, 2011

Code submission

I am using Bloodshed's Dev-C++ IDE to test your code. When you submit your homework and your labs from now on, you will need to send me your whole project, not just your .cpp file(s).

Monday, October 3, 2011

Grades

Final grades for this class will be determined according to the following criteria:
  • Test average
  • Lab assignments
  • Homework