Search:

Type: Posts; User: m7abraham

Search: Search took 0.08 seconds.

  1. Replies
    17
    Views
    1,558

    Re: writing a class

    this is the output:


    run:
    Diameter of Pizza Area of Pizza Price Price/SQ Inch
    12.00 113.10 $4.00 0.0354
    12.00 113.10 ...
  2. Replies
    17
    Views
    1,558

    Re: writing a class

    haha yeah took a lot of brain storming!!!
    but i still get the same output for some reason
    this is what my program looks like now:


    /* This class calculates the area of a pizza and
    * the...
  3. Replies
    17
    Views
    1,558

    Re: writing a class

    is this correct?


    public Pizza(Pizza pi) {

    diameter = pi.diameter;
    price = pi.price;
    }
  4. Replies
    17
    Views
    1,558

    Re: writing a class

    ok sorry... :confused:
    just one question
    whats "this" in the program
  5. Replies
    17
    Views
    1,558

    Re: writing a class

    based on the example i think this is how it should be done... but its still giving me the same output :/


    public Pizza(Pizza pi) {

    pi.getDiameter();
    pi.getPrice();

    ...
  6. Replies
    17
    Views
    1,558

    Re: writing a class

    thanks :)
    got this one fixed


    public double calculateArea() {
    double radius = diameter / 2;
    double area = Math.PI * radius * radius;
    return area;
    }
  7. Replies
    17
    Views
    1,558

    Re: writing a class

    did i get it right this time? haha


    public Pizza(Pizza pi) {

    pi.getDiameter();
    pi.getPrice();
    }

    and i think i got this one right too:
  8. Replies
    17
    Views
    1,558

    Re: writing a class

    for the first part... are the two fields(diameter, price)?
    is this what i'm suppose to do?


    public Pizza(Pizza pi) {
    diameter = 12.0;
    price = 4.00;
    }
  9. Replies
    17
    Views
    1,558

    Re: writing a class

    for this part the instruction is: "copy constructor the creates an exact copy of the passed pizza object pi."


    public Pizza(Pizza pi) {
    }


    the error message that im getting is this:
  10. Replies
    17
    Views
    1,558

    writing a class

    I wrote almost the entire class other than one thing that i'm confused about which is this:


    public Pizza(Pizza pi) {
    }


    the rest of the coding is done. when i test it it says that...
Results 1 to 10 of 10