Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #7113
| From | Chad <cdalten@gmail.com> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: A question about a few variables in a class |
| Date | 2011-08-14 13:23 -0700 |
| Organization | http://groups.google.com |
| Message-ID | <9b372a01-59c9-462a-a5ca-463f3ededb9d@y19g2000pre.googlegroups.com> (permalink) |
| References | <c5422014-46bd-4c77-9302-839b5cb587a2@a2g2000prf.googlegroups.com> <j1ja73$g9q$1@dont-email.me> <8ff5e4fa-84c5-4d4a-97e8-0b2f3f5b0dc4@m5g2000prh.googlegroups.com> <j2762o$mlf$1@dont-email.me> |
On Aug 13, 5:49 pm, Eric Sosman <esos...@ieee-dot-org.invalid> wrote:
> On 8/13/2011 1:30 PM, Chad wrote:
>
> > On Aug 6, 4:56 am, Eric Sosman<esos...@ieee-dot-org.invalid> wrote:
> >>[...]
> >> We don't actually know what Rectangle is because there are no
> >> import statements to tell us what package it's in. It clearly
> >> cannot be java.awt.Rectangle, which has public width and height
> >> members but which has no getArea() and no suitable constructor.
>
> > Aye. I broke away from my own personal rule of posting code snippets.
> > I should know better since it really annoys me when people post code
> > snippets on comp.lang.c, and then, like magic, expect the group to be
> > able to magically interpet their line of thought.
>
> Just out of curiosity, what *is* the `Rectangle' you used?
>
Below is all 5 million lines of code from the book....
public class GeometricObject1 {
private String color = "white";
private boolean filled;
private java.util.Date dateCreated;
public GeometricObject1() {
dateCreated = new java.util.Date();
}
public GeometricObject1(String Color, boolean filled) {
dateCreated = new.java.util.Date();
this.color = color;
this.filled = filled;
}
public String getColor() {
return color;
}
public void setColor(String color) {
this.color = color;
}
public boolean isFilled() {
return filled;
}
public void setFilled(boolean filled) {
this.filled = filled;
}
public java.util.Date getDateCreated() {
return dateCreated;
}
public String toString() {
return "created on " + dateCreated + "\ncolor" + color +
" and filled" + filled;
}
}
//Rectangle1 isn't a typo
public class Rectangle1 extends GeometricObject1 {
private double width;
private double height;
public Rectangle1() {
}
public Rectangle1(double width, double height, String color,
boolean filled) {
this.width = width;
this.height = height;
setColor(oolor);
setFilled(filled);
}
public double getWidth() {
return width;
}
public void setWidth(double width) {
this.width = width;
}
public double getHeight() {
return height;
}
public double setHeight(double height) {
this.height = height;
}
public double getArea() {
return width * height;
}
public double getPerimeter() {
return 2 * (width + height);
}
}
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar
A question about a few variables in a class Chad <cdalten@gmail.com> - 2011-08-05 14:31 -0700
Re: A question about a few variables in a class markspace <-@.> - 2011-08-05 14:46 -0700
Re: A question about a few variables in a class Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-08-06 07:56 -0400
Re: A question about a few variables in a class Chad <cdalten@gmail.com> - 2011-08-13 10:30 -0700
Re: A question about a few variables in a class Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-08-13 20:49 -0400
Re: A question about a few variables in a class Chad <cdalten@gmail.com> - 2011-08-14 13:23 -0700
Re: A question about a few variables in a class markspace <-@.> - 2011-08-14 13:52 -0700
Re: A question about a few variables in a class Lew <lewbloch@gmail.com> - 2011-08-14 22:50 -0700
Re: A question about a few variables in a class Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-08-14 18:04 -0400
Re: A question about a few variables in a class Chad <cdalten@gmail.com> - 2011-08-14 17:09 -0700
Re: A question about a few variables in a class Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-08-14 21:57 -0400
Re: A question about a few variables in a class Lew <lewbloch@gmail.com> - 2011-08-14 22:55 -0700
Re: A question about a few variables in a class Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-08-14 18:01 -0400
Re: A question about a few variables in a class Roedy Green <see_website@mindprod.com.invalid> - 2011-08-06 22:58 -0700
Re: A question about a few variables in a class Patricia Shanahan <pats@acm.org> - 2011-08-07 05:28 -0700
Re: A question about a few variables in a class Lew <lewbloch@gmail.com> - 2011-08-10 09:14 -0700
Re: A question about a few variables in a class Chad <cdalten@gmail.com> - 2011-08-13 10:27 -0700
Re: A question about a few variables in a class Patricia Shanahan <pats@acm.org> - 2011-08-14 18:36 -0700
csiph-web