| 
                        
                           
  | 
                     
| 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. | 
| 
                            | 
                     
| 
                            
                                | 
                     
Point2D objects.
     
            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.
     
            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).
     
            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!
    }
}
  
               
            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!
    }
    
}
  
               
            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".)
    
            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.)
    
            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!
    }
    
}
  
               
            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.
    
            Stage with the mouse.
    
            Shape of the
    box.
    
            BufferedSoundUnaryOp that decreases the 
    perceived volume of each sample in a BufferedSound
    by 50%.
    
            BufferedSoundUnaryOp that decreases the 
    perceived volume of each sample in a BufferedSound
    that is greater than a particular threshold to the threshold.
    
            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!
    }
}
      
               
            Triplet class that extends the
      auditory.described.AbstractContent class.
      
            Copyright 2025