i need help because i have an error on line 28 of OrderingCustomer that it says cannot access Customer? what did i make wrong in this program.? thanks

the product and customer method it complied properly.

my only concern is the line 28 of the OrderingCustomer.

import java.util.*;
import Product_.*;
import java.io.*;
import Customer_.*;

public class OrderingCustomer_ {


    /*
     * handles the product list
     * so user/customer may be able to choose from the list 
     * and also be used for future references in our application program
     */
    private static ArrayList productList = new ArrayList();

    //customer information

   private static Customer  customer = null;

    /*
     * load's the product list that will be the reference for the user
     */

    private static void LoadProductInformation()
    {
        try
        {
            Product product_One = new Product("Nike 11", "White", "12'", "Rubber shoes", "63655254", 1030,102.25);

            productList.add(product_One);

            Product product_Two = new Product("Nike 12", "Black", "12'", "Rubber shoes", "63441122", 1880,20.25);

            productList.add(product_Two);

            Product product_Three = new Product("Nike 13", "Black", "10'", "Rubber shoes", "63655200", 1108,25.36);

            productList.add(product_Three);

            Product product_Four = new Product("Nike 14", "White", "8'", "Rubber shoes", "62650254", 1000,56.30);

            productList.add(product_Four);

            Product product_Five = new Product("Nike 15", "White", "11'", "Rubber shoes", "16365554", 1200,89.36);

            productList.add(product_Five);
        }
        catch(Exception e)
        {
            System.out.println(e.getMessage());
        }
    }

    /*
     * show's the productlist to the user's (command prompt)
     */

    private static void showProductList()
    {
        System.out.println("Product Table");

        System.out.println("---------------------------------------------------------------------------------");

        System.out.println("No.\tName\tColor\tSize\tCategory\tSerial Number\tNumber of Stocks\tPrice");

        for(int i=0; i <productList.size(); i++)
        {
            Product prod = (Product)productList.get(i);

            System.out.println(
                (i+1) + "\t"
                + prod.getProductName() + "\t"
                + prod.getProductColor() + "\t"
                + prod.getProductSize() + "\t"
                + prod.getProductCategory() + "\t"
                + prod.getProductSerialNumber() + "\t\t"
                + prod.getProductStocks() + "\t\t\t\t"
                + prod.getProductPrice());
        }
    }

    /*
     * returns a random number that will be used for 
     * the customer information
     */

    private static int returnRandomNumber()
    {
        Random gen = new Random(5555);

        int intRet = gen.nextInt();

        return intRet;
    }

    /*
     * process the customer information
     */

    private static void processCustomerInformation()throws IOException
    {   
        BufferedReader rdr = new BufferedReader(new InputStreamReader(System.in));

        String firstName = "";
        String lastName = "";
        String address = "";
        String number = Integer.toString(returnRandomNumber());

        try
        {
            System.out.println("Please enter customer information\nFirst Name:");

            firstName = rdr.readLine();

            System.out.println("Last Name:");

            lastName = rdr.readLine();

            System.out.println("Address:");

            address = rdr.readLine();

            customer = new Customer(firstName, lastName, address, number);

        }
        catch(Exception e)
        {
            System.out.println(e.getMessage());
        }
    }

    public static void main(String[] args) throws IOException{

        BufferedReader rdr = new BufferedReader(new InputStreamReader(System.in));

        int[] intOrder = null;

        try
        {
            processCustomerInformation();

            LoadProductInformation();

            showProductList();

            int intNumberOfOrder = 0;

            boolean bolOrder = false;

            do
            {
                System.out.println("How many product you want to order?");

                intNumberOfOrder = Integer.parseInt(rdr.readLine());

                if((intNumberOfOrder>=1) && (intNumberOfOrder<=5))
                {
                        intOrder = new int[intNumberOfOrder];
                        bolOrder = true;
                }
                else 
                {
                    System.out.println("Ooops, sorry we only have 5 products!");
                    System.out.println("Please try again!");
                }
            }
            while (!bolOrder);

            bolOrder = false;

            System.out.println("Only can only choose one at a time!");


                for(int i=0; i<intOrder.length;i++)
                {
                    System.out.println("Choose the No. column the product you want");

                        int intProduct = Integer.parseInt(rdr.readLine());

                        intOrder[i] =intProduct-1;

                        System.out.println("How many do you want?");

                        int intQuantity = Integer.parseInt(rdr.readLine());

                        Product prod = (Product)productList.get(intOrder[i]);    

                        prod.setQuantity(intQuantity);
                }


            System.out.println("Please wait while we process...");

            Thread.sleep(1000);

            ArrayList prodToProcess = new ArrayList();

            for(int x=0; x<intNumberOfOrder;x++)
            {
                Product prod = (Product)productList.get(intOrder[x]);   

                //System.out.println("added!");

                prodToProcess.add(prod);
            }

            Object[] prodArray = prodToProcess.toArray();

            customer.OrderCustomer(prodArray);


        }
        catch(Exception e)
        {
            System.out.println(e.getMessage());
        }
    }
}

---

package Customer_;

import Product_.*;

public class Customer 
{


    private String strFirstName; //handles the first name of the customer
    private String strLastName; // handles the last name of the customer
    private String strAddress; //handles the address/billing address of the customer
    private String strCustomerNumber; //handles the customer number

    /*
     * Customer's empty constructor if
     * the programmer wishes to initialize 
     * customer's class in an empty manner!
     */
    public Customer()
    {
        this.strFirstName ="";
        this.strLastName = "";
        this.strAddress = "";
        this.strCustomerNumber = "";
    }

    public Customer(String firstName, String lastName)
    {
        this.strFirstName =firstName;
        this.strLastName = lastName;
    }

    public Customer(String firstName, String lastName, String Address)
    {
        this.strFirstName =firstName;
        this.strLastName = lastName;
        this.strAddress = Address;

    }

    public Customer(String firstName, String lastName, String Address, String strNumber)
    {
        this.strFirstName =firstName;
        this.strLastName = lastName;
        this.strAddress = Address;
        this.strCustomerNumber = strNumber;
    }

    public void OrderCustomer(Object[] productInformation) 
    {
        try
        {
            System.out.println("Order Invoice");
            System.out.println("--------------");
            System.out.println("Customer Number: " + this.strCustomerNumber);
            System.out.println("Customer FullName: " + this.strLastName +", " + strFirstName );
            System.out.println("Customer Billing Address: " + this.strAddress);
            System.out.println("--------------");
            System.out.println("Order Details");


            System.out.println("No.\tName\tColor\tSize\tSerial Number\tUnit Price\tTotal Amount");

            System.out.println("----------------------------------------------------");

            double dGrossTotal = 0.0;

            for(int i=0; i<productInformation.length; i++)
            {
                Product prod =(Product)productInformation[i];

                double dTotalAmount = prod.getQuantity() * prod.getProductPrice();

                dGrossTotal += dTotalAmount;

                    System.out.println(
                (i+1) + "\t"
                + prod.getProductName() + "\t"
                + prod.getProductColor() + "\t"
                + prod.getProductSize() + "\t"
                + prod.getProductSerialNumber() + "\t\t"
                + prod.getProductPrice() + "\t"
                    + dTotalAmount);
            }

            System.out.println("----------------------------------------------------");

            System.out.println("NET TOTAL: " + dGrossTotal );

        }
        finally
        {

        }
    }
}
package Product_;


public class Product {

    private String productName;
    private String productColor;
    private String productSize;
    private String productCategory;
    private String productSerialNumber;
    private int productStocks;
    private double productPrice;
    private int quantity;

    public Product()
    {
        this.productName = "";
        this.productColor = "";
        this.productSize = "";
        this.productCategory = "";
        this.productSerialNumber = "";
        this.productStocks = 0;
    }

    public Product(String name)
    {
        this.productName = name;
    }

    public Product(String name, String color)
    {
        this.productName = name;
        this.productColor = color;
    }

    public Product(String name, String color, String size)
    {
        this.productName = name;
        this.productColor = color;
        this.productSize = size;
    }

    public Product(String name, String color, String size, String category)
    {
        this.productName = name;
        this.productColor = color;
        this.productSize = size;
        this.productCategory = category;
    }

    public Product(String name, String color, String size, String category, String serialNumber)
    {
        this.productName = name;
        this.productColor = color;
        this.productSize = size;
        this.productCategory = category;
        this.productSerialNumber = serialNumber;
    }

    public Product(String name, String color, String size, String category, String serialNumber, int stock, double price)
    {
        this.productName = name;
        this.productColor = color;
        this.productSize = size;
        this.productCategory = category;
        this.productSerialNumber = serialNumber;
        this.productStocks = stock;
        this.productPrice = price;
    }

    public void setProductName(String name)
    {
        this.productName = name;
    }

    public void setProductColor(String color)
    {
        this.productColor = color;
    }

    public void setProductSize(String size)
    {
        this.productSize = size;
    }

    public void setProductCategory(String category)
    {
        this.productCategory = category;
    }

    public void setProductSerialNumber(String number)
    {
        this.productSerialNumber = number;
    }

    public void setPrice(double price)
    {
            this.productPrice = price;
    }

    public void setQuantity(int quantity)
    {
        this.quantity = quantity;
    }

    public String getProductName()
    {
        return this.productName;
    }

    public String getProductColor()
    {
        return this.productColor;
    }

    public String getProductSize()
    {
        return this.productSize;
    }

    public String getProductCategory()
    {
        return this.productCategory;
    }

    public String getProductSerialNumber()
    {
        return this.productSerialNumber;
    }

    public int getProductStocks()
    {
        return this.productStocks;
    }

    public double getProductPrice()
    {
        return this.productPrice;
    }

    public double getQuantity()
    {
        return this.quantity;
    }

}
package Customer_;

import Product_.*;

public class Customer 
{
	
	
	private String strFirstName; //handles the first name of the customer
	private String strLastName; // handles the last name of the customer
	private String strAddress; //handles the address/billing address of the customer
	private String strCustomerNumber; //handles the customer number
	
	/*
	 * Customer's empty constructor if
	 * the programmer wishes to initialize 
	 * customer's class in an empty manner!
	 */
	public Customer()
	{
		this.strFirstName ="";
		this.strLastName = "";
		this.strAddress = "";
		this.strCustomerNumber = "";
	}
	
	public Customer(String firstName, String lastName)
	{
		this.strFirstName =firstName;
		this.strLastName = lastName;
	}
	
	public Customer(String firstName, String lastName, String Address)
	{
		this.strFirstName =firstName;
		this.strLastName = lastName;
		this.strAddress = Address;
	
	}
	
	public Customer(String firstName, String lastName, String Address, String strNumber)
	{
		this.strFirstName =firstName;
		this.strLastName = lastName;
		this.strAddress = Address;
		this.strCustomerNumber = strNumber;
	}
	
	public void OrderCustomer(Object[] productInformation) 
	{
		try
		{
			System.out.println("Order Invoice");
			System.out.println("--------------");
			System.out.println("Customer Number: " + this.strCustomerNumber);
			System.out.println("Customer FullName: " + this.strLastName +", " + strFirstName );
			System.out.println("Customer Billing Address: " + this.strAddress);
			System.out.println("--------------");
			System.out.println("Order Details");
			
			
			System.out.println("No.\tName\tColor\tSize\tSerial Number\tUnit Price\tTotal Amount");
			
			System.out.println("----------------------------------------------------");
			
			double dGrossTotal = 0.0;
			
			for(int i=0; i<productInformation.length; i++)
			{
				Product prod =(Product)productInformation[i];
				
				double dTotalAmount = prod.getQuantity() * prod.getProductPrice();
				
				dGrossTotal += dTotalAmount;
				
					System.out.println(
    			(i+1) + "\t"
    			+ prod.getProductName() + "\t"
    			+ prod.getProductColor() + "\t"
    			+ prod.getProductSize() + "\t"
    			+ prod.getProductSerialNumber() + "\t\t"
    		    + prod.getProductPrice() + "\t"
    		    	+ dTotalAmount);
			}
			
			System.out.println("----------------------------------------------------");
			
			System.out.println("NET TOTAL: " + dGrossTotal );
			
		}
		finally
		{
			
		}
	}
	
}
import java.util.*;
import Product_.*;
import java.io.*;
import Customer_.*;

public class OrderingCustomer_ {
    
    
    /*
     * handles the product list
     * so user/customer may be able to choose from the list 
     * and also be used for future references in our application program
     */
    private static ArrayList productList = new ArrayList();
    
    //customer information
    
   private static Customer  customer = null;
    
    /*
     * load's the product list that will be the reference for the user
     */
    
    private static void LoadProductInformation()
    {
    	try
    	{
    		Product product_One = new Product("Nike 11", "White", "12'", "Rubber shoes", "63655254", 1030,102.25);
    		
    		productList.add(product_One);
    		
    		Product product_Two = new Product("Nike 12", "Black", "12'", "Rubber shoes", "63441122", 1880,20.25);
    		
    		productList.add(product_Two);
    		
    		Product product_Three = new Product("Nike 13", "Black", "10'", "Rubber shoes", "63655200", 1108,25.36);
    		
    		productList.add(product_Three);
    		
    		Product product_Four = new Product("Nike 14", "White", "8'", "Rubber shoes", "62650254", 1000,56.30);
    		
    		productList.add(product_Four);
    		
    		Product product_Five = new Product("Nike 15", "White", "11'", "Rubber shoes", "16365554", 1200,89.36);
    		
    		productList.add(product_Five);
    	}
    	catch(Exception e)
    	{
    		System.out.println(e.getMessage());
    	}
    }
    
    /*
     * show's the productlist to the user's (command prompt)
     */
    
    private static void showProductList()
    {
    	System.out.println("Product Table");
    	
    	System.out.println("---------------------------------------------------------------------------------");
    	
    	System.out.println("No.\tName\tColor\tSize\tCategory\tSerial Number\tNumber of Stocks\tPrice");
    	
    	for(int i=0; i <productList.size(); i++)
    	{
    		Product prod = (Product)productList.get(i);
    		
    		System.out.println(
    			(i+1) + "\t"
    			+ prod.getProductName() + "\t"
    			+ prod.getProductColor() + "\t"
    			+ prod.getProductSize() + "\t"
    			+ prod.getProductCategory() + "\t"
    			+ prod.getProductSerialNumber() + "\t\t"
    			+ prod.getProductStocks() + "\t\t\t\t"
    		    + prod.getProductPrice());
    	}
    }
    
    /*
     * returns a random number that will be used for 
     * the customer information
     */
     
    private static int returnRandomNumber()
    {
    	Random gen = new Random(5555);
    	
    	int intRet = gen.nextInt();
    	
    	return intRet;
    }
    
    /*
     * process the customer information
     */
    
    private static void processCustomerInformation()throws IOException
    {	
    	BufferedReader rdr = new BufferedReader(new InputStreamReader(System.in));
    	
    	String firstName = "";
    	String lastName = "";
    	String address = "";
    	String number = Integer.toString(returnRandomNumber());
    	
    	try
    	{
    		System.out.println("Please enter customer information\nFirst Name:");
    		
    		firstName = rdr.readLine();
    		
    		System.out.println("Last Name:");
    		
    		lastName = rdr.readLine();
    		
    		System.out.println("Address:");
    		
    		address = rdr.readLine();
    		
    		customer = new Customer(firstName, lastName, address, number);
    		
    	}
    	catch(Exception e)
    	{
    		System.out.println(e.getMessage());
    	}
    }
    
    public static void main(String[] args) throws IOException{
    	
    	BufferedReader rdr = new BufferedReader(new InputStreamReader(System.in));
    	
    	int[] intOrder = null;
    	
    	try
    	{
    		processCustomerInformation();
    		
    		LoadProductInformation();
    		
    		showProductList();
    		
    		int intNumberOfOrder = 0;
    		
    		boolean bolOrder = false;
    		
    		do
    		{
    			System.out.println("How many product you want to order?");
    			
    			intNumberOfOrder = Integer.parseInt(rdr.readLine());
    			
    			if((intNumberOfOrder>=1) && (intNumberOfOrder<=5))
    			{
    					intOrder = new int[intNumberOfOrder];
    					bolOrder = true;
    			}
    			else 
    			{
    				System.out.println("Ooops, sorry we only have 5 products!");
    				System.out.println("Please try again!");
    			}
    		}
    		while (!bolOrder);
    		
    		bolOrder = false;
    		
    		System.out.println("Only can only choose one at a time!");
    		
    	
    			for(int i=0; i<intOrder.length;i++)
    			{
    				System.out.println("Choose the No. column the product you want");
    				
    					int intProduct = Integer.parseInt(rdr.readLine());
    			
    					intOrder[i] =intProduct-1;
    					
    					System.out.println("How many do you want?");
    					
    					int intQuantity	= Integer.parseInt(rdr.readLine());
    					
    					Product prod = (Product)productList.get(intOrder[i]);	 
    					
    					prod.setQuantity(intQuantity);
    			}
    			
    
    		System.out.println("Please wait while we process...");
    		
    		Thread.sleep(1000);
    		
    		ArrayList prodToProcess = new ArrayList();
    		
    		for(int x=0; x<intNumberOfOrder;x++)
    		{
    			Product prod = (Product)productList.get(intOrder[x]);	
    			
    			//System.out.println("added!");
    			
    			prodToProcess.add(prod);
    		}
    		
    		Object[] prodArray = prodToProcess.toArray();
    		
    		customer.OrderCustomer(prodArray);
    		
    		
    	}
    	catch(Exception e)
    	{
    		System.out.println(e.getMessage());
    	}
    }
}

after i copy and paste here the problem error was moved to line 18 same problem

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.