EE102 Homework Assignments

Assignment 10

Program 1 (40pts.)

Consider example called extract_email_number that has been posted in the exmaples section next to the Web server parsing example that was discussed in class. Write a different function that would extract the total size of the mailbox from the provded line of text that is in the same format as shown there. (+Ok num_of_msg size_of_mbox. Please note the the number of messages and size of mailbox are numbers that are varyign in length. Also, the incoming line can contain an error message instead. Write a short program that reads a line of thext from the user, calls your function, and displays the returned number. However, in case of a negative number that indicates an error, display an appropriate error message instead.

Assignment 9 due Wednesday, November 9, 2005

Program 1 (20pts.)

Write a program that accepts integer numbers within the range 0 to 100 including the boundary values. The program should read numbers from keyboard until an out of range number is entered. Each time a number is entered that already has been entered before the program should resond to the user saying that such number has been already entered. In the captured screen demonstrate that your program works as intended.

Assignment 8 due Wednesday, November 2, 2005

Program 1 (20pts.)

Develop two functions that perform unit conversion between metric and English systems. One should accept distance in kilometers, meters and millimeters, and should return (by reference) the distance in miles, yards, feet and inches. The second function should perform conversion in the opposite direction. Functions should only perform calculations, no console input or output is allowed. Write a program that tests the functions by: asking its user for the direction; asking for the distance (three input variables); calling appropriate function (if statement); and printing the results.

Assignment 7 due Wednesday, October 26, 2005

Program 1 (20pts.)

Chapter 7, Application Exercise 11, Page 367.   Must use at least one function and perform all collision calculations in it to get any credit. Change to the collision parameters must be done outside of that function.

Use your knowledge of physics to dervie the equation for V3. Calculate V3 in a function and return it to the main program. Hardcode all values (no keyboard entry). Use for loops to change values of M1, M2, Thetha, and V2 (V1 is constant). Print values of input variables and value returned form the function, one case per line. Run program once and capture its output.

Hint: ideally you should return the two calculated parameters by reference. However, since return by reference is discussed in class close to the deadline you can print the result to the screen within the function. In both cases this is a "void function" with many incoming parameters and depending on your program design decision with two or no outgoing parameters.

Assignment 6 due Wednesday, October 5 19, 2005

Program 1 (20pts.)

Chapter 6, Application Exercise 22, Page 286.   with the following mandatory modification: the program should ask the user for the size of the triangle base. Your program should print a well-formed triangle for any positive odd number. A single asterisk should be printed for size of one. Use of FOR loop(s) is suggested. You can use multiple print statments but each of them should print only one asterisk at a time.

Assignment 5 due Wednesday, September 28, 2005

Program 1 (20pts.)

Chapter 6, Application Exercise 14, Page 283.  

Hints: Use one while loop to read data from the file. Read M outside of that loop and then pairs of (B, N) per each loop iteration. Exit if end of file or reading error or count reaches M (see example that does that). Otherwise, within that loop proceed with the second loop that calculates sum of N components of the series for the equation provided in the textbook for a=1 (see example that does it).

Note: Make sure that you submit this homework on time with no delay. The homework is due just before the exam. In case elements of the homework are used in the exam a sample solution would be provided and no homewokr accepted after the exam.

Assignment 4 due Wednesday, September 21, 2005

Program 1 (20pts.)

Chapter 5, Application Exercise 8, Page 223.  

Hint: Assume oxll, oyll, oxur, oyur, txll, tyll, txur, tyur. There are actually only two cases to check for overlapping: (1) both txll is between oxll and oxur and tyll is between oyll and oyur OR (2) both txur is between oxll and oxur and tyur is between oyll and oyur. If none of them is true then the rectangles do not overlap.

Run this program three times to show case (1), case (2), and case when the rectanglers do not overlap.

Assignment 3 due Wednesday, September 14, 2005

Program 1 (10pts.)

Chapter 4, Application Exercise 13, Page 168.   The program should read the data from a file called data.txt. It should read the data and print to the screen both the value of data and the solution. Run the program at least two times. Change the contents of the data file before each run. Remember to attach the program output when submitting your work.

Program 2 (10pts.)

Chapter 5, Application Exercise 3, Page 222.   Run the program at least three times, each time enter an angle value that would result in a different quadrant. Change the contents of the data file before each run. Remember to attach the program output when submitting your work.

Assignment 2 due Wednesday, September 7, 2005

Please compile and run each program using a C++ complier. Attach copies of running program screens as described in class to ensure fiull credit. You do not need to submit programs that do not compile or do not contribute towards solutions of requested problems.

Program 1 (10pts.)

Chapter 3, Application Exercise 2, Page 129.   Make the program that performs calculations for one triangle of given leg lenghts. Run the program four times - for each data set. Capture each screen and append to the program as a comment.

Program 2 (10pts.)

Chapter 3, Application Exercise 5, Page 130-131.   Make the program that performs calculations for one case. Run it for data sets described by cases #1 and #3. Each time enter the orginal gas condition from the keyboard. Capture each screen and append to the program as a comment.

Assignment 1 due Wednesday, August 31, 2005

The first assignment is an exception. Unlike all furhter it does not ask to compile and run a program. We don't have enough information to do that yet.

Problem 1 (10pts.)

Chapter 2, Lesson 2.1, Exercise 2, Page 59.  

Problem 2 (10pts.)

Chapter 2, Lesson 2.2, Exercise 3, Page 60, but...   Use a compiler to verify your corrections.

web site front local main page local list page general bookmarks software bookmarks go back copyright info