I figured out my last problem, but have I another one.

This one is difficult for me because it compiles and runs so I have trouble to pinpoint the problem. When it runs every is left blank. I will put an example under the code.
import java.util.Scanner;
import java.text.*;
public class DVDInventory33
public static void main(String[] args)
       Scanner input = new Scanner( System.in );
       int j;
      final DVD_Genre [] inventory = new DVD_Genre[5]; // Size of the array
      // create DVD object
      inventory [ 0 ] = new DVD_Genre( "Rocky", "Action/Drama", 01, 5, 9.95 );
      inventory [ 1 ] = new DVD_Genre( "RockyII", "Action/Drama", 02, 3, 14.95 );
      inventory [ 2 ] = new DVD_Genre( "Matrix", "Action/Sci-Fi", 03, 3, 14.95 );
      inventory [ 3 ] = new DVD_Genre( "MatrixII", "Action/Sci-Fi", 04, 1, 19.95 );
      inventory [ 4 ] = new DVD_Genre( "Bambi", "Family", 05, 5, 12.95 );
      // Print out a screen title
      System.out.println();
      System.out.printf("Welcome to DVD Inventory:\n\n");
      // call the sort
      sortDVD(inventory);
      for(j=0; j<5; ++j)
          System.out.printf("DVD Title: %s\nDVD Genre: %s\nProduct number: %d\nNumber of products: %d\nPrice: $%.2f\nValue of DVD's: $%.2f\n\n",
                             inventory[j].getdvdName(),
                             inventory[j].getproductnumber(),
                             inventory[j].getdvdGenre(),
                             inventory[j].getnumberofproducts(),
                             inventory[j].getprice(),
                             inventory[j].getvalueofdvds() );
                             //display the total inventory                   
     double total = 0;
     for ( j=0; j<inventory.length; j++ )
         total += inventory[j].getvalueofdvds ();
} // end for
         System.out.println ("The entire inventory value is : $" +total);
         System.out.println ("The restock fee is : $" +total * .05);
public static void sortDVD(DVD[] inventory)
     DVD_Genre temp[] =  new DVD_Genre[1];
      int i, j;
      for (i=1; i <inventory.length; i++)
         for (j=0; j < inventory.length-i; j++)
            if (inventory[j].getdvdName().compareTo(inventory[j+1].getdvdName())>0)
               // exchange elements
               temp = new DVD_Genre [1];
               inventory[j] = inventory[j+1];
               inventory[j+1] = temp [0];
   }//end method main
}//end DVDInventory33
      class DVD
      protected String dvdName; //  DVD title
      protected String dvdGenre; // DVD genre
      protected int productnumber;  // DVD product number
      protected int numberofproducts; // the number of products in stock
      protected double price; // the price of the products in stock
        public DVD (String name, String genre, int productnumber, int numberofproducts, double price ) // class dvd constructor
        dvdName = "";
        productnumber = 0;
        numberofproducts = 0;
        price = 0;
      public void setdvdName( String name ) // method to set dvd name
      this.dvdName = name; // store the dvd name
      public String getdvdName()// method to get dvd name
      return dvdName;
      public void setproductnumber( int productnumber )  // method to set productnumber
      this.productnumber = productnumber; // store productnumber
      public int getproductnumber()// method to get productnumber
      return productnumber;
      public void setnumberofproducts( int numberofproducts )// method to set numberofproducts
      this.numberofproducts = numberofproducts; // store numberofproducts
      public int getnumberofproducts()// method to get numberofproducts
      return numberofproducts;
      public void setprice( double price )// method to set price
      this.price = price; // price of the products in stock
      public double getprice()// method to get price
      return price;
      public double getvalueofdvds()// method to get valueofdvds
      return numberofproducts * price;
} // end class DVD
class DVD_Genre extends DVD
         private String genre; // genre of DVD
      private double restockingFee; // percentage added to inventory value
       //constructor
     public DVD_Genre(String name, String genre, int productnumber, int numberofproducts, double price)
           super(name, genre, productnumber, numberofproducts, price);
                genre = genre;
      public void setdvdGenre( String genre ) // method to set dvd genre
      this.dvdGenre = genre; // store the dvd genre
      public String getdvdGenre()// method to get dvd genre
      return dvdGenre;     
     // Calculates restocking fee based on previous data.
    public double restockFee() {
         double total = 0;
         double restock = 0;
         total = numberofproducts * price;
         restock = total * .05;
            return restock;
}// End class DVD_GenreExample of Output:
DVD Title:
DVD Genre: 0
Product number: null
Number of products: 0
Price: $0.00
Value of DVD's: $0.00
The entire inventory value is : $0.0
The restock fee is : $0.0
I am trying to find where the problem lays.

And the DVD/DVD_Genre parent/child looks fishy.
A DVD_Genre is a special kind of DVD? It's a kind of DVD that, unlike a regular DVD, has a genre and a restock fee? What's the connection beetween genre and restock fee? Regular, non-genre DVDs don't have restock fees? Why would one create a DVD with no genre?

Similar Messages

  • I want to sign out of current apple id and into another one but I no longer have access to my current email address so I cannot log out

    I want to sign out of current apple id and into another one that I own but I no longer have access to my current email address so I cannot log out (It is with an internet provider who I have just unsubscribed with)  This is on an iPhone 5S, on iOS 8.1.

    That email address is still a valid Apple ID. If you do not remember the passcode, sign onto Manage your Apple ID (Apple - My Apple ID) with that email address, and then click on Reset Password. You will be asked to answer your Security Questions in order to reset the password. If you do not remember the answers to your Security Questions, contact Apple Support to reset them for you:
    ACCOUNT SECURITY CONTACT NUMBERS
    Cheers,
    GB

  • HT5114 I lost my iphone 5 without signing out my account but I have bought another one. How can I make sure that the person in possesion of the phone is not using my account to make purchases? ?

    I lost my iphone 5 without signing out my account but I have bought another one. How can I make sure that the person in possesion of the phone is not using my account to make purchases? ?

    Thanks for your prompt response... will changing my password also stop the authomatic download of my new applications and music from downloading to the stolen phone?

  • I filmed several takes of the same scene for a movie. I trimmed the best clips from each take and put them into the project screen. However, I can't figure out how to make it flow seamlessly as one scene. Can someone please help me??

    I filmed several takes of the same scene for a movie. I trimmed the best clips from each take and put them into the project screen. However, I can't figure out how to make it flow seamlessly as one scene. Can someone please help me??

    1-800-676-2775  apple support   tech support 1 800 275 2273
    If your computer is on one minute before it freezes, than you have one minute to secure your serial number.
    click the apple----->click about this Mac ------> click on version----> until you see the serial number.  You may have to do this a couple of times if it freezes before you have all the numbers.  A camera might help.
    Good Luck

  • I have forgotten my apple id, I have created another one but my phone will still not let me access anything, anyone have an idea how to do it?

    I have forgotten my apple id, I have created another one but my phone will still not let me access anything, anyone have an idea of how to do it?

    Do what?
    "will still not let me access anything" is very vague.
    What exactly is it that you want?

  • Trying to figure out which older GPIB I have

    I have an old GBIB I want to put in a new Dell computer, Win2000. I know I need to download new drivers, but can't figure out which ones. The GPIB is marked 429C(handwritten) 488EX. A small sticker is marked NEC REV Q 0295. Thanks.

    Hello,
    Sometime's it's the simplest answer.
    We were told our computer had a NI GPIB. After your response, I checked again and found CEC on the board. A quick internet search and I found the manufacturer.
    Thank you for your quick response. I really appreciate it!

  • Figuring out how many songs i have in itunes? (and ext drive question)

    I am looking to buy a new ipod but am not sure about the nano vs the regular video one... we already have 1 video one, so i thought one of each might be nice, but the 8 GB nano only holds 2000 songs for the same price as a 30GB ipod...so, I would like to figure out how many songs we currently have in itunes in order to see if we are at the 2000 song mark already, but am not sure how, short of counting them (ugh!)
    Also, if I purchase an external drive for itunes (and some photos & documents), how to know what amount of memory i need?
    Thanks!

    There's a BIG difference between the iTunes application and the Music that you've loaded into your iTunes library.
    Your music is normally stored in the Music folder which should be listed in iTunes>Preferences>Advanced.
    By the way... you should be able to see how many songs are in your Library, as well as how much space they take and how long it would take to play them all at the bottom of the iTunes window.

  • Telnet can't figure out route to host, but only on certain ports?

    This only occurs under 10.5. In 10.4.11, I can hit the server on both ports through telnet.
    telnet <server> 510
    Trying <server>...
    telnet: connect to address <server>: Connection refused
    telnet: Unable to connect to remote host
    telnet <server> 80
    Trying <server>...
    Connected to <server>.
    Escape character is '^]'.
    fetch
    HTTP/1.1 400
    Date: Sun, 06 Jul 2008 03:06:15 GMT
    Content-Type: text/html
    <html><head><title></title></head>
    <body>
    fetch: 0
    </body></html>
    Connection closed by foreign host.
    Here's the strangest part:
    ping <server>
    PING <server> (ip): 56 data bytes
    ping: sendto: No route to host
    ^C
    --- <server> ping statistics ---
    1 packets transmitted, 0 packets received, 100% packet loss
    How come it can figure out the route when using port 80, but not when using port 510? And is the inability to figure out the route the reason why Wireshark shows ZERO outgoing packets on port 510 when it fails to connect?
    And why only on certain IPs? If I use "edu.yorku.ca", I can connect via telnet on both 80 and 510.

    orangekay wrote:
    So it works if you supply a FQDN but not an IP? Are you certain that the IP you're using is valid? There may be some DNS trickery going on behind the scenes.
    No, it only connects when I hit the server on port 80. Using IP or FQDN doesn't seem to make a difference.
    If I try to use Network Utils to do a trace route, it too says no route to host.
    I've got a G4/ppc running 10.4.11 attached to the same router, and it has no issue hitting the server on any port, and can do a trace route as well.

  • How to figure out in which albums you have your picture

    I'm coming from iViewMedia Pro and in there, it was very easy to see in which folder a picture was stored in. Just a click on the image, and the folders it was in, turned bold.
    However, I have not figured out, how to see all the albums a picture is in with Aperture. Any hints?
    Thanks

    At the time, there is no option to show in which other albums an image is just by selecting it. Since an image only live in a specific project, there is a way to show which project. Here's how you do it:
    In the Metadata pane, select "Tooltips" from the drop down list.
    Click the "Other" button at the bottom of the pane. This will take you into edit mode. Then add "Project" to the Tooltips list by checking it.
    Now, when you go back to your albums and hover over an image you can press "T" to toggle the Tooltips and it will show you in which project the hovered image lives in.
    Regards
    Paul K

  • Does anyone know if there is any difference at all in the display between the 4 and the 4s.  I use my 4 with no problems but have issues with the 5 - makes me feel ill.  Any help appreciated before I make an expensive mistake

    Can anyone tell me if there is any difference at all in the display between the 4 and 4s.  It appears they are the same from the specs but I dont want to make an expensive mistake.  I can use the 4 with no problems but the 5 makes me feel ill and I am hoping I can upgrade to a 4s with no issues. Any help appreciated.

    In a technical sense, the differences between the displays on the iPhone 4 vs 4s are vast.  I'm mean, they are both attached to 70 - 90% of the internal components and far from interchangeable.  There are no differences however, that are noticeable by the user.

  • My iPhone is still displaying my old Apple ID and I can't figure out how to change it to my new one?

    I have an iPhone 4s and it keeps asking me to sign in using my old Apple ID and I have a new(ish) Apple ID that I've been using for several months, since before I even got the iPhone, but it's still not using my new ID. The new ID is on my iTunes and iPod, but isn't on the iPhone. I can't figure out how to edit or change my Apple ID in the settings. Help me?

    Hi,
    I have the same exact problem, and I see no one has posted a correct answer for you.  Alexbird's reply didn't help.  Can someone give us the correct answer?
    My old email address is on my new iPhone 4s, and I can't change it.  In the store on the iPhone 4s it correctly has my new email address.  iTunes also correctly has the new email address.
    I can't update my apps because the old email address is stuck in there, and no password is being accepted.
    (By the way, as much as I attempted to read all of the warnings online about how to back-up and transfer data from my iPhone 3gs to my iPhone 4s, sure enough apps were lost.  I wish instructions on 'Fingertips' had been clearer)
    Thanks!

  • 10.5.2 fixed old problems, but caused many new ones!

    I had many of the problems reported using Leopard, including multiple daily OS crashes. After they released 10.5.2, I did an ERASE and INSTALL, reinstalled Leopard and performing all of the updates in a timely manner, repairing permissions after each update, etc. After re-installing all of my apps, including FCP Studio 2, I started to test everything. First thing I noticed was that upon opening iPhoto, iTunes, Final Cut Pro and Soundtrack Pro...there were no windows that opened! All of the apps opened, but displayed no windows that went along with the apps. I made sure that all of the windows were "active" in the menu bar, but none of them showed up on the screen. After a re-start, I got most of the apps windows to appear(iPhoto was still not working). Now keep in mind, I had never had anything like this happen in 10.5.1. I also began to notice a 1-pixel-thick horizontal line that appeared on the lower third of my screen, either just on the desktop picture, or sometimes just in the current open application window. Sometimes the line was a solid green, other times it was broken up and black. I also just experienced another "screen going black" OS crash...if that's what it was.
    I have been using Apple's products back when I was mocked for buying anything Apple, and I have never had problems like this until they became "mainstream". It seems the more popular Apple becomes, the worse the quality of their products becomes. At least in their "computer" branded products. Anyone else experiencing this?

    Sorry but I've not seen anything like this. I've upgraded my own personal entourage of computers to Leopard (we have 5 at home), at work (a lab of 25 plus at least 10 staff members), and helped or advised a slew of friends and customers.
    Have I seen problems? Yes but all of them have been attributable to known factors and fixable. The default Upgrade mode turns out to be a big no no with Leopard. Running old utilities that require updates or upgrades are another. Marginal RAM reared its ugly head again, though not as badly has it has in the past. I recall one issue that I tracked down to a very full hard drive - I recommend leaving at least 10% or 10GB free which ever is bigger.
    Your mention of the horizontal line could indicate a hardware problem. Running the hardware diagnostics disk would be a good idea. Unfortunately, the tool that Apple gives us is 100% reliable at indicating there is a problem but sometimes a problem does exist and the program fails to flag it. This is particularly true of RAM, so you should keep this in mind as you move forward.
    If you pass the diagnostics test, I'd say (ugh) format and reinstall only OS X. Unplug everything but the mouse and keyboard and keep it that way until near the end of your rebuild process. Go online, configure your email, and see if things are okay. If so, while online check out the status of updates of all your software. Download as needed. Now slowly install new software and test the computer a bit before going on to the next. Slowly add peripherals and their drivers. WIth luck, all will go well this time. If not, by taking it slow and testing at each step, you should be able to isolate the offending culprit.

  • Can I figure out the last numbers I stored on my phone? I got a persons number and store it in my phone but don't remember the name

    I met someone last weekend and I stored the number in my phone but don't remember the person's number. My phone has tons of numbers so it's impossible to tell which one is hers. Is it possible to tell which are the last numbers I added to the phone?

    Did you download it to iTunes?
    If so, connect your iPhone to your computer and open iTunes. Click on your iPhone and navigate to the Tones tab. Be sure to click in the box next to Sync Tones and mark the ones you want on your phone. Then click on the Apply button and you should be all set. Once your iPhone finishes syncing, open your iPhone and choose settings > sounds > Ringtone. In the listing of possible ringtones you should see the ones you just added at the top of the list. Tap the one you want to use for your main ringer and it is a done deal.

  • Journalctl--Can't figure out hp-config_usb_printer problem

    My CPU is maxing at 100%. I ran 'top' to find out what is taking up my CPU and found that systemd-journal is taking it up. I found a post that said to run '# journalctl -f' to find what errors are being run. I am finding this error:
    Nov 17 14:05:09 RyansLinuxBox hp-config_usb_printer[309]: Would you like to specify the path to the correct PPD file to use (y=yes, n=no*, q=quit) ?
    I get around 100 of this exact message every minute. I searched around and couldn't find out what's wrong. I don't have my HP printer plugged in, I uninstalled 'hplip' and removed my printer from CUPS. What on earth could be the problem?
    Last edited by ryanmichaelmcclure (2013-11-17 19:14:50)

    I'm having a similar issue. I *do* have my HP printer connected and turned on. I'm trying to add it to CUPS via the web interface (the machine in question is a headless server). Using journalctl --follow, I've noticed that the flood of that message starts after I select the  printer and click "continue".  The next steps take a long time to load, but they do go seemingly fine, until I select the driver and go to the next page, where I get "Failed to add printer: Broken Pipe"
    My best guess is that HPLIP is broken... no surprise since it's HP. Though, why this would still be plaguing you after uninstalling HPLIP, I'm not sure, as pacman -Qo /usr/bin/hp-config_usb_printer shows that it is owned by the HPLIP package. What command did you use to remove HPLIP? pacman -Rns?

  • Help figuring out a makepkg problem (Song-bird)

    I've tried today to make a package based on AUR PKGBUILDs of Song-bird. I'm a bit confused since I don't know whether I've got a problem or there's something wrong with the package alternatively the download.
    Anyway this happens all the time with both Song-bird and the nightly build in AUR:
    HTTP-begäran skickad, väntar på svar... 200 OK
    Längd: 19727562 (19M) [binary/octet-stream]
    Sparar till "Songbird_0.4_linux-i686.tar.gz".
    2% [>                                                        ] 471 219      158K/s             wget: progress.c:972: create_image: Försäkran "p - bp->buffer <= bp->width" falsk.
    /usr/bin/makepkg: line 455: 18013 Avbruten (SIGABRT)      $dlclient "$netfile"
    ==> ERROR: Failure while downloading Songbird_0.4_linux-i686.tar.gz
    I don't know what affect the line 455 has on this, but to make it easier here it is:
    local netfile
        for netfile in ${source[@]}; do     <-----this is line 455
            local file=$(strip_url "$netfile")
            if [ -f "$startdir/$file" ]; then
                msg2 "$(gettext "Found %s in build dir")" "$file"
                cp -s --remove-destination "$startdir/$file" "$srcdir/"
                continue
            elif [ -f "$SRCDEST/$file" ]; then
                msg2 "$(gettext "Using cached copy of %s")" "$file"
                cp -s --remove-destination "$SRCDEST/$file" "$srcdir/"
                continue
            fi
    I don't have any issues with other packages, or at least not the ones I've made until today. On a previous Arch system I didn't have any problems with Song-bird.
    For clarity: I'm making it as user, fakeroot, in my home folder, and I've got all permissions for it (I did have permission problems at the beginning of this ftp-install, but that's a know issue, so that has been korrekted and /tmp also has 1777 permissions). Still something doesn't work out right.
    Help appreciated.
    Regards,
    KimTjik
    Last edited by KimTjik (2008-02-18 20:15:44)

    Hm, something seems wrong here, but I don't know what. wget ends with the same error, but downloading through FireFox works.
    Honestly, I don't know what to fix or how.
    Edit: after some more search I see that other also have a problem with this: http://bbs.archlinux.org/viewtopic.php?id=43406 and bug report: http://bugs.archlinux.org/task/9299
    Last edited by KimTjik (2008-02-18 20:37:20)

Maybe you are looking for