Login|Contact Us
Question and Answer

Programming

Ask a Programming Question, Get an Answer ASAP!

  • Ask A Question
  • Browse Answers
  • Meet The Experts
  • How JustAnswer Works

Coffee Shop Scenario

 
unvadim's Avatar
  • Answered by:unvadim
  • Computer Software Engineer
  • Positive Feedback: 99.7 %
  • Accepted Answers: 1147
Verified Expert
in Programming

Recent Feedback

Positive
works like a charm
Positive
Works like a charm and very fast return time!
Positive
Super Job and very fast - Thank You!!!
Positive
Thank you for the help!
Positive
answered my questions and helped me understand
Positive
knowledgable and able to understand my issue
Positive
This guy did a fantastic job and really knows his programming.
Positive
Super helpful!!!
Positive
Did a great job and received exactly what I needed in a timely manner. Thank...
Positive
Saved my A** big time!!!

Customer Question

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.75
Your 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 variable
Once 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

Submitted: 371 days and 5 hours ago.
Category: Programming
Value: $69
Status: CLOSED

Accepted Answer

Picture
Expert:  unvadim replied 371 days and 5 hours ago.


unvadim :

Hi

unvadim :

I should be able to help you on this one

unvadim :

if you have this description in a document please do upload it to wikisend.com than post the download link here

unvadim :

also include the source code file you have so far

unvadim :

I should be able to do it, and have it ready in the next 2 hours

Customer :

http://wikisend.com/download/325832/IT258_Unit10A_project_rubric.pdf

unvadim :

thanks let me have a look

Customer :

http://wikisend.com/download/197602/coffeeDriver.zip here is the code I have so far

Customer :

My only issue is that the items are not coming out correctly

unvadim :

ok thanks...

unvadim :

I will have a look and get back to you

Customer :

ok thank you

unvadim :

ok I see your driver code is missing the sorting part...

unvadim :

and also has one minor mistak

unvadim :

mistake

Customer :

Ok

Customer :

How do I fix it?

unvadim :

here you go:

http://ge.tt/2iJV1JH/v/0?c

unvadim :

I've fixed it

unvadim :

use the link above for modified source code files

unvadim :

enter the link above in your browser

unvadim :

and look for a download option

unvadim :

in a zip package you will find two .java file

unvadim :

give them a try and see if all ok

unvadim :

let me know if you need clarifications or modifications

Customer :

Ok I am gonna look. Just a sec

Customer :

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.

unvadim :

this are due to the fact that its missing the Item.java one

unvadim :

make sure both files are in the same folder or same jgraps project.

Customer :

OH ok it works thank you so much. If a user put the n or p in uppercase with this code convert it?

unvadim :

yes...

unvadim :

I've modified the line userSort = input.nextLine().toLowerCase();

unvadim :

so that internally users input is allways converted to lower case

unvadim :

thus the statements which follow and check for n or p will always work

Customer :

ok great thank you so much. You are a life saver!

unvadim :

if thats all please do click Accept Answer button, thanks

unvadim :

positive feedback is appreciated

Customer :

of course thank you.

Expert TypeComputer Software Engineer
Category: Programming
Pos. Feedback: 99.7 %
Accepts: 1147
Answered: 5/6/2012

Experience: Good knowledge of OOP principles. 3+ years of programming experience with Java and C++. Sun Certified Java Programmer 5.0.

Ask this Expert a Question >
 
Tweet

8 Programmers are Online Right Now

Ask Your Question Now
Programming Questions Date Submitted
Help with my final assignment for VB 5/9/2013
I am new to C programming, and this is an assignment problem. 5/9/2013
Another programming question for you the link is as follows 5/8/2013
Programming question help the link is as follows for the question 5/8/2013
i dont know programming i create OKPR508211. 5/8/2013
I need a programmer to help me with a couple of questions I 5/7/2013
Design and write a program (VB) that collects the following 5/7/2013
To RajStatements Assume that quest is an integer variable 5/6/2013
I need help on this Java programming problem. I included the 5/5/2013
a java programming question 5/5/2013
RSS
Next 10 >
Ask A Programmer
Type Your Programming Question Here...
characters left:

Top Programming Experts

See More Programmers

In The News

Nbc
Washington Post
New York Times
Cnn
Learn More

How It Works

  • Ask an Expert
  • Get a Professional Answer
  • Ask Followup Questions
  • 100% Satisfaction Guarantee
Learn More
close
Find Expert answers related to your question.
Sign up using email
We will never post anything without your permission.
Already have an account? Sign in

Ask a Programmer

Get a Professional Answer. 100% Satisfaction Guaranteed.
165 Programmers are Online Now
Type Your Programming Question Here...
characters left:
Disclaimer: Information in questions, answers, and other posts on this site ("Posts") comes from individual users, not JustAnswer; JustAnswer is not responsible for Posts. Posts are for general information, are not intended to substitute for informed professional advice (medical, legal, veterinary, financial, etc.), or to establish a professional-client relationship. The site and services are provided "as is" with no warranty or representations by JustAnswer regarding the qualifications of Experts. To see what credentials have been verified by a third-party service, please click on the "Verified" symbol in some Experts' profiles. JustAnswer is not intended or designed for EMERGENCY questions which should be directed immediately by telephone or in-person to qualified professionals.
Truste
Contact Us | Terms of Service | Privacy & Security | About Us | Our Network
© 2003-2013 JustAnswer LLC
  • Pearl.com
  • JustAnswer UK
  • JustAnswer Germany
  • JustAnswer Spanish
  • JustAnswer Japan