#Getters/Setters

1 messages · Page 1 of 1 (latest)

slender wind
#

Hi! How do I make a copy constructor and allow a getter/setter to use it?

grave wedgeBOT
#

This post has been reserved for your question.

Hey @slender wind! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

slender wind
#

what does this mean

median basalt
#

Not sure what you're after

#

But the error looks like the method doesn't exist

slender wind
median basalt
#

And there are syntax and error highlighting

median basalt
slender wind
#

this is what i don't understand

#

i was given this started GUI code and told to fill in the functions

median basalt
#

Or you didn't import Property

slender wind
#

i have to import it?

#

why do I have to import a class

median basalt
#

Show me the property class please. Would also help to see the actual code itself

slender wind
# median basalt Show me the property class please. Would also help to see the actual code itself

no problem:

package com.example.proj4;

public class Property {
    private String propertyName;
    private String city;
    private double rentalAmount;
    private String owner;
    private Plot plot;

    public Property() {
        propertyName = "";
        city = "";
        rentalAmount = 0.0;
        owner = "";
        plot = new Plot();
    }
    public Property(String propertyName, String city, double rentalAmount, String owner) {
        this.propertyName = propertyName;
        this.city = city;
        this.rentalAmount = rentalAmount;
        this.owner = owner;
        plot = new Plot();
    }

    public Property(String propertyName, String city, double rentalAmount, String owner, int x, int y, int width, int depth) {
        this.propertyName = propertyName;
        this.city = city;
        this.rentalAmount = rentalAmount;
        this.owner = owner;
        plot = new Plot(x, y, width, depth);
    }
    public Property(Property otherProperty) {
        propertyName = otherProperty.propertyName;
        city = otherProperty.city;
        rentalAmount = otherProperty.rentalAmount;
        owner = otherProperty.owner;
        plot = new Plot(otherProperty.plot);
    }
    public Plot getPlot() {
        return plot;
    }

    public String getPropertyName() {
        return propertyName;
    }

    public String getCity() {
        return city;
    }

    public double getRentAmount() {
        return rentalAmount;
    }

    public String getOwner() {
        return owner;
    }

    public String toString() {
        return propertyName + "," + city + "," + owner + "," + rentalAmount;
    }
}
median basalt
#

Show me the class that is giving the errors

slender wind
#

2 related problems

median basalt
#

Show me what it says

slender wind
#

it says to rename reference

median basalt
#

Property parameter datatype

slender wind
median basalt
#

Import class?

#

Stupid mobile makes it hard to read

#

Or just hover over it

slender wind
median basalt
#

Show the ManagementCompany code please

slender wind
#

oh, i have not written it, only the Plot.java and Propery.java class only. is that why i am getting the 2 related issues?

median basalt
#

It's hard to read the images on mobile. Discord being glitchy lol

#

But yea, that would make sense

slender wind
#

alright, i will write that class and report back if i got issues