Samples

| CS 100B Home |

Please note:

  • The following problems provide excellent practice for programming and your prelims.
  • The questions are deliberately a bit vague so that you will have to experiment with the code.
  • We'll go over some of these problems during the review session.
  • Solutions will be posted around the same time as the review session.
  • More problems will likely be posted, so check back now and then.

  •  

     
     
     
     
     
    Problem Description Sample Code/Solution
    1 Write a Java program that will perform matrix multiplication. Specs:
  • Use initializer lists to store matrix values as doubles.
  • Check matrix dimensions to see if multiplication is permissible.
  • Output results in row/column format.
  • matrix_mul.java
    2 Write a Java program that will perform matrix mulitplication as is Problem 1.
    But now, your matrices are composed of intervals!
    combine PL2 sample with 
    matrix_mul.java
    3 Write a Java program that will sort the values of a 1-D array of integers from maximum to minimum values. Output the sorted array in a single row. see PL3
    4 Write a Java program that will count the frequency of each vowel from text that a user enters at a prompt. The user must be prompted for text input. The user might enter any keyboard character. The ouput should report the frequencies of a, e, i, o, u, and y (well, sometimes...do you know your cases...yes?) see PL3
    5 Write a Java program that computes the area for different kinds of quadrilaterals. Assume  "reasonable" inheritance relationships for quadrilaterals, rhomboids, trapezoids, paralellograms, rectangles, and squares. quad_area.java
    6 Write a Java program that simulates a coin toss. Look up how Java can generate random numbers. Use an object oriented approach. no random #s on final exam
    7 Write a Java program that adds two 4-D arrays of complex numbers. complex_add.java
    8 Write a Java program that finds the roots of any polynomial up to 5 orders using Newton's Method. see HW2, HW6
    9 Write a program in MATLAB that finds roots with the bisection method. see HW2, HW6
    10 Write a program in in MATLAB that finds roots with Newton's method. see HW2, HW6


    Back to Top
    Back to CS100B Home