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

Please help me figure out how to complete this code. I am obviously lost in the

ID: 3823364 • Letter: P

Question

Please help me figure out how to complete this code. I am obviously lost in the world of Java. Thank you!

import java.awt.*;
public class Marquee extends Applet
{
String s = new String("Event Handlers Incorporated - Choose " +
     "us for your party needs");
int b = 0;
int e = 0;
int x = 300;
public void paint(Graphics g)
{
g.drawString(s.substring(b,e),x,100);
e++;
x = x - 5;
if(e == (s.length() + 1))
   {
    e = 0;
//Insert missing code here.
   }
try
    {
     Thread.sleep(300);
    }
catch(Exception e)
    {
    }
repaint();
}
}

Write an applet that you can display in your browser that simulates a marquee by displaying a string of characters one at a time from right to left across the screen Use the Thread class sleep method to pause momentarily before each new character displays. When the String message is fully displayed, start the message again. Save the applet as Marquee java in the Chapter 17 folder on your Student Disk

Explanation / Answer

Marquee.java

import java.applet.Applet;
import java.awt.Graphics;
public class Marquee extends Applet
{
String s = new String("Event Handlers Incorporated - Choose " +
"us for your party needs");
int b = 0;
int e = 0;
int x = 300;
public void paint(Graphics g)
{
g.drawString(s.substring(b,e),x,100);
e++;
x = x - 5;
if(e == (s.length() + 1))
{
e = 0;
x = 300;
//Insert missing code here.
}
try
{
Thread.sleep(300);
}
catch(Exception e)
{
}
repaint();
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote