SlideShare a Scribd company logo
1 of 2
Download to read offline
please send edited code. I have posted this a few times with lots of incorrect feedback.
Main.java
package part2;
import java.util.Random;
public class Main {
static final int NUM = 10;
public static void main(String[] args) {
EZ.initialize(600, 600);
Data [] datapoints = new Data[NUM];
Random rg = new Random();
for (int i=0; i
Solution
Here is the code for you:
package part2;
import java.awt.Color;
public class Data {
// static variables
static int count = 0;
static float centerX = 0;
static float centerY = 0;
// member variables
int x;
int y;
// static functions
public static void print() {
System.out.println("There are " + count + " data points.");
System.out.println("Centered at (" + centerX + ", " + centerY + ")");
}
public static void drawCenter() {
EZCircle.addCircle(centerX, centerY, 20, 20, Color.RED, false);
}
// member functions
public Data(int _x, int _y) {
x = _x;
y = -y;
centerX = (count * centerX + x) / (count + 1);
centerY = (count * centerY + y) / (count + 1);
count++;
}
public void draw() {
EZLine l;
l = EZ.addLine(x, y, centerX, centerY, Color.BLACK);
}
}

More Related Content

Similar to please send edited code. I have posted this a few times with lots of.pdf

can you add a delete button and a add button to the below program. j.pdf
can you add a delete button and a add button to the below program. j.pdfcan you add a delete button and a add button to the below program. j.pdf
can you add a delete button and a add button to the below program. j.pdf
sales88
 

Similar to please send edited code. I have posted this a few times with lots of.pdf (13)

9)Answerimport java.util.; import java.lang.; import java.pdf
9)Answerimport java.util.; import java.lang.; import java.pdf9)Answerimport java.util.; import java.lang.; import java.pdf
9)Answerimport java.util.; import java.lang.; import java.pdf
 
OBJECT ORIENTED PROGRAMMIING LANGUAGE PROGRAMS
OBJECT ORIENTED PROGRAMMIING LANGUAGE PROGRAMSOBJECT ORIENTED PROGRAMMIING LANGUAGE PROGRAMS
OBJECT ORIENTED PROGRAMMIING LANGUAGE PROGRAMS
 
The sample program for above series in JAVA will be like belowimpo.pdf
The sample program for above series in JAVA will be like belowimpo.pdfThe sample program for above series in JAVA will be like belowimpo.pdf
The sample program for above series in JAVA will be like belowimpo.pdf
 
The sample program for above series in JAVA will be like belowimpo.pdf
The sample program for above series in JAVA will be like belowimpo.pdfThe sample program for above series in JAVA will be like belowimpo.pdf
The sample program for above series in JAVA will be like belowimpo.pdf
 
Java oops features
Java oops featuresJava oops features
Java oops features
 
Java Simple Programs
Java Simple ProgramsJava Simple Programs
Java Simple Programs
 
Review Questions for Exam 10182016 1. public class .pdf
Review Questions for Exam 10182016 1. public class .pdfReview Questions for Exam 10182016 1. public class .pdf
Review Questions for Exam 10182016 1. public class .pdf
 
Distributed systems
Distributed systemsDistributed systems
Distributed systems
 
java program assigment -2
java program assigment -2java program assigment -2
java program assigment -2
 
662305 10
662305 10662305 10
662305 10
 
Awt
AwtAwt
Awt
 
Java Programs
Java ProgramsJava Programs
Java Programs
 
can you add a delete button and a add button to the below program. j.pdf
can you add a delete button and a add button to the below program. j.pdfcan you add a delete button and a add button to the below program. j.pdf
can you add a delete button and a add button to the below program. j.pdf
 

More from jibinsh

What type of cell-surface characteristic helps an epithelial tissue h.pdf
What type of cell-surface characteristic helps an epithelial tissue h.pdfWhat type of cell-surface characteristic helps an epithelial tissue h.pdf
What type of cell-surface characteristic helps an epithelial tissue h.pdf
jibinsh
 
What is NOT a requirement for evolution by natural selection to.pdf
What is NOT a requirement for evolution by natural selection to.pdfWhat is NOT a requirement for evolution by natural selection to.pdf
What is NOT a requirement for evolution by natural selection to.pdf
jibinsh
 
What is James Wilsons leadership style and traits What made him dif.pdf
What is James Wilsons leadership style and traits What made him dif.pdfWhat is James Wilsons leadership style and traits What made him dif.pdf
What is James Wilsons leadership style and traits What made him dif.pdf
jibinsh
 
This project calls for the modification of the DollarFormat clas.pdf
This project calls for the modification of the DollarFormat clas.pdfThis project calls for the modification of the DollarFormat clas.pdf
This project calls for the modification of the DollarFormat clas.pdf
jibinsh
 
The energy used in the CaMn cycle for the production of carbohydrate .pdf
The energy used in the CaMn cycle for the production of carbohydrate .pdfThe energy used in the CaMn cycle for the production of carbohydrate .pdf
The energy used in the CaMn cycle for the production of carbohydrate .pdf
jibinsh
 
The CAN-SPAM Acta.   applies to virtually all promotional e-mails,.pdf
The CAN-SPAM Acta.   applies to virtually all promotional e-mails,.pdfThe CAN-SPAM Acta.   applies to virtually all promotional e-mails,.pdf
The CAN-SPAM Acta.   applies to virtually all promotional e-mails,.pdf
jibinsh
 
Recent Presidential debates have brought about a series of polls.pdf
Recent Presidential debates have brought about a series of polls.pdfRecent Presidential debates have brought about a series of polls.pdf
Recent Presidential debates have brought about a series of polls.pdf
jibinsh
 
Please give me a custom example code of a complex PovRay Program tha.pdf
Please give me a custom example code of a complex PovRay Program tha.pdfPlease give me a custom example code of a complex PovRay Program tha.pdf
Please give me a custom example code of a complex PovRay Program tha.pdf
jibinsh
 
A)abductionB)deductive reasoningc) inductive reasoningd)a wild.pdf
A)abductionB)deductive reasoningc) inductive reasoningd)a wild.pdfA)abductionB)deductive reasoningc) inductive reasoningd)a wild.pdf
A)abductionB)deductive reasoningc) inductive reasoningd)a wild.pdf
jibinsh
 
JAVAWrite a program that takes a command-line argument representin.pdf
JAVAWrite a program that takes a command-line argument representin.pdfJAVAWrite a program that takes a command-line argument representin.pdf
JAVAWrite a program that takes a command-line argument representin.pdf
jibinsh
 

More from jibinsh (20)

What part of the brain is used in sympathetic arousal (ANS)Solu.pdf
What part of the brain is used in sympathetic arousal (ANS)Solu.pdfWhat part of the brain is used in sympathetic arousal (ANS)Solu.pdf
What part of the brain is used in sympathetic arousal (ANS)Solu.pdf
 
What type of cell-surface characteristic helps an epithelial tissue h.pdf
What type of cell-surface characteristic helps an epithelial tissue h.pdfWhat type of cell-surface characteristic helps an epithelial tissue h.pdf
What type of cell-surface characteristic helps an epithelial tissue h.pdf
 
Which bond would be most polar whySolutionstarting with .pdf
Which bond would be most polar whySolutionstarting with .pdfWhich bond would be most polar whySolutionstarting with .pdf
Which bond would be most polar whySolutionstarting with .pdf
 
What is NOT a requirement for evolution by natural selection to.pdf
What is NOT a requirement for evolution by natural selection to.pdfWhat is NOT a requirement for evolution by natural selection to.pdf
What is NOT a requirement for evolution by natural selection to.pdf
 
What is James Wilsons leadership style and traits What made him dif.pdf
What is James Wilsons leadership style and traits What made him dif.pdfWhat is James Wilsons leadership style and traits What made him dif.pdf
What is James Wilsons leadership style and traits What made him dif.pdf
 
This project calls for the modification of the DollarFormat clas.pdf
This project calls for the modification of the DollarFormat clas.pdfThis project calls for the modification of the DollarFormat clas.pdf
This project calls for the modification of the DollarFormat clas.pdf
 
The method FRET ALEX is a more precise way to determine the number o.pdf
The method FRET ALEX is a more precise way to determine the number o.pdfThe method FRET ALEX is a more precise way to determine the number o.pdf
The method FRET ALEX is a more precise way to determine the number o.pdf
 
The initial velocity is How do you solve the initial velocity.pdf
The initial velocity is How do you solve the initial velocity.pdfThe initial velocity is How do you solve the initial velocity.pdf
The initial velocity is How do you solve the initial velocity.pdf
 
The following expression was simplified incorrectly. In which line er.pdf
The following expression was simplified incorrectly. In which line er.pdfThe following expression was simplified incorrectly. In which line er.pdf
The following expression was simplified incorrectly. In which line er.pdf
 
The energy used in the CaMn cycle for the production of carbohydrate .pdf
The energy used in the CaMn cycle for the production of carbohydrate .pdfThe energy used in the CaMn cycle for the production of carbohydrate .pdf
The energy used in the CaMn cycle for the production of carbohydrate .pdf
 
The CAN-SPAM Acta.   applies to virtually all promotional e-mails,.pdf
The CAN-SPAM Acta.   applies to virtually all promotional e-mails,.pdfThe CAN-SPAM Acta.   applies to virtually all promotional e-mails,.pdf
The CAN-SPAM Acta.   applies to virtually all promotional e-mails,.pdf
 
SensesFor each of the special senses, understand how a stimulus is.pdf
SensesFor each of the special senses, understand how a stimulus is.pdfSensesFor each of the special senses, understand how a stimulus is.pdf
SensesFor each of the special senses, understand how a stimulus is.pdf
 
Recent Presidential debates have brought about a series of polls.pdf
Recent Presidential debates have brought about a series of polls.pdfRecent Presidential debates have brought about a series of polls.pdf
Recent Presidential debates have brought about a series of polls.pdf
 
Quality function deployment (QFD) is a structures approach for integ.pdf
Quality function deployment (QFD) is a structures approach for integ.pdfQuality function deployment (QFD) is a structures approach for integ.pdf
Quality function deployment (QFD) is a structures approach for integ.pdf
 
Please give me a custom example code of a complex PovRay Program tha.pdf
Please give me a custom example code of a complex PovRay Program tha.pdfPlease give me a custom example code of a complex PovRay Program tha.pdf
Please give me a custom example code of a complex PovRay Program tha.pdf
 
Networking Question What are the key differences between forwarding.pdf
Networking Question What are the key differences between forwarding.pdfNetworking Question What are the key differences between forwarding.pdf
Networking Question What are the key differences between forwarding.pdf
 
Most children with cystic fibrosis have frequent lung infections and.pdf
Most children with cystic fibrosis have frequent lung infections and.pdfMost children with cystic fibrosis have frequent lung infections and.pdf
Most children with cystic fibrosis have frequent lung infections and.pdf
 
A)abductionB)deductive reasoningc) inductive reasoningd)a wild.pdf
A)abductionB)deductive reasoningc) inductive reasoningd)a wild.pdfA)abductionB)deductive reasoningc) inductive reasoningd)a wild.pdf
A)abductionB)deductive reasoningc) inductive reasoningd)a wild.pdf
 
Lipid rafts are associated with which of the following activities re.pdf
Lipid rafts are associated with which of the following activities re.pdfLipid rafts are associated with which of the following activities re.pdf
Lipid rafts are associated with which of the following activities re.pdf
 
JAVAWrite a program that takes a command-line argument representin.pdf
JAVAWrite a program that takes a command-line argument representin.pdfJAVAWrite a program that takes a command-line argument representin.pdf
JAVAWrite a program that takes a command-line argument representin.pdf
 

Recently uploaded

Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
ssuserdda66b
 

Recently uploaded (20)

Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 

please send edited code. I have posted this a few times with lots of.pdf

  • 1. please send edited code. I have posted this a few times with lots of incorrect feedback. Main.java package part2; import java.util.Random; public class Main { static final int NUM = 10; public static void main(String[] args) { EZ.initialize(600, 600); Data [] datapoints = new Data[NUM]; Random rg = new Random(); for (int i=0; i Solution Here is the code for you: package part2; import java.awt.Color; public class Data { // static variables static int count = 0; static float centerX = 0; static float centerY = 0; // member variables int x; int y; // static functions public static void print() { System.out.println("There are " + count + " data points."); System.out.println("Centered at (" + centerX + ", " + centerY + ")"); } public static void drawCenter() { EZCircle.addCircle(centerX, centerY, 20, 20, Color.RED, false);
  • 2. } // member functions public Data(int _x, int _y) { x = _x; y = -y; centerX = (count * centerX + x) / (count + 1); centerY = (count * centerY + y) / (count + 1); count++; } public void draw() { EZLine l; l = EZ.addLine(x, y, centerX, centerY, Color.BLACK); } }