Storing Information with Java

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kajukenbo55
    New Member
    • Mar 2008
    • 1

    Storing Information with Java

    Hi, I am not "getting it" with Java nearly as quickly as I should. I am writing an inventory program and I need to create a DVD inventory program that will display the following; I need to create a product class that holds the item number, name of DVD, how many I have in stock, as well as the price per DVD. Then I need to show the value of my inventory.

    I am so lost, can anyone help? I have this so far:

    package InventoryProgra m;

    import java.util.Scann er;


    public class InventoryProgra m {

    /**
    Inventory Program for DVD's
    */
    public static void main(String[] args) {

    Scanner input = new Scanner( System.in);
    String movie_dvd; //dvd movie name
    String item_number; //dvd item number
    String stock_dvd; //dvd quantity in stock
    String cost_dvd; //price per dvd
    int sum;

    System.out.prin tln("Enter Movie's Inventory Number and Name");
    movie_dvd = input.next(); // prompt
    System.out.prin tln("Enter DVD's Product Number");
    item_number = input.next(); // prompt
    System.out.prin tln("Enter Quantity Available in Stock");
    stock_dvd = input.next(); // prompt


    System.out.prin tf("The Movie Name is %s", movie_dvd); // display DVD name
    System.out.prin tf("The DVD's Product Number is %s", item_number); // display product number

    System.out.prin tf("There are %s", stock_dvd, " available"); // display available total

    System.out.prin tf("The Value of DVD Inventory is %d\n", sum); // display total of inventory

    Thanks so much, Vickie



    }
    // end main method
    }
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    I don't want to disappoint you but you are the umpiest who comes up with this.
    Look at the top right of this page and search for "DVD inventory" and you'll see
    how all the other victims like you did this assignment.

    kind regards,

    Jos

    Comment

    • BigDaddyLH
      Recognized Expert Top Contributor
      • Dec 2007
      • 1216

      #3
      Don't worry about parsing input at first. That's the least important (although most tedious) part of a console-based program. Concentrate on defining the classes first. Start small:

      [CODE=Java]public class DVD {

      }[/CODE]

      Small enough? Then choose a use case. Come up with a test for it, then code the test and implement code to pass the test.

      Comment

      Working...