can you solve this please?  Adopt appropriate Java animation code to implement the video in the file “test4.wmv” and given that the parametric equation for a circle. x=r*cos(t) y=r*sin(t) with t in range [0, 2p] and r is the radius of the circle. (the circle goes in a loop like in the images, i did my best to try to explain it , please try to do it ) and here is a sample of what they want me to use : package javaapplication1; import java.awt.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

can you solve this please? 

Adopt appropriate Java animation code to implement the video in the file “test4.wmv” and given that the parametric equation for a circle.

x=r*cos(t)

y=r*sin(t)

with t in range [0, 2p] and r is the radius of the circle.

(the circle goes in a loop like in the images, i did my best to try to explain it , please try to do it )

and here is a sample of what they want me to use :

package javaapplication1;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.awt.geom.*;
import java.util.Random;
import javax.imageio.*;
import java.io.File;
import java.io.IOException;
import java.awt.image.BufferedImage;
import java.awt.event.*;
import java.util.Calendar;


public class JavaApplication1 extends JApplet {

    
    public static void main(String[] args) {
        
        JFrame frame=new JFrame();
        frame.setTitle("hello");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        JApplet applete =new JavaApplication1();
        applete.init();
        frame.getContentPane().add(applete);
        frame.pack();
        frame.setVisible(true);
    }
    @Override
    public void init(){
        JPanel panel=new JApp1Panel();
        getContentPane().add(panel);
    }

    public void actionPerformed(ActionEvent e) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }
    
}
class JApp1Panel extends JPanel implements Runnable{
      Point2D.Double[] pts = new Point2D.Double[1200];
  public JApp1Panel() {
    setPreferredSize(new Dimension(640, 480));
    setBackground(Color.gray);
    for (int i = 0; i < pts.length; i++) {
      pts[i] = new Point2D.Double(Math.random(), Math.random());
    }
    Thread thread = new Thread(this);
    thread.start();  

  }  

    @Override
      public void run() {
    while(true) {
      for (int i = 0; i < pts.length; i++) {
        double x = pts[i].getX();
        double y = pts[i].getY();
        y += 0.1*Math.random();
        if (y > 1) {
          y = 0.3*Math.random();
          x = Math.random();
        }
        pts[i].setLocation(x, y);}
      repaint();
      try {
        Thread.sleep(100);
      } catch (InterruptedException ex) {}
    }  }  

  @Override
  public void paintComponent(Graphics g) {
    super.paintComponent(g);
    g.setColor(Color.white);
    
    for (int i = 0; i < pts.length; i++) {
      int x = (int)(640*pts[i].x);
      int y = (int)(480*pts[i].y);
      int h = (int)(25*Math.random());
      g.drawLine(x, y, x, y+h);
    }
  }
  
}// end of JApp1Panel class

ܩ
Transcribed Image Text:ܩ
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Random Class and its operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education