Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

java question Buildings are just one of many structures that occupy a cityscape

ID: 3663014 • Letter: J

Question

java question

Buildings are just one of many structures that occupy a cityscape – there are also magazine kiosks, utility poles, parking lots, even sculptures. All of these have a location, as well as a footprint – the shape and size of the area occupied by the structure; however the calculation of the exact footprint depends upon the type of structure. Furthermore, the property value of the structure as well as the amount of property tax to be paid depends on the particular structure as well. Define an abstract class, Structure, that has the following: [8]

a) a String variable, address

b) a Date variable, installedOn, that contains the date the structure was first put into use

c) a constructor that accepts a single string parameter used to initialize the address variable. The constructor also invokes a static method of the Date class, named now, (no parameters) that returns a reference to a Date object (representing the current point in time) that is used to initialize the installedOn instance variables.

d) accessor methods (i.e., getters) for the two instance variables

e) an abstract method, getFootprint, that accepts no parameters and returns a reference to an object of type Dimensions

f) an abstract method named getPropertyValue that accepts no parameters and returns a reference to a Cash object

g) an abstract method named getPropertyTaxOwed that accepts a parameter of type Date and returns a reference to a Cash object

Explanation / Answer

import java.util.Date;


public abstract class Structure
{
   String address;
   Date installedOn;
   public Structure(String n){
       address=n;
       installedOn=new Date();
   }
   public String setAddress(){
       return address;
   }
   public Date setDate(){
       return installedOn;
   }
   public abstract Dimensions getFootprint();
   public abstract Cash getPropertyValue();
   public abstract Cash getPropertyTaxOwed(Date d);
}

import java.util.Date;


public class Dimensions extends Structure
{

   public Dimensions(String n) {
       super(n);
       // TODO Auto-generated constructor stub
   }

   @Override
   public Dimensions getFootprint() {
       // TODO Auto-generated method stub
       return null;
   }

   @Override
   public Cash getPropertyValue() {
       // TODO Auto-generated method stub
       return null;
   }

   @Override
   public Cash getPropertyTaxOwed(Date d) {
       // TODO Auto-generated method stub
       return null;
   }
  
}

package mani;

import java.util.Date;

public class Cash extends Structure {

   public Cash(String n) {
       super(n);
       // TODO Auto-generated constructor stub
   }

   @Override
   public Dimensions getFootprint() {
       // TODO Auto-generated method stub
       return null;
   }

   @Override
   public Cash getPropertyValue() {
       // TODO Auto-generated method stub
       return null;
   }

   @Override
   public Cash getPropertyTaxOwed(Date d) {
       // TODO Auto-generated method stub
       return null;
   }

   }