Showing posts with label deliverables. Show all posts
Showing posts with label deliverables. 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 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)

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)

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.

Monday, October 17, 2011

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

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

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

Homework 2 - random number

You are to write a console application that generates a random number (from 1 - 10) for the user. Display a short menu to the user, informing them which input will generate a random number and which input will terminate the program. Your solution must include a do-while loop and a switch statement.