Arrays and Records


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Arrays and Records

Threaded View

  1. #1
    Join Date
    Sep 2002
    Posts
    6

    Red face Arrays and Records

    Hi everyone,

    I've taken myself to solve a harder folio! But I've never managed to get the program working! Here a quick description on what I am looking for:

    A program that will create and output a product-list of product-details. A product-detal is a description of one product stored in the warehouse. Each of the products is described by two attributes.

    A PRODUCT DESCRIPTION - this is a character string
    A QUANTITY IN STOCK - this is the integer number of items of this product currently in stock.

    For system management purpose, the company has defined an 'empty' Product detail entry which has the following special characteristics:

    PRODUCT DESCRIPTION = EMPTY
    QUANTITY IN STOCK = 0

    Here is my main code: -> Note that CheckLinesIn is my library class that read character string from keyboard. I've attached this file.

    Code:
    import java.io.*;
    import java.util.*;
    import java.lang.*;
    
    
    public class Enter_Data
    {
    	
    	public static CheckLinesIn CLI = new CheckLinesIn();
    	
    	public static void main(String[] args)
    	{
    	
    		public Enter_Data()
    		{
    			String inner;
    			int value == -1;
    			Get_Data();
    			while ((value < 0) || (value > 9))
    			{
    				System.out.println("Which Product Array do you wish to update?: ");
    				inner = CLI.readLine();
    				value = Integer.parseInt(inner);
    			}
    			System.out.println("Enter Product Description: ");
    			Product[value] = CLI.readLine();
    			
    			System.out.println("Enter Product Quantity: ");
    			inner = CLI.readLine();
    			Quantity[value] = Integer.parseIn(inner);
    		}
    	}		
    			public Get_Data()
    			{
    				int index;
    				for (index = 0; index < 10; index++);
    				{
    					System.out.println(index + "" + Product[index] + "Qty =" + 	Quantity[index]);
    				}
    			}
    	}
    I've have another class for the Arrays

    Code:
    /* This Product_Details Class is used for reading Arrays
     */
     
    public class Product_Details
    {
    
    private static String[] Product = new String[10];
    private static int[] Quantity = new int[10];
    
    int index;
    
    	public Product_Details()
    	{
    		for (index = 0; index <10; index++);
    		{
    			Product[index] = "Empty";
    			Quantity[index] = 0;
    		}
    	}
    }
    Can someone find what was the problem is? I can't even get this program working

    Thanks,
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center