Results 1 to 2 of 2
  1. #1
    seanfmglobal is offline Member
    Join Date
    Nov 2010
    Rep Power

    Default Can't create object with specified perimeters

    I have this class

    Java Code:
    package testers;
    public class FurnitureStore implements Comparable<FurnitureStore>{
    	private double price;
    	private String address;
    	private double distance;
    	private String hours;
    	public FurnitureStore(double price, String address, double distance,
    			String hours) {
    		this.price = price;
    		this.address = address;
    		this.distance = distance;
    		this.hours = hours;
    	public double getPrice() {
    		return price;
    	public String getAddress() {
    		return address;
    	public double getDistance() {
    		return distance;
    	public String getHours() {
    		return hours;
    	public int compareTo(FurnitureStore o) {
    		// TODO Auto-generated method stub
    		return 0;
    Im trying to create that object with specific perimeters.

    So in my other class im adding it to an array list.

    Java Code:
    import java.util.Random;
    public class FurnitureClient {
    	 * @param args
    	public static void main(String[] args) {
    		// TODO Auto-generated method stub
    		int counter = 0;
    		String stuff = "Hello this is"+counter;
    		Random rand = new Random();
    		ArrayList<FurnitureStore> fs = new ArrayList<FurnitureStore>();
    		fs.add(39.99, "6234 Free Street, San Antonio TX, 78250", rand.nextDouble()*2000, "8:00AM - 10:00PM");

    It tells me that my perimeters are not right but they are cant seem to find what im missing

  2. #2
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Richmond, Virginia
    Blog Entries
    Rep Power


    You are just adding parameters to the list and not calling the constructor. It should look something like this
    Java Code:
    fs.add(new FurnitureStore(/* args */);

Similar Threads

  1. What is best object to create?
    By lam5442 in forum New To Java
    Replies: 1
    Last Post: 02-23-2011, 09:44 PM
  2. Create new Calendar object???
    By aliencc in forum New To Java
    Replies: 4
    Last Post: 01-17-2011, 01:19 PM
  3. Can we create object without new operator ?
    By rohitjava in forum New To Java
    Replies: 11
    Last Post: 09-08-2010, 05:26 AM
  4. Replies: 2
    Last Post: 06-22-2010, 04:29 AM
  5. create object
    By paul21 in forum New To Java
    Replies: 4
    Last Post: 03-07-2010, 07:14 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts