Search code examples
javacompiler-errors

Cannot find symbol error?


The compiler says that it cannot find Getdata on the code. Not sure why?

The exact error is:

Inventory.java:18: error: cannot find symbol
            int i = GetData.getInt(menu);
                    ^
symbol:   variable GetData
location: class Inventory

Code:

import java.util.ArrayList;
import javax.swing.JOptionPane;
import javax.swing.JTextArea;
import javax.swing.JScrollPane;

class Inventory
{
  public static void main(String arg[])
  {
    Database db = new Database();
    Database dpl = new Database();

    String menu = "1. Add product\n2. Sell product\n3. Delete product\n4. Modify  product\n5. Display information\n6. Exit";
    boolean more = true;

    while(more)
    {
        int i = GetData.getInt(menu);
        switch(i)
        {
            case 1:
                   // Creating an order and additing this order to the database
                   IO.display("Add new product", "New product", JOptionPane.INFORMATION_MESSAGE);

                    String street = GetData.getWord("Enter street address");
                    String city = GetData.getWord("Enter city");
                    String state = GetData.getWord("Enter state");
                    String zip = GetData.getWord("Enter zip code");
                    Address addr = new Address(street, city, state, zip);

                    String company_name =  GetData.getWord("Enter name of the company");
                    Manufacturer m = new Manufacturer(addr, company_name);

                    String product_name =  GetData.getWord("Enter name of product");
                    String product_code =  GetData.getWord("Enter product code: xx-xxx-xxxx");
                    double price = GetData.getInt("Enter unit price");

                    Product p = new Product(m,  product_name,  product_code, price);

                     int quantity =  GetData.getInt("Enter quantity");

                     Order ord = new Order(p, quantity);

                    db.add(ord);
            break;
            case 2:

            break;
            case 6:
                    more = false;
            break;

            default:
            break;
          } // End switch
      } // End while
  } // End main

    static void display(String s, String ss, int m){}
} // End inventory

Solution

  • You have to define the class GetData with all it's methods first to use it.