6 Replies - 580 Views - Last Post: 04 May 2009 - 06:40 PM Rate Topic: -----

#1 gozogirl  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 23-March 09

abstract classes

Post icon  Posted 04 May 2009 - 06:06 AM

I am trying to compile these two classes but they doesn't work.
The following is my working:

This is the 1st class

public abstract class itemsforsale{

private float weight;
private float price;
private string destination;
public itemsforsale (float w, float p, string d);

weight=w
price=p
destination=d
}

public float getWeight()
{
return weight;
}
public float getPrice()
{
return price;
}
public string getDestination()
{
return destination;
}
public abstract double postage();
}

This is the second class

public class bookextendsitemsforsale {

private string isbn;
private string title;

public final static float postage_rate_france=0.15f;
public final static float postage_rate_europe=0.4f;
public final static float postage_rate_world=0.05f;

public book (String t, int w, float p, String d);
{
super (w, p, d);
isbn=i;
title=t;
}
public string getisbn()
{
return isbn;
}
public string gettitle
}

public float postage_rate;
public double postage()
{

if (getdestination().equals( " France "))
postage_rate=postage_rate_france;


if (getdestination().equals ( " Europe "))
postage_rate=postage_rate_europe;


if (getdestination().equals ( " World" ))
postage_rate=postage_rate_world;


return_getweight().postage weight


}


}
}

This post has been edited by gozogirl: 04 May 2009 - 06:08 AM


Is This A Good Question/Topic? 0
  • +

Replies To: abstract classes

#2 mostyfriedman  Icon User is offline

  • The Algorithmi
  • member icon

Reputation: 727
  • View blog
  • Posts: 4,473
  • Joined: 24-October 08

Re: abstract classes

Posted 04 May 2009 - 06:11 AM

public class book extends itemsforsale


first you need to add spaces in the class definition, now what errors are you receiving?
Was This Post Helpful? 1
  • +
  • -

#3 gozogirl  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 23-March 09

Re: abstract classes

Posted 04 May 2009 - 06:21 AM

Ok thanks i understood.

So now in the first class(items for sale) the error is where there is weight=w and in the 2nd class the error is at the end where there is return_getweight()=postage weight.
Was This Post Helpful? 0
  • +
  • -

#4 mostyfriedman  Icon User is offline

  • The Algorithmi
  • member icon

Reputation: 727
  • View blog
  • Posts: 4,473
  • Joined: 24-October 08

Re: abstract classes

Posted 04 May 2009 - 06:28 AM

weight=w;
price=p;
destination=d;


you forgot to add semicolons
Was This Post Helpful? 0
  • +
  • -

#5 gozogirl  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 23-March 09

Re: abstract classes

Posted 04 May 2009 - 09:03 AM

i did the semicolons but still reporting error at the same point
Was This Post Helpful? 0
  • +
  • -

#6 mostyfriedman  Icon User is offline

  • The Algorithmi
  • member icon

Reputation: 727
  • View blog
  • Posts: 4,473
  • Joined: 24-October 08

Re: abstract classes

Posted 04 May 2009 - 09:04 AM

String has a capital S
Was This Post Helpful? 0
  • +
  • -

#7 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8347
  • View blog
  • Posts: 31,910
  • Joined: 06-March 08

Re: abstract classes

Posted 04 May 2009 - 06:40 PM

And gozogirl please respect rule #4 of this forum
:code:
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1