I really appreciate all your help so far. I have been able to create a class product, then create a java application that invokes the class product. Now I have to take the application and the data thats in it and store this date in arrrays. I have the arrays initialized, I am just not sure how to assign the data into the arrays and print the information to the screen. Any ideas or direction would be appreciated.
Here is what I have thus far. This code compiles and displays the data I want it to display. But I do not think I am actually using the arrays in the program. I think they are waiting on me
// Fig 1.6 Inventory2.java
//create an Inventory object using array of products
public class Inventory2
{
// main method begins execution of Java application
public static void main( String args[] )
{
Inventory variables = new Inventory();
// declare array named Inventory
double Inventory[] = new double [9];
//declare array named Inventory1
String Inventory1 []= new String [2];
System.out.println( "Book Name: " + variables.getbookName());
System.out.println( "Book Number: " + variables.getbookNumber());
System.out.println( "Books in stock: " + variables.getbookQuantity());
System.out.println( "Book Price: " + variables.getbookPrice());
System.out.println( "Book Value: " + variables.getbookValue());
System.out.println();
System.out.println( "Book2 Name: " + variables.getbook2Name());
System.out.println( "Book2 Number: " + variables.getbook2Number());
System.out.println( "Books2 in stock: " + variables.getbook2Quantity());
System.out.println( "Book2 Price: " + variables.getbook2Price());
System.out.println( "Book2 Value: " + variables.getbook2Value());
System.out.println();
System.out.println( "Book3 Name: " + variables.getbook3Name());
System.out.println( "Book3 Number: " + variables.getbook3Number());
System.out.println( "Book3 in stock: " + variables.getbook3Quantity());
System.out.println( "Book3 Price: " + variables.getbook3Price());
System.out.println( "Book3 Value: " + variables.getbook3Value());
System.out.println();
System.out.println( "TotalInventoryValue:" + variables.getTotalInventoryValue());
} // end main
} //end class Inventory1

New Topic/Question
Reply




MultiQuote





|