Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Overview: In this assignment, students will create a simple Java applet. The app

ID: 3771021 • Letter: O

Question

Overview: In this assignment, students will create a simple Java applet. The applet will display the student’s picture, a short biography, and will play an MP3 audio file. Instructions: In this assignment, students will create an applet that runs in a browser. The applet will contain the following: A picture of the student . A short biography of the student An MP3 file that will play when a button is pressed. In addition to the above, the applet must run as either an applet or an application. This assignment will be turned in by the date on the course schedule using the Applets Lesson Dropbox. Be sure to include your MP3 file and picture file with your code.

Explanation / Answer


import java.awt.*;

import java.applet.*;

public class student extends applet;

{

student img;

student story;

button play,stop;

private mp3_player;

public void init()

{

image=getImage(getDocumentbase(),”student.jpg”);

}

public void image(graphics a)

{

a.image(img,50,50);

}

mp3_player=new button();

play.setlabel(play);

play.setactioncommand(play);

play.addActionListener(this.story);

add(play);

@Override

public void actionPerformed(ActionEvent e)

{

if(e.getActionCommand().equals(play))

{

player.start();

}

else

{

player.stop();

}