JMU CS349 - Developing Multimedia
Gallery Help Policies Solutions Study-Aids Syllabus Tools
Sample Questions for the Final Exam


  1. Answer the sample questions for the mid-term exam.
  2. For each of the following concepts, indicate the type of content that it is most related to.
    _____ Amplitude and Temporal Sampling
    _____ Cochlea
    _____ Kerning
    _____ Rod
    _____ Superimposition
    1. Auditory Content
    2. Dynamic Visual Content
    3. Static Visual Content
  3. Answer each of the following in the space provided:
    Explain the difference between described dynamic visual content (sometimes called sprite animation) and sampled dynamic visual content (sometimes called frame animation).


    List two different ways of representing auditory content?


    Explain the relationship between the period of a sound wave and its frequency.


    Briefly describe the two steps used when digitizing sound waves.


  4. Define linear interpolation. How have we used linear interpolation in this course? Write a function that can be used to linearly interpolate between two Point2D objects.
  5. Modify the AbstractSuperimposition class (from the lectures on sampled dynamic visual content) so that the visual content being superimposed can move from one position to another. Your solution must make use of a startingPosition and endingPosition. If the two are the same, your solution must behave exactly like the existing class. Otherwise, the visual content must move from the startingPosition to the endingPosition (along a straight line) over the duration of the superimposition.
  6. Write a class named JMUWipe that behaves like the RectangleWipe class discussed in lecture but clips to the outline of the GlyphVector for the String "JMU" (created using the standard sans serif font).
  7. (Note: Your answer to this question must not use the multimedia system from the textbook.) The JMU Office of Information Technology heard about our FrontWall class and want us to extend it so that it also shows the "movie" screen either raised, partially lowered, or completely lowered. Prof. Bernstein has written part of a FrontWallWithScreen class. You must complete the renderScreen() method.
    import java.awt.*;
    import java.awt.geom.*;
    import javax.swing.*;
    
    /**
     * A GUI component that displays the front wall of a classroom
     * with a "movie" screen (that can be partially lowered)
     */
    public class FrontWallWithScreen extends FrontWall
    {
        protected double               amountLowered;                      
        protected Rectangle2D.Double   screen;                    
    
        /**
         * Default Constructor
         */
        public FrontWallWithScreen()
        {
           super();
           screen = new Rectangle2D.Double();
        }
    
        /**
         * Render this component
         *
         * @param g   The rendering engine to use
         */
        public void paint(Graphics g)
        {
           Graphics2D      g2;
    
           super.paint(g);       
           g2 = (Graphics2D)g;
           renderScreen(g2);
        }
        
        /**
         * Set how low the movie screen is (i.e., what percentage of the
         * height of the front wall is covered by the movie screen)
         *
         * @param amountLowered    The percentage lowered (in the interval [0, 1])
         */
        public void setAmountLowered(double amount)
        {
           if ((amount >= 0.0) && (amount <= 1.0)) amountLowered = amount;
        }
    
        /**
         * Change the amount that the screen is lowered
         *
         * @param change    The amount of the change
         */
        public void changeAmountLowered(double change)
        {
           setAmountLowered(amountLowered + change);
        }
        
    
    
    
        /**
         * Render the "movie" screen on the front wall.
         *
         * The "movie" screen must be half as wide as the front wall and
         * must ocupy the middle half of the wall (i.e., the left-most
         * quarter of the wall and the right-most quarter of the wall must
         * never be covered by the screen).
         *
         * The screen must be fully raised when amountLowered is 0.0,
         * partially lowered when amountLowered is between 0.0 and 1.0
         * (e.g., when amountLowered is .28 it must be 28% lowered), and
         * fully lowered when amountLowered is 1.0.
         *
         * @param g2         The rendering engine to use
         */
        protected void renderScreen(Graphics2D g2)
        {
    
            // YOUR CODE HERE!
    
        }
    
    
    }
      
  8. (Note: Your answer to this question must not use the multimedia system from the textbook.) The architects working with JMU heard about our FrontWallWithScreen class and what to be able to use it to visualize the classrooms with the lights on and off, but they do not want to take new photographs of all of the class rooms (all of the originals were taken with the lights on). To this end, Prof. Bernstein has written part of a FrontWallWithScreenAndLights class. You must complete the renderBackground() method (which overrides the version in FrontWall).
    import java.awt.*;
    import java.awt.geom.*;
    import javax.swing.*;
    
    /**
     * A GUI component that displays the front wall of a classroom.  The way 
     * in which this component is rendered depends on whether lightsOn is true
     * or false (simulating the lights in the room being on or off).
     */
    public class FrontWallWithScreenAndLights extends FrontWallWithScreen
    {
        protected boolean              lightsOn = true;   
        
        /**
         * Default Constructor
         */
        public FrontWallWithScreenAndLights()
        {
           super();
           setBackground(new Color(102,102,102)); // Dark grey
        }
    
        /**
         * Render this component
         *
         * @param g   The rendering engine to use
         */
        public void paint(Graphics g)
        {
           Graphics2D      g2;
           
           super.paint(g);       
           g2 = (Graphics2D)g;
           renderBackground(g2);
           renderScreen(g2);
        }
    
        /**
         * Turn the lights off
         */
        public void turnLightsOff()
        {
           lightsOn = false;
           repaint();
        }
    
        /**
         * Turn the lights on
         */
        public void turnLightsOn()
        {
           lightsOn = true;
           repaint();
        }
        
        
        /**
         * Render the background image on this component.
         *
         * The way in which the image is composed with the background
         * depends on the value of the lightsOn attribute.  When lightsOn
         * is true the image must be rendered "as is", whereas when
         * lightsOn is false it must appear to be "darker".
         *
         * @param g2         The rendering engine to use
         */
        protected void renderBackground(Graphics2D g2)
        {
    
            // YOUR CODE HERE!
    
        }
        
    }
      
  9. (Note: Your answer to this question must not use the multimedia system from the textbook.) Write a class named SunsetPanel that shows what an Image would look like when the sun is set a given amount (e.g., when the sun is up, when the sun is 50% set, when the sun is completely set). (Hint: Fill the background using an appropriate color before rendering the Image, and use alpha blending to let the background color "show through".)
  10. (Note: Your answer to this question must use the multimedia system from the textbook.) Write a PieChart class that extends the Content class or implements the SimpleContent interface. The constructor must be passed an array of double values containing the "percentages". The render() method must draw a pie chart (i.e., a divided circle) that corresponds to those percentages. (Hint: You need to divide a circle that contains 2 times 3.14... radians into arcs based on the percentages.)
  11. (Note: Your answer to this question must not use the multimedia system from the textbook.) Pres. Rose has heard about the work you've done and has realized that, with a little more work, he can replace Prof. Bernstein with a multimedia application that simulates what he does in the classroom. To that end, you must complete the class named AnimatedFrontWall that simulates the raising and lowering of the "movie" screen. Specifically, complete the actionPerformed(), lowerScreen() and raiseScreen() methods below. You should assume that the other classes all work correctly. You may add attributes and/or other methods to the class if necessary.
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.geom.*;
    import javax.swing.*;
    
    
    /**
     * A GUI component that displays the front wall of a classroom with an
     * animated "movie" screen that can be raised and lowered.  The way in
     * which this component is rendered depends on whether lightsOn is
     * true or false (simulating the lights in the room being on or off).
     */
    public class AnimatedFrontWall extends    FrontWallWithScreenAndLights
                                   implements MetronomeListener
    {
        protected Metronome                metronome;
    
        
        /**
         * Default Constructor
         */
        public AnimatedFrontWall()
        {
           super();
           metronome = new Metronome(40);
           metronome.addListener(this);
        }
    
    
        /**
         * Start the animation of the screen lowering
         */
        public void lowerScreen()
        {
    
    
            // YOUR CODE HERE!
    
    
        }
    
    
    
        /**
         * Start the animation of the screen raising
         */
        public void raiseScreen()
        {
    
            // YOUR CODE HERE!
    
        }
    
    
    
        /**
         * Handle tick events (required by MetronomeListener)
         *
         * Specifically, this method is called by the Metonome every 40
         * milliseconds.  Each time it is called it either increases or
         * decreases the attribute amountLowered (depending on whether the
         * "movie" screen is being raised or lowered) and starts the
         * rendering process (so that the "movie" screen appears to be
         * animated).  It stops the animation when the "movie" screen is
         * either fully raised or fully lowered.
         *
         * @param millis   The number of milliseconds since the Metronome started
         */
        public void handleTick(int millis) 
        {
    
    
            // YOUR CODE HERE!
    
        }
        
    
    }
      
  12. (Note: Your answer to this question must use the multimedia system from the textbook.) Create a BouncingBoxSprite that bounces off of the four "walls" of the Stage. It must start moving at an angle and when it bounces, the angle of reflection must equal the angle of incidence. The box must be visual.statik.described.Content.
  13. Modify your answer to the question above so that the box "spins" slowly while it moves. The user must be able to toggle the spinning by clicking on the Stage with the mouse.
  14. Explain why, in your answer to the questions above, you chose to either rotate the box or change the Shape of the box.
  15. (Note: Your answer to this question must use the multimedia system from the textbook.) Create a BufferedSoundUnaryOp that decreases the perceived volume of each sample in a BufferedSound by 50%.
  16. Explain why you could or could not use a FIR filter when answering the previous question.
  17. (Note: Your answer to this question must use the multimedia system from the textbook.) Create a BufferedSoundUnaryOp that decreases the perceived volume of each sample in a BufferedSound that is greater than a particular threshold to the threshold.
  18. Explain why you could or could not use a FIR filter when answering the previous question.
  19. (Note: Your answer to this question must not use the multimedia system from the textbook.) The first seven MIDI notes of the "JMU Fight Song" are 60, 62, 64, 60, 65, 64, 60 (with durations of 200, 300, 600, 400, 400, 300, 300 milliseconds).

    Complete the following application so that it plays these 7 notes.

    import javax.sound.midi.*;
    
    /**
     * Plays the first 7 notes of the JMU Fight Song
     *
     */
    public class FightSong
    {
        private static MidiChannel       channel;
    
        /**
         * The entry point
         * 
         * @param args  Command-line args (0 for instrument)
         */
        public static void main(String[] args) throws Exception
        {
    	int             instrument;
    	MidiChannel[]   channels;
    	Soundbank       defaultSB;
    	Synthesizer     synthesizer;
    	
    	// Parse the command-line argument
    	instrument = Integer.parseInt(args[0]);
    	
    	// Create and open a MIDI synthesizer
    
            // YOUR CODE HERE!
    
    
            // Get the sound bank, load the instruments, and get the channels
    	defaultSB = synthesizer.getDefaultSoundbank();
    	synthesizer.loadAllInstruments(defaultSB);
    	channels    = synthesizer.getChannels();
    	channel     = channels[0];
    	
    	// Change the instrument
    	channel.programChange(0,  instrument);
    
    	// Play the first seven notes
    	play(60, 300);
    	play(62, 300);
    	play(64, 600);
    	play(60, 400);
    	play(65, 400);
    	play(64, 300);
    	play(60, 300);
        }
    
    
        /**
         * Play the given note (60 is middle C) for the
         * given amount of time
         *
         * @param note   The note
         * @param millis The amount of time (in milliseconds)
         */
        private static void play(int note, int millis) throws Exception
        {
            // YOUR CODE HERE!
        }
    
    }
          
  20. (Note: Your answer to this question must use the multimedia system from the textbook.) Create a Triplet class that extends the auditory.described.AbstractContent class.

Copyright 2023