Recent Feedback
A local coffee shop sells a variety of different items shown below to their customers. You are asked to write a Java application that can be used to keep track of these items. Additionally, this program provides a way to print out a listing of the items.Item Name Price Coffee $1.00 Water $2.00 Milk $1.50 Bagel $1.25 Donut $0.75Your program will create a class, named Item. This class has the following: * A String instance variable to hold the item name * A double instance variable to hold the price * A constructor that takes a String and double to initialize the instance variables * A get and set method for each instance variableOnce you have this class created, you write a second class named CoffeeDriver. This class has the following methods: * sortName – this method sorts the array of items by item name and then displays the name and price of all items on the screen * sortPrice – this method sorts the array of items by item price and then displays the name and price of all items on the screen * main - It creates an array of Item objects using the data above to set each Item's information. After initializing the array, prompt the user for how they want to see the list – sorted by name or price. Then call the appropriate method.
Optional Information: Language (or Software): Javascript Browser (if necessary): Firefox Already Tried: public class Item { private String itemName; private double itemPrice; public Item (String n,double p) { itemPrice = p; itemName = n; } public void setItemName(String n) { itemName=n; } public void setItemPrice(double p) { itemPrice=p; } public String getName() { return itemName; } public double getPrice() { return itemPrice; } } AND import java.util.*; import java.util.ArrayList; import java.util.Co
Hi
I should be able to help you on this one
if you have this description in a document please do upload it to wikisend.com than post the download link here
also include the source code file you have so far
I should be able to do it, and have it ready in the next 2 hours
http://wikisend.com/download/325832/IT258_Unit10A_project_rubric.pdf
thanks let me have a look
http://wikisend.com/download/197602/coffeeDriver.zip here is the code I have so far
My only issue is that the items are not coming out correctly
ok thanks...
I will have a look and get back to you
ok thank you
ok I see your driver code is missing the sorting part...
and also has one minor mistak
mistake
Ok
How do I fix it?
here you go:http://ge.tt/2iJV1JH/v/0?c
I've fixed it
use the link above for modified source code files
enter the link above in your browser
and look for a download option
in a zip package you will find two .java file
give them a try and see if all ok
let me know if you need clarifications or modifications
Ok I am gonna look. Just a sec
I got a lot of errors
ÏÏ«Ï
----jGRASP exec: javac -g CoffeeDriver.javaÏϧÏϼ§ÏCoffeeDriver.java:42: cannot find symbolÏϧÏsymbol : class ItemÏϧÏlocation: class CoffeeDriverÏÏ§Ï public static void sortName (Item[] items)ÏÏ§Ï ^ϼ§ÏCoffeeDriver.java:65: cannot find symbolÏϧÏsymbol : class ItemÏϧÏlocation: class CoffeeDriverÏÏ§Ï public static void sortPrice (Item[] items)ÏÏ§Ï ^ϼ§ÏCoffeeDriver.java:87: cannot find symbolÏϧÏsymbol : class ItemÏϧÏlocation: class CoffeeDriverÏÏ§Ï public static void printItemsArray(Item[] items)ÏÏ§Ï ^ϼ§ÏCoffeeDriver.java:16: cannot find symbolÏϧÏsymbol : class ItemÏϧÏlocation: class CoffeeDriverÏÏ§Ï Item[] items =new Item[5];ÏÏ§Ï ^ϼ§ÏCoffeeDriver.java:16: cannot find symbolÏϧÏsymbol : class ItemÏϧÏlocation: class CoffeeDriverÏÏ§Ï Item[] items =new Item[5];ÏÏ§Ï ^ϼ§ÏCoffeeDriver.java:17: cannot find symbolÏϧÏsymbol : class ItemÏϧÏlocation: class CoffeeDriverÏÏ§Ï items[0]= new Item("Coffee",1.00);ÏÏ§Ï ^ϼ§ÏCoffeeDriver.java:18: cannot find symbolÏϧÏsymbol : class ItemÏϧÏlocation: class CoffeeDriverÏÏ§Ï items[1]= new Item("Water",2.00);ÏÏ§Ï ^ϼ§ÏCoffeeDriver.java:19: cannot find symbolÏϧÏsymbol : class ItemÏϧÏlocation: class CoffeeDriverÏÏ§Ï items[2]= new Item("Milk",1.50);ÏÏ§Ï ^ϼ§ÏCoffeeDriver.java:20: cannot find symbolÏϧÏsymbol : class ItemÏϧÏlocation: class CoffeeDriverÏÏ§Ï items[3]= new Item("Donut",0.75);ÏÏ§Ï ^ϼ§ÏCoffeeDriver.java:21: cannot find symbolÏϧÏsymbol : class ItemÏϧÏlocation: class CoffeeDriverÏÏ§Ï items[4]= new Item("Bagel",1.25);ÏÏ§Ï ^ϼ§ÏCoffeeDriver.java:53: cannot find symbolÏϧÏsymbol : class ItemÏϧÏlocation: class CoffeeDriverÏÏ§Ï Item tmp = items;ÏÏ§Ï ^ϼ§ÏCoffeeDriver.java:76: cannot find symbolÏϧÏsymbol : class ItemÏϧÏlocation: class CoffeeDriverÏÏ§Ï Item tmp = items;ÏÏ§Ï ^ÏϧÏ12 errorsÏϧÏÏÏ§Ï ----jGRASP wedge2: exit code for process is 1.ÏÏ©Ï ----jGRASP: operation complete.
----jGRASP: operation complete.
this are due to the fact that its missing the Item.java one
make sure both files are in the same folder or same jgraps project.
OH ok it works thank you so much. If a user put the n or p in uppercase with this code convert it?
yes...
I've modified the line userSort = input.nextLine().toLowerCase();
so that internally users input is allways converted to lower case
thus the statements which follow and check for n or p will always work
ok great thank you so much. You are a life saver!
if thats all please do click Accept Answer button, thanks
positive feedback is appreciated
of course thank you.
Experience: Good knowledge of OOP principles. 3+ years of programming experience with Java and C++. Sun Certified Java Programmer 5.0.