trying to connect a product class to the main class but i am getting errors i don't understand.like

C:\Users\Juanelle\Documents\OOP Final Project\Order Process.java:36: cannot find symbol
symbol constructor Product(java.lang.String,double)
location: class Product
Product product1 = new Product("Roses", 50.00);
and in the error message the arrow is pointing at the n in new.

C:\Users\Juanelle\Documents\OOP Final Project\Order Process.java:37: cannot find symbol
symbol constructor Product(java.lang.String,double)
location: class Product
Product product2 = new Product("SunFlower", 20.00);
and in the error message the arrow is pointing at the n in new.

C:\Users\Juanelle\Documents\OOP Final Project\Order Process.java:38: cannot find symbol
symbol constructor Product(java.lang.String,double)
location: class Product
Product product3 = new Product("Tulips", 30.00);
and in the error message the arrow is pointing at the n in new.

C:\Users\Juanelle\Documents\OOP Final Project\Order Process.java:36: cannot find symbol
symbol constructor Product(java.lang.String,double)
location: class Product
Product product4 = new Product("Orchids", 60.00);
and in the error message the arrow is pointing at the n in new.

import java.util.*;

public class Product{


static Scanner console = new Scanner(System.in);

String Roses = "";
String SunFlower = "";
String Tulips = "";
String Orchids = "";
double[] flowerPrices;


public Product(){

Roses = "";
SunFlower = "";
Tulips = "";
Orchids = "";
flowerPrices = new double[1];

}


public Product(String roses, String sunflower, String tulips, String orchids,
		double ... list){

	Roses = roses;
	SunFlower = sunflower;
	Tulips = tulips;
	Orchids = orchids;
	flowerPrices = list;
	}


public String toString(){

	String str;

	str = String.format("%-10s  ",Roses);
	str = String.format("%-10s  ",SunFlower);
	str = String.format("%-10s  ", Tulips);
	str = String.format("%-10s  ", Orchids);

	for (double prices : flowerPrices)
		str = str + String.format("%7.2f", prices);

	//str = str + "   " + prices;

	return str;
}


}

main

public class OrderProcess {

	@SuppressWarnings("deprecation")
	public static void main(String[]args){

		// Welcome window = new Welcome();

	      //  window.setTitle("Welcome");
	      //  window.pack();
	      //  window.show();


	     Customer customer = new Customer();
	     customer.getFirstName();
	     customer.getLastName();
	     customer.getAddress();
	     customer.getPhone();
		 System.out.println("Customer: " + customer);




		 SalesClerk salesclerk = new SalesClerk();
		 salesclerk.getSCFirstName();
		 salesclerk.getSCLastName();
		 salesclerk.getSCAddress();
		 salesclerk.getSCPhone();
		 System.out.println("SalesClerk: " + salesclerk);



		 Warehouse warehouse = new Warehouse();
		 warehouse.checkStock();


		 Product product1 = new Product("Roses", 50.00);
		 Product product2 = new Product("SunFlower", 20.00);
		 Product product3 = new Product("Tulips", 30.00);
		 Product product4 = new Product("Orchids", 60.00);

		 System.out.println(product1);
		 System.out.println(product2);
		 System.out.println(product3);
		 System.out.println(product4);


	}

}

could someone assist?

Recommended Answers

All 4 Replies

That it says "cannot find symbol" instead of "The constructor Product(String, double) is undefined" suggests that you need to figure out how to compile multiple source files together, so that the compiler can work out the inter-file dependencies.

When you fix that, and get the 'constructor undefined' error, you'll have to reconsider the design of your Product class. You seem to be confused between instance fields, like name and price, and the instances themselves, like roses, tulips and orchids.

Also, you don't want a space in a file name, like "Order Process.java". The file name needs to match the public class name.

Make a constructor in the Product class that returns a String and a Double only

Make a constructor in the Product class that returns a String and a Double only

a constructor that returns a String and a Double?
I assume you ment:
Make a constructor which takes a String and a double (lowercase d) as parameters?

a constructor that returns a String and a Double?
I assume you ment:
Make a constructor which takes a String and a double (lowercase d) as parameters?

Yup I meant that, my post didn't match the one on my mind...thanks

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.