Explore BrainMass

Explore BrainMass

    Using arrays in Java

    Not what you're looking for? Search our solutions OR ask your own Custom question.

    This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

    Use existing Java Program...

    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.
    ? Post as an attachment

    © BrainMass Inc. brainmass.com December 15, 2022, 6:44 pm ad1c9bdddf


    Solution Preview

    I have attached a java file that does what is described above. I have added comments in the code to help clarify what was done. There are a few key points.

    In order to have an array of items in Java you ...

    Solution Summary

    In this solution I demonstrate how to use arrays in Java. I also present fundamental Object Oriented Design principles in using methods to encapsulate common behavior as class methods rather that repeating code in the main program.