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

Can someone fix my errors? What am I missing from this list of requirements? n i

ID: 3592181 • Letter: C

Question

Can someone fix my errors?

What am I missing from this list of requirements?

n is an integer that will be entered by a user in a JTextField

Add a JLabel prompt so the user will know what to enter in the text field

You must use the BorderLayout for the content pane in this application.

You can use the library method drawOval to draw an individual planet or create a more

advanced shape (i.e., using Polygon class).

Planets should be painted in random colors.

Use ActionEvent (button or text field) or MouseEvent to trigger drawing the planets.

my code:

import random;
import turtle;
no_of_planets=int(input(22))

for i in range(2,no_of_planets+2):
diameters=24*
if diameters==200:
break
planet=turtle.Turtle()
planet.shape('circle')
planet.pu()
planet.sety(-diameters)
planet.pd()   
planet.speed(2.5)   
planet.circle(diameters)

Explanation / Answer

/ A Java program to demonstrate that we can use wrapper
// classes to swap to objects
// A car with model and no.
class Car
{
int model, no;
// Constructor
Car(int model, int no)
{
this.model = model;
this.no = no;
}
// Utility method to print object details
void print()
{
System.out.println("no = " + no +
", model = " + model);
}
}
// A Wrapper over class that is used for swapping
class CarWrapper
{
Car c;
// Constructor
CarWrapper(Car c) {this.c = c;}
}
// A Class that use Car and swaps objects of Car
// using CarWrapper
class Main
{
// This method swaps car objects in wrappers
// cw1 and cw2
public static void swap(CarWrapper cw1,
CarWrapper cw2)
{
Car temp = cw1.c;
cw1.c = cw2.c;
cw2.c = temp;
}
// Driver method
public static void main(String[] args)
{
Car c1 = new Car(101, 1);
Car c2 = new Car(202, 2);
CarWrapper cw1 = new CarWrapper(c1);
CarWrapper cw2 = new CarWrapper(c2);
swap(cw1, cw2);
cw1.c.print();
cw2.c.print();
}
}