Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8667881
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T18:04:42+00:00 2026-06-12T18:04:42+00:00

I have this question, this is the diagram that I was given, and I

  • 0

I have this question, this is the diagram that I was given, and I have managed to come with a solution, but the actual question itself is asking me to implement the get and set methods, which I am not sure if they are applicable here,

enter image description here

enter image description here

This is just part of the a bit long question, did not want to make it look like I want my homework done by the users here by pasting the whole question, but just a doubt, if get and set methods indeed can be implemented how can I do that?

So this is my code, what I have come with so far

public abstract class Property 
{
    private static int autonumber = 0, propID,area,price;
    private String address;

    public Property(String addr, int area,int price)
    {
        autonumber++;
        propID = autonumber;
        this.area = area;
        this.price = price;
    }
     public abstract double calculateMiscFee();

     public int getArea()
     {
         return area;
     }

     public void setArea()
     {

     }
//     public double calculateMiscFee()
//     {
//         return 100*
//     }
}

This is the latest code I have

public abstract class Property 
{
    private static int autonumber = 0;
    private int propID;
    private int area;
    private double price;
    private String address;
    private int district;

    public Property(String addr, int area,double price, int district)
    {
        autonumber++;
        propID = autonumber;
        this.area = area;
        this.price = price;
        this.district = district;
        this.address = addr;

    }
     public abstract double calculateMiscFee();

     public int getArea()
     {
         return area;
     }

     public void setArea(int a)
     {
         area = a;
     }

      public String getAddress()
     {
         return address;
     }

     public void setAddress(String add)
     {
         address = add;
     }

     public double getPrice()
     {
         return price; 
     }
     public  void setPrice(double p) 
     { 
          price = p;
     }

     public int getDistrict()
     {
         return district;
     }

     public  void setDistrict(int disc) 
     { 
          district = disc;
     }
//     public double calculateMiscFee()
//     {
//         return 100*
//     }

      public String toString()
      {

      }

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T18:04:43+00:00Added an answer on June 12, 2026 at 6:04 pm

    propID, area and price should not be static. static variables are shared between all instances of a class, and these variables should be per instance, just like address.

    If a class declares a variable abc of type String, the getter and setter for abc would look like the following:

    public String getAbc() {
        return abc;
    }
    
    public void setAbc(String newAbc) {
        /* Potentially do some validation of the new value
         * For example make sure it's not null, or inside reasonable ranges
         * (A price shouldn't be negative, etc.)
         */
        abc = newAbc;
    }
    

    toString() is a method which already exists in all classes, but you can still override it. For example:

    class MyClass {
        private int myInt;
    
        public MyClass(int myInt) {
            this.myInt = myInt;
        }
    
        @Overrides
        public String toString() {
            return "MyClass with value " + myInt;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this question relating to Lucene. I have a form and I get
ASP.Net MVC3 is cool and all but I have this question more out of
This is a tricky question to explain, but basically I have an app with
Question In flash, if you have a complicated graphic (like a complex diagram) that
I have this question, just in theory. I do some query results and there
I have this question in which I have a SQL Server Compact Edition database
I have this question because I am not familiar latest generation of MS VS
I have this question: How could I call a codebehind method from jquery? I
I have this question, i am just throwing it out there. I am implementing
hello i have this question i was trying to find a way to call

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.