Results 1 to 13 of 13

Thread: Need help bad!!

Threaded View

  1. #1

    Thread Starter
    Addicted Member ddmeightball's Avatar
    Join Date
    Nov 2004
    Location
    Nebraska
    Posts
    183

    Resolved Need help bad!!

    I am having problems with an assignment in my advanced java class.

    Here it is. I am supposed to use something like an arraylist or linked list to make a dynamically changing program that holds the products for a video company. The problem is the fact that I have never used an arraylist or linked list so I dont know where to start.


    Code:
    You are part of a team of programmers that is developing a point of sale application for a local video store called SCC Pictures and Stuff.  The application needs a class that holds a list of the products offered for sale.  The list of products can vary in number.  Create the ProductList class.  Include a data structure that holds Product objects.  Include the following methods:
    
    add(Product p) – add a product to the list
    add(String id, String name, double price) – create a Product and add to the list
    size()  - return how many are in the list
    remove(int index) – remove a product at position index.
    get(int index) – return the Product at position index.
    find(String find) – return a Product based on the ID#.
    
    Create a list of Product objects in the constructor of the ProductList class.
    
    Download the Product class from the micros ftp site – it is in the assignments directory.
    
    ProductList class includes:
    	Dynamic data structure as an attribute
    	Constructor adds Products to the list
    	add method s
    	size method
    	remove method
     	get Method
    	find method
    Here is the product class were are supposed to use.

    Code:
    public class Product{
    	private String code;
    	private String name;
    	private double price;
    
    	public Product(){
    	}
    
    	public Product(String code, String name, double price)
    		{
    			this.code = code;
    			this.name = name;
    			this.price = price;
    		}
    
    	public void setCode(String c)
    		{
    			code = c;
    		}
    		
    	public String getCode()
    		{ 
    			return code;
    		}
    
    	public void setName(String d)
    		{
    			description = d;
    		}
    		
    	public String getName()
    		{ 
    			return name;
    		}
    
    	public void setPrice(double p)
    		{
    			price = p;
    		}
    		
    	public double getPrice()
    		{ 
    			return price; 
    		}
    
    }


    <Moderator added green checkmark to the first post>
    Last edited by NoteMe; Feb 17th, 2005 at 06:59 AM.

Posting Permissions

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



Click Here to Expand Forum to Full Width