Can't get extended class to work with asbstract class

I am having trouble working an extended class to work with my base abstract class. I keep getting this error message: "Fiction.java:4: invalid method declaration; return type required" public FictionBook()" Can someone give me some advice and or guidance on what I need to do? Thanks.
Here is my abstract class:
import javax.swing.*;
public abstract class Book
     protected String bookTitle;
     protected double bookPrice;
     public abstract double setPrice();
public Book()
          setBookPrice();
public double getBookPrice()
          return bookPrice;
public abstract void setBookPrice();
Here is the extended class that I have:
import javax.swing.*;
public class Fiction extends Book
     public Fiction()
          super();
          setBookPrice();
     public void setBookPrice();
          bookPrice = 24.95;
     public String toString()
          return("Fiction Book Price is $" + bookPrice);
}

Fiction.java:2: Fiction is not abstract and does not override abstract method setPrice() in BookThis one is pretty straightfoward: Book declares an abstract setPrice() method. In effect is promises "every concrete subclass of Book will define an implementation of setPrice()". But your Fiction class does not do this - it does not give an implementation of setPrice() even though as a Book it is required to do so. That is what the compiler is complaining about.
Fiction.java:6: call to super must be first statement in constructorThis one is slightly cryptic. If you use super() it must be as the first line of a constructor. You are using it as the first line of Fiction() so that looks OK - until you realise that Fiction() is not a constructor! That's because you declare it as a method returning void. Remove the "void" and the compiler will recognise it as a constructor and will be happy about your use of super().
Edited by: pbrockway2 on Sep 13, 2008 12:13 PM
Just a general point: it might be worth writing very brief comments for your abstract class to say what the methods are supposed to do. It isn't really clear what setBookPrice() is supposed to do given that it isn't passed any argument. Likewise setPrice(), how does it differ from setBookPrice()? what is the double value that it returns?

Similar Messages

  • I have an Retina display MacBook Pro with HMDI out port. I also have an HDMI to Component cable with Audio Plugs. How can I get HDMI out to work with this cable when plugged into the Component and Audio ports on my TV?

    I have an Retina display MacBook Pro with HMDI out port. I also have an HDMI to Component cable with Audio Plugs. How can I get HDMI out to work with this cable when plugged into the MacBook Pro and connected to the TVs Component and Audio in ports.

    Will not work.  To my knowledge, dual converting like that isn't supported.  The Mac must detect the connected video output device and that sort of info cannot be done across an analog component uni-directional connection.

  • How can I get my ipod to work with itunes?

    When I connect my ipod classic into my new computer it seems that itunes does not recognize it. How can I get my ipod to work with itunes? I'm afraid to disconnect my ipod because the display is saying Do Not Disconnect.

    1. Update iTunes to the latest version. Plug in your iPod. If iTunes still can't recognize it, then in iTunes in the top left corner click help> run diagnostics. On the box that comes up, check the last two things. Click next and it should identify your iPod.
    2. Click on your windows start menu. Type in "services". Click on it and when it pops up, on the bottom of it click on "standard". Now Scroll down to find "Apple Mobile Device" Right click it when you see it and click on "Start". When it has started, close iTunes and replug in your iPod and it should show up.
    3. Check the USB cable
    4 Verify that Apple Mobile Device Support is installed
    5. Restart the Apple Mobile Device Service and verify that the Apple Mobile Device USB Driver is installed.
    6. If you just want to add some photos, songs and movies from computer to your devices, you can use an iTunes alternative to do the job
    7. Check for third-party software conflicts.
    <Link Edited By Host>

  • Can't get out.print to work with XML jsp tags

    <jsp:scriptlet>
    if(ErrorTrap == true) {
         out.println("<tr><td colspan=\"center\" align=\"center\">There was" an error while processing the form</td></tr>");
         ErrorTrap = false;
    </jsp:scriptlet>
    I can't get this script to work with the XML stype jsp tags. It keeps telling me the <jsp> tags are untermintaed. Is there a special trick to fix this or do I have to use the non-XML type tags?

    Sorry, I didn't mean to put the extra " in the out.println text string. :-/

  • Can't get Palm Zire to work with windows 7

    Can't get palm zire to work with windows
    Post relates to: Palm Pilot

    Please review the "stickied" threads near the top of this board, about syncing with Windows 7 and Vista.  It's all there. 
    After you've been through and tried everything there is to try, and still have problems, please post back with specific info about exactly what you've tried, what version of Windows 7 you have (32-bit or 64-bit), etc.
    smkranz
    I am a volunteer, and not an HP employee.
    Palm OS ∙ webOS ∙ Android

  • How can I get elements 11 to work with 16 bits photos?

    In the expert mode of Photoshop Elements 11, I can only work with 8 bits photos. How can I get Elements 11 to work with 16 bits photos?

    No, you can still buy photoshop cs6 (perpetual license) if one doesn't want to subscribe to the cloud version (photoshop cc version 14)
    Either way is expensive compared to photoshop elements.
    http://www.adobe.com/products/cs6.html?promoid=JOLIS

  • How can I get photoshop CS2 to work with Windows 8.1?

    how can I get photoshop CS2 to work with Windows 8.1?

    Have a look at
    http://forums.adobe.com/message/4976720
    Cheers
    John

  • How can i get ical invitations to work with outlook users?

    how can i get ical invitations to work with outlook users?
    I can send ical meeting invitations but outlook users are having problems having the meeting show up in their calendar….

    My Epson is able to do scans using Image Capture without any problems at all.
    Allan

  • How can I get Phillips Fidelio to work with ios7

    How can I get Phillips Fidelio to work with ios7. It worked with the previous operating system

    Not sure if this is the same problem others are having, but I used to play music on my Philips Fidelio by opening the Music app on my ipad and clicking on the box with the triangle (which has now disappeared in the new OS). However, if you have the philips dockstudio app, the box still appears there and I was able to get my speakers working again.

  • How can I get my iMac to work with scanners?

    How can I get my iMac to work with scanners? The scanners scan just fine, but not to my iMac. I've tried Epson and HP all-in-ones; it makes no diffference. I'm becoming extremely displeased, but don't know at whom I should be displeased, the printer guys or Apple. Help?

    My Epson is able to do scans using Image Capture without any problems at all.
    Allan

  • HT4623 iPad 3 how can l gets the SIM card works With iPad 3

    As all we know its christmas time l just received the gift for iPad 3 &amp; l notice that it need SIM card for me to use as the phone &amp; data,how can l gets the SIM card works With iPad 3

    Remember am in South Africa &amp; we got few carrier nets am in MTN provide &amp; I c my sim looks so big to fit on my iPad

  • Is there an adapter can i get so square will work with the otterbox i have on my iphone

    Is there an adapter can i get so square will work with the otterbox i have on my iphone, I love the otterbox and want to keep it on all the time. not only does it protect my iphone it, it makes it easy for me to hold because I have trouble with my hands. please help

    That's a good question. The main problem with the Square readers is that the plug is designed to send data to devices, rendering most headphone extension cables useless.
    Reading another forum I saw this: http://www.amazon.com/gp/product/B001BN7XSM
    Give that a try. Claims to work perfectly for Square. NOT headphones.

  • I can't get airport extreme to work with iPad

    I can't get airport extreme to work with iPad

    Ok, thanks for clarifying that for me. We have two distinctly different printing problems. Let's try tackling them one at a time if you don't mind.
    In order for the iPad to print to a printer it would either have to be AirPrint-enabled or you would need another solution, like PrintCentral for iPad or Printopia. Unfortunately, I don't believe your Canon printer is AirPrint-enabled. There aren't many printers on the market that currently are. All of them, that I am aware of, are HP devices.
    Now for the PC. I would go with what you have already suggested and that is try disabling either the Windows or third-party software firewall. Which version of Windows is it running? Just in case it's XP, here are two excellent iFelix articles on how to do so with or without using Bonjour.

  • Can't get the software to work with Audigy 2

    Hi, I have had my Audigy 2 ZS going on a year now and haven't had any problems. I recently made a clean install of Windows XP and upgraded to SP2 and all that. Now, I can get sound out of the card but can't get the software to work at all; cannot get the volume slider bar to appear when I click the icon (it appears in the task bar though and I get a small gray square where the slider should appear), the surround mixer does not show when I double click the volume icon, EAX conxole is a no go, get an empty error box when I try to start the Equaliser.
    I have tried everything from simple re-install to clean sweep to praying to the pagan gods. I have alsoo tried updating the drivers of course.
    I run XP on an Intel MoBo (on-boeard sound deactivated), 52RAM, ATI 9700 ALL-IN-WONDER.
    DOES THE CREATIVE SOFTWARE DEPEND ON ANY WEIRD LITTLE WINDOWS SERVICE OR SETTING THAT I MIGHT HAVE CHANGED DURING SETUP?
    This is quite infuriating as any idea I come up with takes up a lot of time in installation, uninstallation and clean up. It worked before, why not now?
    Thanks in advance. dentore

    Ok I got it to work. This is the reply I got from Creative but I didn't remove the program from the add/remove option on the PC b/c that didn't work at first. I inserted the installation CD and remove it from that wizard. Rebooted and the PC found new hardware. I then installed the driver and software from the CD and now it works.
    For Mediasource. It appears something was corrupted in Mediasource or there is a conflict within the system.Please uninstall all software and drivers for the soundcard, from add/remove programs. Once this is done, shut down the system and changePCI slots for the soundcard, then turn the system back on, cancel the found new hardware wizard, disable all background applications (especially virus scanner, firewall, and any other background applications running in the bottom right hand corner of the system), andthen perform a full reinstallation of the drivers and software from the soundcard installation cd.
    CAT I hope you fix your sound card. Good luck.

  • Can't get Report Builder to work with Apache Webserver

    I'm running ColdFusion 7.0.1 and have it configured to work
    with Apache. I've got an application named realestate. I created
    the following entry in my host file:
    127.0.0.1 realestate
    In Apache, I've created a virtual server that uses the
    realestate server name. But I can't get the Report Builder to
    connect to it at all. When I run the wizard, I try to install an
    RDS server. I've used 127.0.0.1 for the host name as well as
    realestate and I've set the port to 80. I can't get port 8500 to
    work at all. I set my ColdFusion root location to fall under
    Apache's htdocs. Should I have left it under C:\CFMX7 ? How would I
    change the location?

    Please review the "stickied" threads near the top of this board, about syncing with Windows 7 and Vista.  It's all there. 
    After you've been through and tried everything there is to try, and still have problems, please post back with specific info about exactly what you've tried, what version of Windows 7 you have (32-bit or 64-bit), etc.
    smkranz
    I am a volunteer, and not an HP employee.
    Palm OS ∙ webOS ∙ Android

Maybe you are looking for

  • Cannot connect to scanner or reinstall software

    Recenlty my  Office Jet 7210 AIO would no longer connect for scanning. I ran the HP HP Print and Scan Doctor Diagnostics tool and it sees the scanner just fine, but tells me I need to reinstall the HP Solutions software. I have tried several times to

  • Report not Running........

    Hi All, I'm using HFR 9.3.1.When i try to run a report it shows the following message : "5200 : Error executing query: localhost/sample/SampDb/admin/Error(1012703) Unknown calculation type [0] during the dynamic calculation. Only default agg/formula/

  • Help! I can't print postcards anymore.

    I am a very basic Photoshop Elements user and version 3 has been all I need. I mainly print for promotional uses, postcards being my main need. I recently purchased an Epson R280 printer and would like to use it to print postcards. When I try to prin

  • Somehow I applied Autofill options to all websites and it is interferring with creating a label in USPS. How do I get rid of it?

    I had found the Autofil area (can't remember exactly where I found it) and must have entered my own information. But now when I go on the USPS website, it Autofils my own information in the TO: section. Even though I take the information out, and put

  • HLS with Flex 4.7

      Hi,                  I am facing an issue implementing HLS with FMS 4.5 (also tried with FMS 5). I am following this article http://help.adobe.com/en_US/flashmediaserver/devguide/WSd391de4d9c7bd609-52e437a812a3725df a0-8000.html. When I am publishi