Cs-200 Assignments

Assignment 1

due on 2/5/98.

Write a program in C++ which will prompt the user to enter their year of birth (integer). Calculate in how many years the user will be 50, and write it in a sentence.

If the person is over 50, write out that s/he is in the best years of life.

Make sure to include comments in your program, especially in the beginning with your name and the program # (Program 1). Also describe the program.

Include your design (structure chart, flowchart, or pseudocode)

Since we may not cover the if-else statement before the due date (you need it for the 2nd part of the program) delay this program a bit and turn in a program that draws a robot as seen in class. The new date for the program above will be announced shortly.

Assignment 2 due Feb. 26, 1998.

Assignment 3 due March 10th, 1998.

Assignment 4 due April 7th, 1998.

Assignment 5 due April 21st, 1998.

Assignment 2

Due 2/26/98 but Feb 24 is recommended.

Write a C++ program to do the following: Calculate a student's average. The student may have 3 or 4 exams to average. First read in the number of exams, then branch accordingly (using 2 separate functions).

Write 2 separate functions for the 2 cases.

LIke before, document your program with comments and a design.

Break your robot 1st assignment into a call to 3 separate functions: head, body and legs. Submit your program and your output.

Assignment 3

First input: Number (int) of exams to average.

Second input: Number (int) of students in the class.

Outputs:

  • Your average,
  • your letter grade, and
  • your rank in the class.

    Main processing:

  • Call Average function to read and average all those exams' grades.
  • Call Letter_Grade function to convert average grade to a letter grade.
  • Call Rank function to compare your average with all other students' averages and return your rank in the class.
  • Display results.
  • Function Average: Use while loop to read all grades and sum them up. Function Average receives the number of exams as input (int) and returns the average (float) to main.

    Function Letter-Grade receives your average (float) as input and returns your letter grade (char) to main. Use nested if.

    Function Rank will use a For loop to read all other students' averages and compare them with yours. Use a counter inside the loop to keep track of all those students who have a higher average than yours. Pass by value your average to the function. Pass by reference the number of students (int&). Use that reference parameter to return your ranking to the main program.

    easy? Concentrate on the functions first...

    Assignment 4

    Same as assignment 3 but use an external file as input, created by you.

    Assignment 5

    Read in a string of 20 characters and find out the number of vowels in it. Display both the string and the number of vowels. Repeat a few times. An idea: Search among all your friends who has the least vowels in their names.

    To return to Netiva Caftori's home page

    For messages to Dr. Caftori her.

    Last updated 4/13/98.