Please send all questions & assignments to:

dsolarek@utnet.utoledo.edu dl.cset@gmail.com


Click on the button above to return to the calling page.

 

Programming Assignments
Assignments start at the bottom.
(follow instructions carefully)

Assignment 22 - Inner Class

Due: Friday, November 21, 2008

1.     Use an ssh client (puTTY is recommended) to remotely access your account on the Java server: IP = 131.183.117.219

2.     Make the directory "cset3150" on this server the current directory.

3.     Copy the InnerClassTest.java code from pages 229-230 of your text to your cset3150 directory on the Java server..

4.     Write whatever additional code is necessary to get the application working.

5.     Name the program that satisfies this assignment Clock.java

6.     Compile this program to bytecode using the javac utility. Name the bytecode file "Clock.class" (this will be done automatically, but check it).

7.     Run the program using java.

8.     Send your instructor and TA an email message indicating that you have completed the assignment. (The assignment will be graded from the code in your directory.)

Assignment 21 - Inheritance

Due: Friday, November 21, 2008

1.     Write an inheritance heirarchy for Quadrilateral, Trapezoid, Parallelogram, Rectangle and Square. Use Quadrilateral as the superclass for the heirarchy. Make the heirarchy as deep (i.e., as many levels) as possible. Specify the instance variables and methods for each class. The private instance variables of Quadrilateral should be the x-y coordinate pairs for the four endpoints of the Quadrilateral.

2.     Use an ssh client (puTTY is recommended) to remotely access your account on the Java server: IP = 131.183.117.219

3.     Make the directory "cset3150" on this server the current directory.

4.     Write a Java program that instantiates objects of your classes and outputs each object's area (except Quadrilateral).

5.     Name the program that satisfies this assignment Shapes.java

6.     Compile this program to bytecode using the javac utility. Name the bytecode file "Shapes.class" (this will be done automatically, but check it).

7.     Run the program using java.

8.     Send your instructor and TA an email message indicating that you have completed the assignment. (The assignment will be graded from the code in your directory.)

Assignment 20 - Java Console

Due: Friday, November 14, 2008

1.     Use an ssh client (puTTY is recommended) to remotely access your account on the Java server: IP = 131.183.117.219

2.     Make the directory "cset3150" on this server the current directory.

3.     Write a Java program reads four integers from the Java console representing, respectively, the number of quarters, dimes, nickels and pennys. Convert the total coin amount to dollars and output the result with a dollar sign ($) notation.

4.     Name the program that satisfies this assignment CoinValue.java

5.     Compile this program to bytecode using the javac utility. Name the bytecode file "CoinValue.class" (this will be done automatically, but check it).

6.     Run the program using java.

7.     Send your instructor and TA an email message indicating that you have completed the assignment. (The assignment will be graded from the code in your directory.)

Assignment 19 - Java Console

Due: Friday, November 14, 2008

1.     Use an ssh client (puTTY is recommended) to remotely access your account on the Java server: IP = 131.183.117.219

2.     Make the directory "cset3150" on this server the current directory.

3.     Write a Java program reads two words from the Java console and outputs the number of characters in the smaller of the two

4.     Name the program that satisfies this assignment WordLength.java

5.     Compile this program to bytecode using the javac utility. Name the bytecode file "WordLength.class" (this will be done automatically, but check it).

6.     Run the program using java.

7.     Send your instructor and TA an email message indicating that you have completed the assignment. (The assignment will be graded from the code in your directory.)

Assignment 18 - Java Programming

Due: Friday, November 7, 2008

1.     Use an ssh client (puTTY is recommended) to remotely access your account on the Java server: IP = 131.183.117.219

2.     Make the directory "cset3150" on this server the current directory.

3.     Write a Java program that converts 20, 75, 110 and 300 kilograms to pounds (where 1 lb = 0.454 kg). The program should also output the results in a user-friendly format.

4.     Name the program that satisfies this assignment Kilo2pound.java

5.     Compile this program to bytecode using the javac utility. Name the bytecode file "Kilo2pound.class" (this will be done automatically, but check it).

6.     Run the program using java.

7.     Send your instructor and TA an email message indicating that you have completed the assignment. (The assignment will be graded from the code in your directory.)

Assignment 17 - Java Programming

Due: Friday, November 7, 2008

1.     Use an ssh client (puTTY is recommended) to remotely access your account on the Java server: IP = 131.183.117.219

2.     Create a directory named "cset3150" on this server and make it the current directory.

3.     Write a Java program that calculates and outputs the average of 2, 6, 12, 19 and 33.

4.     Name the program that satisfies this assignment SimpleAvg.java

5.     Compile this program to bytecode using the javac utility. Name the bytecode file "SimpleAvg.class" (this will be done automatically, but check it).

6.     Run the program using java.

7.     Send your instructor and TA an email message indicating that you have completed the assignment. (The assignment will be graded from the code in your directory.)

Assignment 14 - Advanced Sorting

Due: Friday, October 31, 2008

1.     Use an ssh client (puTTY is recommended) to remotely access your account on the et791.ni.utoledo.edu server.

2.     Make your "cset3150" directory on this server the current directory.

3.     Test the performance in real time of the recursive heap sort algorithm against the modified quick sort and recursive merge sort algorithms with list lengths of 1,000, 10,000, 100,000 and 1,000,000 integers.

4.     Refer to Chapter 38 of the open-source textbook and the other web pages included in Lesson 14 for help with this assignment.

5.     Scan your files into a PDF document and email it to your instructor and TA. Include the results for each sort algorithm with the corresponding analysis.. (The assignment will be graded based on your PDF document.)

Assignment 13 - Elementary Sorting

Due: Friday, October 31, 2008

1.     Use an ssh client (puTTY is recommended) to remotely access your account on the et791.ni.utoledo.edu server.

2.     Make your "cset3150" directory on this server the current directory.

3.     Write a program that accepts numeric grades and stores them in an array. When the user enters a grade of -1, no more grades will be entered. The program should sort the array into ascending order, then find the lowest grade and delete it from the list.

4.     Having done this, the remaining grades and the average of the remaining grades should be output.

5.     Name the program that satisfies this assignment sortAvg.cpp

6.     Compile and run this program using the g++ utility. Name the object-code file "sortAvg" - no extension.

7.     Scan your files into a PDF document and email it to your instructor and TA. (The assignment will be graded based on your PDF document.)

Assignment 12b - Binary Trees 2

Due: Friday, October 24, 2008

1.     Use an ssh client (puTTY is recommended) to remotely access your account on the et791.ni.utoledo.edu server.

2.     Make your "cset3150" directory on this server the current directory.

3.     Create and use two function members for class temperatures entered in assignment 12a. One should return the minimum low temperature and the other should return the maximum high temperature.

4.     Name the program that satisfies this assignment minMax.cpp

5.     Compile and run this program using the g++ utility. Name the object-code file "minMax" - no extension.

6.     Scan your files into a PDF document and email it to your instructor and TA. (The assignment will be graded based on your PDF document.)

Assignment 12a - Binary Trees 1

Due: Friday, October 24, 2008

1.     Use an ssh client (puTTY is recommended) to remotely access your account on the et791.ni.utoledo.edu server.

2.     Make your "cset3150" directory on this server the current directory.

3.     Enter the class temperatures (found in Chapter 44, pages 14-17 of the open-source textbook) in your directory on the course server. [Cut and paste it.]

4.     Use the following C++ main() function to test and debug it.

5.   
6.  int main( ) 
7.  { 
8.    temperatures t; 
9.    t.insertDay(2,15,3); 
10.   t.insertDay(5,2,1); 
11.   t.insertDay(3,37,33); 
12.   t.insertDay(3,0,0); // this node should not appear in any listing 
13.   t.insertDay(1,10,5); 
14.   t.insertDay(4,56,23); 
15.   cout << "High Temp: " << t.returnHi(3) << 
16.           " Low Temp: " << t.returnLow(4) << endl; 
17.   t.listAllPreorder( ); 
18.   t.listAllInorder( ); 
19.   t.listAllPostorder( ); 
20.   return (0);
21. }

22.  Name the program that satisfies this assignment temperatures.cpp

23.  Compile and run this program using the g++ utility. Name the object-code file "temperatures" - no extension.

24.  Scan your files into a PDF document and email it to your instructor and TA. (The assignment will be graded based on your PDF document.)

Assignment 11 - ADTs

Due: Friday, October 24, 2008

1.     Use an ssh client (puTTY is recommended) to remotely access your account on the et791.ni.utoledo.edu server.

2.     Make your "cset3150" directory on this server the current directory.

3.     Using the following struct, create a print queue class with a queue created from a dynamic linked list. The dequeue function should return a non-dynamic copy of the first node with the next pointer set to NULL. If the queue is empty, the node returned should have a job number of -1. Include in the class a void function that displays the information contained in all nodes of the linked list that represents the queue.

4.   
5.  struct printJob 
6.  { 
7.    int job, pages; 
8.    printJob *next; 
9.  };

10.  Refer to Chapter 42 of the open-source textbook for this assignment.

11.  Name the program that satisfies this assignment printQueue.cpp

12.  Compile and run this program using the g++ utility. Name the object-code file "printQueue" - no extension.

13.  Scan your files into a PDF document and email it to your instructor and TA. (The assignment will be graded based on your PDF document.)

Assignment 10b - Linked Lists 2

Due: Friday, October 17, 2008

1.     Use an ssh client (puTTY is recommended) to remotely access your account on the et791.ni.utoledo.edu server.

2.     Make your "cset3150" directory on this server the current directory.

3.     Use the code from assignment 10a below as a starting point.

4.     Add code to add a third object to the front of the linked list (have first point to it) and code to output the entire list. Remember to delete all nodes in the list. [Before the program ends, the memory used to make this list is then returned to the free store of memory for reuse.]

5.     Add a forth object to the back (at the right most side) of the linked list of the above and code to output the entire list. Remember to delete all nodes in the list. [Before the program ends, the memory used to make this list is then returned to the free store of memory for reuse.]

6.     Name the program that satisfies this assignment dayTemp2.cpp

7.     Compile and run this program using the g++ utility. Name the object-code file "dayTemp2" - no extension.

8.     Scan your files into a PDF document and email it to your instructor and TA. (The assignment will be graded based on your PDF document.)

Assignment 10a - Linked Lists 1

Due: Friday, October 17, 2008

1.     Use an ssh client (puTTY is recommended) to remotely access your account on the et791.ni.utoledo.edu server.

2.     Make your "cset3150" directory on this server the current directory.

3.     Copy and paste the example program on pages 1-2 of Chapter 41 from the open-source textbook to your directory on the course server.

4.     Name the program that satisfies this assignment dayTemp.cpp

5.     Compile and run this program using the g++ utility. Name the object-code file "dayTemp" - no extension.

6.     Scan your files into a PDF document and email it to your instructor and TA. (The assignment will be graded based on your PDF document.)

Assignment 9b - Asymptotic Analysis

Due: Friday, October 10, 2008

1.     Show that each of the following is true:

a.     5n2 = O(n2)

b.    n2 + 10n = O(n2)

c.     n = O(n2)

d.    n8 = Ω(n9)

e.     n ≠ Θ(5n2)

f.     6n2 + n ≠ Ω(n3)

g.    an = O(bn), b > a > 1

h.     lg(n) = O(n)

2.     What is the smallest value of n such that an algorithm whose running time is 100n2 runs faster than an algorithm whose running time is 2n on the same machine.

3.     Consider the following linear search specification:
Input - A sequence of n numbers A = (a1,a2,…,an) and a value v.
Output - An index i such that v = A[i] or the special value NIL if v does not appear in A.
How many elements of the input sequence need to be checked on the average, assuming that the element being searched for is equally likely to be any element in the array? How about in the worst case? What are the average-case and worst-case running times of linear search in Θ-notation? Justify your answers.

4.     Let ƒ(n) and g(n) be asymptotically nonnegative functions. Using the basic definition of Θ-notation, prove that:
max(ƒ(n), g(n)) = Θ(ƒ(n) + g(n)).

5.     Is 2n+1 = O(2n)? Justify your answer.

6.     Is 22n = O(2n)? Justify your answer.

7.     Document your work using Microsoft Word and/or Excel.

8.     Send your instructor and TA an email message with this analysis attached (the Word document) when you have completed the assignment.

Assignment 9a - Frequency Analysis

Due: Friday, October 10, 2008

1.     Use an ssh client (puTTY is recommended) to remotely access your account on the et791.ni.utoledo.edu server.

2.     Select three of the programs from assignments 6a, 6b, 8a and 8b that you have written and perform frequency analysis on them.

3.     Document your analysis using Microsoft Word and/or Excel. Include your raw data as well as your analysis of the data.

4.     Send your instructor and TA an email message with this analysis attached (the Word document) when you have completed the assignment. Also, include the source-code for each program with the corresponding analysis.

Assignment 8b - C++ Recursion 2

Due: Friday, October 3, 2008

1.     Use an ssh client (puTTY is recommended) to remotely access your account on the et791.ni.utoledo.edu server.

2.     Make your "cset3150" directory on this server the current directory.

3.     Write a C++ application that executes four (4) functions – two iterative versions and two recursive versions.

a.     Prompt the user for a single integer (call it X). This is the input for your functions.

b.    At the beginning of the main function, check to make sure that the user entered the correct input. If exactly one (1) integer argument is not entered by the user, then display an error message and end the program.

c.     You also need to have an exception just in case a non-integer is entered by the user.

d.    If the integer is not positive, your method should not do anything. It should not create an infinite loop or crash the program.

e.     Function 1: For integer X > 0 print a row of X asterisks.

f.     Function 2: Recursive version of Function 1

g.    Function 3: For integer X > 0, print the numbers 1, 2, 3, …, X

h.     Function 4: Recursive version of Function 3

4.     Name the program that satisfies this assignment starsNums.cpp

5.     Compile and run this program using the g++ utility. Name the object-code file "starsNums" - no extension.

6.     Send your instructor and TA an email message indicating that you have completed the assignment. (The assignment will be graded from the code in your directory.)

Assignment 8a - C++ Recursion 1

Due: Friday, October 3, 2008

1.     Use an ssh client (puTTY is recommended) to remotely access your account on the et791.ni.utoledo.edu server.

2.     Make your "cset3150" directory on this server the current directory.

3.     Write a C++ program using a recursive function to determine the sum of the digits of an integer. For example:

4.   
5.  51624 = 5  + 1 + 6 + 2 + 4 = 18.

Hint: use the % operator to pick off the ones digit and the / operator to reduce the problem to a smaller one.

6.     Name the program that satisfies this assignment sumOfDigits.cpp

7.     Compile and run this program using the g++ utility. Name the object-code file "sumOfDigits" - no extension.

8.     Send your instructor and TA an email message indicating that you have completed the assignment. (The assignment will be graded from the code in your directory.)

Assignment 6b - C++ vector Class

Due: Friday, October 3, 2008

1.     Use an ssh client (puTTY is recommended) to remotely access your account on the et791.ni.utoledo.edu server.

2.     Make your "cset3150" directory on this server the current directory.

3.     Write a program that uses a vector to do the following:

o    Read in three lines of text from a file named infile.dat. (Read Chapters 23 and 24 from the open-source textbook, or the appropriate sections from textbook you purchased for this course,)

o    Print the text on the screen without any punctuation symbols. Words are separated by spaces.

o    Print the same text but with the reverse order of the words (i.e., print the text backwards). Words are separated by spaces.

4.     Name the program that satisfies this assignment vectorIO.cpp

5.     Compile and run this program using the g++ utility. Name the object-code file "vectorIO" - no extension.

6.     Send your instructor and TA an email message indicating that you have completed the assignment. (The assignment will be graded from the code in your directory.)


Contents of
infile.dat (you must create this file):

 
The rain in Spain falls mainly in the plane. 
What a wonderful assignment! 
I like soda and pizza.

Assignment 6a - C++ Arrays

Due: Friday, October 3, 2008

1.     Use an ssh client (puTTY is recommended) to remotely access your account on the et791.ni.utoledo.edu server.

2.     Make your "cset3150" directory on this server the current directory.

3.     Write a C++ program that will load an array of 10 integers with arbitrary integer values between 0 and 100, print them out, print out the minimum, print out the maximum and print out the average of the ten element values.

4.     Name the program that satisfies this assignment array.cpp

5.     Compile and run this program using the g++ utility. Name the object-code file "array" - no extension.

6.     Send your instructor and TA an email message indicating that you have completed the assignment. (The assignment will be graded from the code in your directory.)

Assignment 3b - class role and role2.h

Due: Friday,September 26, 2008

1.     Use an ssh client (puTTY is recommended) to remotely access your account on the et791.ni.utoledo.edu server.

2.     Make your "cset3150" directory on this server the current directory.

3.     Complete Programming Assignment 13.3 from Chapter 13 of the open-source textbook.

4.     Name the header file role2.h

5.     Name the program that satisfies this assignment role.cpp

6.     Compile and run this program using the g++ utility. Name the object-code file "role" - no extension.

7.     Send your instructor and TA an email message indicating that you have completed the assignment. (The assignment will be graded from the code in your directory.)

Assignment 3a - class car and car.h

Due: Friday,September 26, 2008

1.     Use an ssh client (puTTY is recommended) to remotely access your account on the et791.ni.utoledo.edu server.

2.     Make your "cset3150" directory on this server the current directory.

3.     Complete Programming Assignment 12.2 from Chapter 12 of the open-source textbook.

4.     Name the header file car.h

5.     Name the program that satisfies this assignment car.cpp

6.     Compile and run this program using the g++ utility. Name the object-code file "car" - no extension.

7.     Send your instructor and TA an email message indicating that you have completed the assignment. (The assignment will be graded from the code in your directory.)

Assignment 2b - Using a Function

Due: Friday,September 19, 2008

1.     Use an ssh client (puTTY is recommended) to remotely access your account on the et791.ni.utoledo.edu server.

2.     Make your "cset3150" directory on this server the current directory.

3.     Referencing the conversion formula below, write a C++ program that uses a function to compute the Celsius temperature for any Fahrenheit temperature input by the user from the keyboard. The calculated result is to be displayed on the screen. Precision should be limited to 2 decimal places in addition to the decimal point.

C = 5.0 / 9.0 (F-32.0)

In this formula C is the temperature in Celsius and F is the temperature in Fahrenheit.

4.     Name the source-code file "f2c.cpp"

5.     Compile and run this program using the g++ utility. Name the object-code file "f2c" - no extension.

6.     Send your instructor and TA an email message indicating that you have completed the assignment. (The assignment will be graded from the code in your directory.)

Assignment 2a - Input from Keyboard

Due:Friday,September 19, 2008

1.     Use an ssh client (puTTY is recommended) to remotely access your account on the et791.ni.utoledo.edu server.

2.     Change to your "cset3150" subdirectory off your home directory on this server.

3.     Write a C++ program that inputs four (4) numeric grades from the user (keyboard), then computes and outputs the average of these four grades.

4.     Name your souorce-code file "gradeAvg.cpp"

5.     Compile and run this C++ program using the g++ utility. Name the object-code file "gradeAvg" - no extension.

6.     Send your instructor and TA an email message indicating that you have completed the assignment. (The assignment will be graded from the code in your directory.)

Assignment 1 - Hello World in C++

Due: Friday, September 12, 2008

1.     Use a telnet or ssh client (puTTY is recommended) to remotely access your account on the et791.ni.utoledo.edu server.

2.     Create a subdirectory named "cset3150" off your home directory on this server.

3.     Create a C++ source-code file for the "Hello World" program found in Lesson 1 on the course web site. Name it "hw.cpp"

4.     Compile and run the "Hello World" program using the g++ utility. Name the object-code file "hw" - no extension.

5.     Send your instructor and TA an email message indicating that you have completed the assignment. (The assignment will be graded from the code in your directory.)

    Click on the button at left to return to the calling page.

 

There have been http://cset.sp.utoledo.edu/count.php/www/test/cset.sp.utoledo.edu/cset3150/cset3150_assignments.htmlvisitors since 8/31/07.

 

Added to the Web: August 31, 2007.

Web page design by Dan Solarek.


http://cset.sp.utoledo.edu/cset3150/