Java Project.. Urgent!
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
Java Project.. Urgent!
Hi everybody!
Recently I have a class project regarding Java programming but I have
problems running the application. I hope that u can help me to solve it as I
need to hand it up by next Mon. The question is as follows:
Q)Write an application that defines a Circle class with with two
constructors. The first form accepts a double value that represents the
radius of the circles. This constructor assumes that the circle is centred
at the origin. The second form accepts three double values. The first two
arguements define the coordinates of the centre, and the third arguement
defines the radius.
Hopefully someone will be helpful enough to help me with my project..
Waiting for ur reply soon,
Shannon
Recently I have a class project regarding Java programming but I have
problems running the application. I hope that u can help me to solve it as I
need to hand it up by next Mon. The question is as follows:
Q)Write an application that defines a Circle class with with two
constructors. The first form accepts a double value that represents the
radius of the circles. This constructor assumes that the circle is centred
at the origin. The second form accepts three double values. The first two
arguements define the coordinates of the centre, and the third arguement
defines the radius.
Hopefully someone will be helpful enough to help me with my project..
Waiting for ur reply soon,
Shannon
Re: Java Project.. Urgent!
it would be like
public class Circle {
private:
double radius = new double;
double xcoord = new double;
double ycoord = new double;
Circle(double r)
{
radius = r;
xcoord = 0;
ycoord = 0;
}
Circle(double r,double x,double y)
{
radius = r;
xcoord = x;
ycoord = y;
}
};
or something along that lines... i forget the exact commands... but that is the gist of it.
public class Circle {
private:
double radius = new double;
double xcoord = new double;
double ycoord = new double;
Circle(double r)
{
radius = r;
xcoord = 0;
ycoord = 0;
}
Circle(double r,double x,double y)
{
radius = r;
xcoord = x;
ycoord = y;
}
};
or something along that lines... i forget the exact commands... but that is the gist of it.
Re: Java Project.. Urgent!
Now Shannon, I presume that you'll be donating a thousand dollars to the TextPad Foundation, now that you have gotten us suckers to do your work for you...
:' )
Jeffy
http://www.jeffyjeffy.com/textpad
:' )
Jeffy
http://www.jeffyjeffy.com/textpad
Re: Java Project.. Urgent!
Hope this could give you a little bit of ideas, I don't know what is the output you want to have, so I decide to do by my way. just copy and paste this following program and name it Circle.java. Run it, and you will see the result. good luck
public class Circle
{
private double x, y, r;
public Circle(double radius)
{
r = radius;
x = 0;
y = 0;
if(r == 0)
System.out.println("Circle in the center, which x=y=radius=0");
else
System.out.println("Circle have: x = " +x +", y = " +y +", and radius =" +r);
}
public Circle(double x_cord, double y_cord, double radius)
{
x = x_cord;
y = y_cord;
r = radius;
System.out.println("Circle have: x = " +x +",y = " +y +"and radius = " +r);
}
//tester
public static void main(String[] args)
{
Circle test1 = new Circle(5.5);
Circle test2 = new Circle(4.3, 4.3, 5.0);
}
}
public class Circle
{
private double x, y, r;
public Circle(double radius)
{
r = radius;
x = 0;
y = 0;
if(r == 0)
System.out.println("Circle in the center, which x=y=radius=0");
else
System.out.println("Circle have: x = " +x +", y = " +y +", and radius =" +r);
}
public Circle(double x_cord, double y_cord, double radius)
{
x = x_cord;
y = y_cord;
r = radius;
System.out.println("Circle have: x = " +x +",y = " +y +"and radius = " +r);
}
//tester
public static void main(String[] args)
{
Circle test1 = new Circle(5.5);
Circle test2 = new Circle(4.3, 4.3, 5.0);
}
}
Re: Java Project.. Urgent!
I think it's a little irresponsible for people to not only to ask for people to do your homework for you (cheating, extremely dishonorable), but also to post the entire answer to the homework, just because you know and want to look smart. How do you learn Java if you can't make a dinky circle class first?
$.02
$.02
Re: Java Project.. Urgent!
Hey Nick!
Please be polite and do not make false accusations that I am asking people to do my homework for me. I was merely asking for help as I was unable to make out the correct coding for my project. If you do not wanna help, just shut your bloody fucking mouth and get the hell out of here.
Please be polite and do not make false accusations that I am asking people to do my homework for me. I was merely asking for help as I was unable to make out the correct coding for my project. If you do not wanna help, just shut your bloody fucking mouth and get the hell out of here.
Re: Java Project.. Urgent!
I think that's the first use of the F word since this forum began.
Cool!
:' )
Jeffy
http://www.jeffyjeffy.com/textpad
PS: Here's to never ever posting another item in this thread. Cheers.
Cool!
:' )
Jeffy
http://www.jeffyjeffy.com/textpad
PS: Here's to never ever posting another item in this thread. Cheers.
Re: Java Project.. Urgent!
Hello, hello,
I think there's always a first time to everything and moreover I was provoked by the remarks of some lame idiot. I suppose so that I still have the right to post my topics on this thread.
Cool!
P/S: Here's to never ever poke your nose into anyone's business again! Cheers!
I think there's always a first time to everything and moreover I was provoked by the remarks of some lame idiot. I suppose so that I still have the right to post my topics on this thread.
Cool!
P/S: Here's to never ever poke your nose into anyone's business again! Cheers!
Re: Java Project.. Urgent!
I don't see why you got so angry. I don't mean to be condesending, but those constructors are very basic. This is coming from a guy who has spent maybe 2 hours in his entire life looking at java. This should be in any java book out there, and probably towards the beginning.
Anyway, good luck with your project. But for such simple questions, a book is usually quicker and better.
Anyway, good luck with your project. But for such simple questions, a book is usually quicker and better.