Inventory Program Pt 2 - I have most of it, but I can't get it finished.

Hello. I am currently stumped. I am already a day late with this assignment and I cannot figure out the logic to use to calculate the overall value of the entire inventory. I'm pasting my code here in the hopes that someone can tell me what it is I'm not thinking of. I also need to do a bubblesort to display the inventory sorted by name of the computer game listed; with several arrays, I don't know how I'm going to keep the related information together. Please help!
/*                       Inventory Program Part 2
Modify the Inventory Program so the application can handle multiple items. Use an
array to store the items. The output should display the information one product
at a time, including the item number, the name of the product, the number of units
in stock, the price of each unit, and the value of the inventory of that product.
In addition, the output should display the value of the entire inventory.
Create a method to calculate the value of the entire inventory.
Create another method to sort the array items by the name of the product.   */
package InventoryPart2; // Comment out later
import java.util.Scanner; // Program uses class Scanner to accept user input
public class InventoryPt2 // Main method begins execution of Java application
     public static void main (String args [])
        // create Scanner to obtain input from command window
          Scanner input = new Scanner( System.in );
        computerGame gameInfo = new computerGame(); // Instantiates the computerGame object
        invValue inventoryValue = new invValue(); // Instantiates the invValue object
        // Initialize arrays for storage of inventory information
        // Need to perform bubble sort on each array in an index-controlled loop
        String gameNumber[] = new String[100];
        String gameName[] = new String[100];
        int gameStock[] = new int[100];
        double gamePrice[] = new double[100];
        double gameStockVal[] = new double[100];
        // Show Program Welcome Message
     System.out.println(); // White space
     System.out.println( "Welcome to the Computer Game Inventory Program!!!");
        System.out.println();
        System.out.println( "      Copyright 2009 by Some Guy");
        System.out.println(); // White space
     System.out.println(); // White space, again
          // Prompt for the number of games
          System.out.print( "How many different computer games are you entering? "); // Prompt for input
          int maxCount = input.nextInt(); // Read input
          input.nextLine(); // Clear-out
        int counter = 0;
        do // Begin a loop to collect information about each game entered
        System.out.println();
        System.out.print( "Please enter an item ID number: ");
        gameInfo.setNumber(input.next());
        gameNumber[counter] = gameInfo.getNumber();
        System.out.println();
        System.out.print( "Please enter a name for the game: ");
        gameInfo.setName(input.next());
        gameName[counter] = gameInfo.getName();
        System.out.println();
        System.out.print( "Please enter the number on-hand: ");
        gameInfo.setStock(input.nextInt());
        gameStock[counter] = gameInfo.getStock();
        System.out.println();
        System.out.print( "Please enter the price of this game: $");
        gameInfo.setPrice(input.nextDouble());
        gamePrice[counter] = gameInfo.getPrice();
        System.out.println();
        gameStockVal[counter] = gameInfo.thisItemVal();
        counter = counter + 1;
        while ( counter < maxCount ); // End loop
        counter = 0;
        //double totalValue = 0 + gameStockVal[counter];
        do
        System.out.println( "          Item number: " + gameNumber[counter] );
        System.out.println( "            Game name: " + gameName[counter] );
        System.out.println( "      Number in stock: " + gameStock[counter] );
        System.out.print  ( "           Price each: $" );
        System.out.printf( "%1.2f", gamePrice[counter] );
        System.out.println();
        System.out.print  ( "Total value this item: $" );
        System.out.printf( "%1.2f", gameStockVal[counter] );
        System.out.println();
        System.out.println();
        counter = counter + 1;
        while ( counter < maxCount );
        System.out.print( "The total value of all inventory is: $" );
        System.out.printf ( "%1.2f", ??? );
        System.out.println();
        System.out.println();
    } // End main method
} // End class InventoryPt2
class computerGame
    private String number; // Declaration of variables
    private String name;
    private int stock;
    private double price;
   public computerGame() // Default constructor
        number = "";
        name = "";
        stock = 0;
        price = 0.00;
    // Parameterized constructor
    public computerGame( String number, String name, int stock, double price )
        this.number = number;
        this.name = name;
        this.stock = stock;
        this.price = price;
    public void setNumber ( String number ) // Method to store and return the game's ID number
            this.number = number;
        String getNumber()
            return number;
    public void setName ( String name ) // Method to store and return the game's name
            this.name = name;
        String getName()
            return name;
    public void setStock ( int stock ) // Method to store and return how many of a game are in stock
            this.stock = stock;
        int getStock()
            return stock;
    public void setPrice ( double price ) // Method to store and return a game's price
            this.price = price;
        double getPrice()
            return price;
    public double thisItemVal()
            return ( stock * price );
class invValue
    double totalValue;
    public invValue() // Default constructor
        totalValue = 0.00;
    public invValue( double totalValue ) // Parameterized constructor
        this.totalValue = totalValue;
    public void setValue ( double totalValue )
        this.totalValue = totalValue;
    public double getValue()
        return totalValue;
}

This is a place to ask questions, not a place for others to complete your homework. Accept the grade and learn from your mistake/s. Gl with the future.
Mel

Similar Messages

  • HT5621 I have changed my AppleID but I can't get the "system preferrences" to show my new AppleID.  What am I doing wrong?

    I have changed my AppleID but I can't get the "system preferrences" to show my new AppleID.  What am I doing wrong?  I am running 10.9.2.  I support multiple devices on this icloud account and they all work fine.  Its just the mac mini ...

    I found a post with the answer.  Basically I just logged out of the iCloud.  My concern was that I would loose my contacts.   But when i logged back in with the correct AppleID -- it was all there.
    Thanks!

  • My iPhone 4s Bluetooth is not working, I have ios 5.1 but just can't get my Sony erricson hbh-pv715 headset to connect to the phone,  the phone can't find any Bluetooth device, can you help please

    My iPhone 4s Bluetooth is not working, I have ios 5.1 but just can't get my Sony erricson hbh-pv715 headset to connect to the phone,  the phone can't find any Bluetooth device, can you help please

    Yes it's in pairing mode, it worked fine with the 3GS but doesn't seem to work with the 4s,  my 4s can't find any other bluetooth device, I think the problem ls with apple?

  • I have a network connection but I can't get email or a webpage?

    I have a network connection but I can't get email or a webpage?

    Phone and messages is a carrier issue. Sprint needs to check your account to make sure it is set up correctly. If everything looks good on their end, then do a reset on the phone, hold the sleep/wake and home buttons together until you see the Apple logo and then release. After the phone restarts, try it.

  • HT1222 Can I update my Old iPod touch 4.2.1 version to the IOS 5 or 6? It says i have the current version but I can't get my apps ...such as Netflix

    I'm trying to get the iOS 5 or 6 update to my ipod touch version 4.2.1
    My ipod says it's up to date but I can't get my netflix app to load becuse it says I need the iOS 5 software
    Does this mean that my Ipod touch is no longer any good???
    Any help is appreciated, thanks!
    Candice

    I used to be able to get Netflix and other apps on my ipod but since they have been upgraded to ios 5 + I can no longer get them. "
    You updated your Netflix app without seeing if the new version was compatible with your ios version. Had you not updated, then you could still be using it.
    " So I gather by your response and other similar questions/answers that I am out of luck now."
    Yes.
    Sorry

  • Others have succeeded at this but I can't get it ro work...

    Trying to incorporate tinyMCE into Flex 3 I have added the following section
    to my applications html file:
    <!-- TinyMCE function -->
    <script type="text/javascript" src="C:\Users\Scott\Downloads\tinyMCE Install\jscripts\tiny_mce\tiny_mce.js"></script>
    <script type="text/javascript">
    tinyMCE.init({
        mode : "textareas"
    Is this correct?
    Nothing happens when the button that starts the tinyMCE editor is pressed:
            <mx:VBox height="69" width="696" id="vbox_MethodEdit">
                <mx:Button label="Zubereitung" click="PrepEdit(event)"/>
                <mx:TextArea height="37" width="689" id="taZubereitung"/>
            </mx:VBox>
    Her's the eventhandler:
                // Handles the editing of the preparation section by calling tinyMCE
                private function PrepEdit(event:MouseEvent):void { 
                   //Alert.show("PrepEdit:  entry point");
                   var s:String;
                   if (ExternalInterface.available) {
                      Alert.show("Wrapper available")
                      //var wrapperFunction:String = "changeDocumentTitle";
                      //s = ExternalInterface.call(wrapperFunction,ti1.text);
                      s = flash.external.ExternalInterface.call("tinyMCE.init");
                      //s = ExternalInterface.call("tinyMCE.init");
                   } else {
                      s = "Wrapper not available";
                      //Alert.show("Wrapper not available")
                // PrepEdit
    As you can see I have been doing alot of experimenting around but the editor
    does not start.  Alert.show("Wrapper available") executes and then all is
    still.
    Alot of people have entered posts about how easy all of this is to accomplish
    but I can't find a single example of exactly how to do it.
    Can anyone help?
    Thanks,
    Scott

    You are mixing up a couple of things here.
    The TC drive cannot be partitioned without removing it.. did you do that?
    If you partition it you must use a Mac disk utility and use the HFS+ ie standard Mac format. And GUID partition table not windows type.
    You can select erase disk in the airport utility.. that will take the disk back to original format. No partitions. TC is deliberately not partitioned as it is not a media server.. it is a backup device for TM. Over time .. the disk will be filled with TM backups so you have a long history of file changes to your computer.
    There is no media server in the TC.. it is merely disk storage.. you can serve files from it to a media device.. but the TC itself is dumb as dumb.
    Now the actual format of the drive is irrelevant to the PC.. The TC offers SMB file services to the network. You can copy files to and from the TC as if it was a local disk without caring one iota about the format. The TC handles that .. it is not a local disk .. it is a network drive.
    Although you cannot partition the TC. you can still copy files to it.. this does have implications for TM.. but as long as there is plenty of free space should not be a major issue.
    You can create a disk image via the disk utility in a Mac.. and as stated you can create partitions if you do it on a Mac with the disk directly connected which means breaking warranty if any exists on the TC.

  • I can not get my facetime to work. I have a wireless connection but I can not get my facetime to work

    I can not get my facetime to work. I have a wireless connection but it is not working.

    Doublechecking, Jensen. What's the precise text of your error message, please? (There's a few different ones I can think of that you might be getting.)

  • HT4623 I HAVE AN IPAD ONE BUT I CAN NOT GET MY SOFTWARE TO UPDATE PAST 5.1.1

    does anyone know what I can do to update to the lastest software so i can use most recent apps?

    That's as far as your model will go:
    See the chart below to determine whether you can upgrade your device and what you can upgrade to. If you do not have a Software Update option present on your iDevice, then you are trying to upgrade to iOS 5 or higher. You will have to connect your device to your computer and open iTunes in order to upgrade.
    IPhone, iPod Touch, and iPad iOS Compatibility Chart
         Device                                       iOS Verson
    iPhone 1                                      iOS 3.1.3
    iPhone 3G                                   iOS 4.2.1
    iPhone 3GS                                 iOS 6.1.x
    iPhone 4                                      iOS 7.0.x
    iPhone 4S                                    iOS 7.0.x
    iPhone 5                                      iOS 7.0.x
    iPhone 5c                                     iOS 7.0.x
    iPhone 5s                                     iOS 7.0.x
    iPod Touch 1                               iOS 3.1.3
    iPod Touch 2                               iOS 4.2.1
    iPod Touch 3                               iOS 5.1.1
    iPod Touch 4                               iOS 6.1.x
    iPod Touch 5                               iOS 7.0.x
    iPad 1                                          iOS 5.1.1
    iPad 2                                          iOS 7.0.x
    iPad 3                                          iOS 7.0.x
    iPad 4                                          iOS 7.0.x
    iPad Mini                                      iOS 7.0.x
    iPad Air                                        iOS 7.0.x
    =====================================
    Select the method most appropriate for your situation.
    Upgrading iOS
       1. How to update your iPhone, iPad, or iPod Touch
       2. iPhone Support
       3. iPod Touch Support
       4. iPad Support
         a. Updating Your iOS to Version 6.0.x from iOS 5
              Tap Settings > General > Software Update
         If an update is available there will be an active Update button. If you are current,
         then you will see a gray screen with a message saying your are up to date.
         b. If you are still using iOS 4 — Updating your device to iOS 5 or later.
         c. Resolving update problems
            1. iOS - Unable to update or restore
            2. iOS- Resolving update and restore alert messages

  • I have home sharing enabled but still can't get my library to show up on my newly authorized computer, I have a lot of songs imported from CD's, never had to use itunes match or before, please help if you can

    I cannot get my library to show up on my newly authorized computer, please help if you can.
    I have home sharing enable on old computer and new one. 
    If I try to sync --I  get the message that ipod can be synced w only one computer and if I sync with this library (which only shows new purchases from itunes)   it will replace everything that is currently on ipod

    Why can't the songs be transferred to the device?  Is it because they are not authorized?  Were these 25 tracks purchased/downloaded with the same account you have used to authorize the PC/new iTunes library?
    Have you seen this article yet?
    iTunes repeatedly prompts to authorize computer to play iTunes Store purchases
    B-rock

  • Possibly a very basic question but I have set up a spread sheet in Numbers and have viewed help videos but I can't get it to give me sums for the columns I highlight.  Keeps coming up with the figure zero.  I have version 09 2.3(554). Can anyone help

    Possibly a very basic question but I am going nowhere without a solution.  I have set up a spreadsheet in Numbers but it won't give me sums for chosen columns. I  have viewed the run through videos and used the formula but nothing happens apart from giving a figure of zero or a red arrow.  The sum icon in the bottom left hand section of the window does not highlight or show any total as I understand from the video that you can drag whatever total is here onto the relevent position on your spreadsheet.  I have Numbers 09 version 2.3 (554). Can anyone advise. Thanks.

    Hi Sohojools,
    To sum a column, use a formula such as this one in Cell A6
    Type this in a cell below your data:
    =SUM(A2:A4) or whatever range of cells you want to sum. The easy way is to type:
    =SUM(
    and then drag or shift-click to select the range of cells. Close the formula with a final bracket ")".
    The sum icon in the bottom left hand section of the window does not highlight or show any total
    To see the sum (and other simple statistics) in the bottom left, select a range of cells. That tells Numbers which cells you are refering to.
    The videos are good, but the Numbers'09 User guide, and the Formulas and Functions User Guide are better. Download them from the Help Menu in Numbers.
    Regards,
    Ian.

  • HT1752 I have an IMac OSX and a 2013 MacBook air and I want to use the screen on my IMac.  I have connected the cable but I can't get the IMac screen to connect to my MacBook

    I have an IMac OSX and a 2013 MacBook Air and I want to use the screen on my IMac.  I have purchased the cable and connected, but the IMac will not connect to my MacBook.  I have tried the Command/F2 but it does not work.  Any help would be appreciated.

    Target Display Mode 2009 & 2010 iMacs
    Target Display Mode 2011 & Later iMacs
    iMac- How to use your iMac as a Target Display Mode display
    Target Display Mode- Frequently Asked Questions (FAQ)

  • HT4623 I have an iPhone 4 and have installed iOS 7, but I can't get past the setup. It gets hung up on agreeing to terms and conditions. Anyone know how to fix?

    The setup hangs up at 'agreeing to terms and condtions'. Anyone know how to fix?

    I seem to have gotten around the issue. I set the date of my iPad to 1 month prior (July), restarted the iPad, and the session timeout blockade went away.  Many folks are saying this worked if they changed the date on their Mac or iPad or whatever device they were using for the update.

  • I have mozilla thunderbird email but I can't get any new emails.

    I've had Mozilla thunderbird for quite a while and have never had any problem with my emails. however, I now can't receive any a all and the 'green bar' is just moving backwards and forwards with the message 'downloading message 1 of 30' but the emails never download. I've been in touch with EE who are my internet provider and they say I'll have to ask Thunderbird.
    they've given me my IN and OUT plus IN and OUT port but I don't know what else to do.
    any idea?

    http://kb.mozillazine.org/New_messages_do_not_appear

  • I have a gmail account but I can't get to in on Firefox, only on IE.

    Ihave gmail bookmarked on Firefox but when I log on I am asked to open an account. I can get straight to my account on IE but I prefer Firefox.

    Recovering your iTunes library from your iPod or iOS device: Apple Support Communities

  • I have Windows on here but I can not find Boot Camp l me at 229-300-8915 I need someone that I can talk to, so i can understan how to do boot camp 4.0 for windows installment

    Hello Guys I need help it is Urgent to I can not get no where with the tech Support they are not willing to help me unless I pay Money to do so Apple is not a good product when u can not pay to have them Help me I am trying to get Boot Camp set up so i can set up Window 7, I have the updated Verison of Boot Camp which is 4.0 everytime i try and get Boot Camp Assistant to work at one point of the Installation it asked to highlight 0.4 Boot Camp which I did and when I clicked ok It un did Boot Camp so I have windows on here but I can not get to Drivers over to Windows without Boot Camp and I can not get the connection on the Window Side please can Someone please Call and help me my Number is xxxxxxxxxxxplease this is Urgent matter thanks Michelle
    P.S I don't understand the instruction on this please help me somone
    <Edited By Host>

    It is difficult to understand your issue from your discription. I have three suggestions.
    1. Visit the Boot Camp forum. You posted in the Mac Book Pro forum about your Boot Camp issue. The Boot Camp gurus hang out in the Boot Camp form. https://discussions.apple.com/community/windows_software/boot_camp
    2. Read the Boot Camp installation guide. http://manuals.info.apple.com/en_US/boot_camp_install-setup_10.7.pdf
    3. Do not post personal information such as phone numbers in public forums.

Maybe you are looking for