Results 1 to 20 of 34
- 02-21-2011, 12:31 AM #1
Member
- Join Date
- Feb 2011
- Posts
- 34
- Rep Power
- 0
Driving me crazy!!!! Please help!!
Please help I need this code is print the following:
These are the current items on hand: Jacket, Designer Jeans & Shirt
Here is the current stock on each item: Jacket:12 Designer Jeans:40 Shirt:20
Below you will find the current item prices: Jacket:59.95 Designer Jeans:34.95
Shirt:24.95
This is what it is saying right now:
These are the current items on hand:
Here is the current stock on each item: Jacket:12 Designer Jeans:40 Shirt:20
Below you will find the current item prices: Jacket:59.95 Designer Jeans:34.95
Shirt:24.95
HERE IS THE CODE:
1 OF 2
public class RetailItem {
private String description1;
private String description2;
private String description3;
private int unitsOnHand1;
private int unitsOnHand2;
private int unitsOnHand3;
private double retailPrice1;
private double retailPrice2;
private double retailPrice3;
public RetailItem (String item1,String item2,String item3, int onHand1,int onHand2,int onHand3, double price1, double price2, double price3) {
description1 = item1;
description2 = item2;
description3 = item3;
unitsOnHand1 = onHand1;
unitsOnHand2 = onHand2;
unitsOnHand3 = onHand3;
retailPrice1 = price1;
retailPrice2 = price2;
retailPrice3 = price3;
}
public void setDescription(String item1,String item2,String item3)
{
description1 = item1;
description2 = item2;
description3 = item3;
}
public void setUnitsOnHand(int onHand1,int onHand2,int onHand3)
{
unitsOnHand1 = onHand1;
unitsOnHand2 = onHand2;
unitsOnHand3 = onHand3;
}
public void setRetailPrice(double price1,double price2, double price3 )
{
retailPrice1 = price1;
retailPrice2 = price2;
retailPrice3 = price3;
}
public String getDescription1()
{
return description1;
}
public String getDescription2()
{
return description2;
}
public String getDescription3()
{
return description3;
}
public int getUnitsOnHand1()
{
return unitsOnHand1;
}
public int getUnitsOnHand2()
{
return unitsOnHand2;
}
public int getUnitsOnHand3()
{
return unitsOnHand3;
}
public double getRetailPrice1()
{
return retailPrice1;
}
public double getRetailPrice2()
{
return retailPrice2;
}
public double getRetailPrice3()
{
return retailPrice3;
}
}
2 OF 2:
import java.util.Scanner;
public class RetailItemTest
{
public static void main(String [] args)
{
String testItem1;
String testItem2;
String testItem3;
int testOnHand1 = 12;
int testOnHand2 = 40;
int testOnHand3 = 20;
double testPrice1 = 59.95;
double testPrice2 = 34.95;
double testPrice3 = 24.95;
Scanner keyboard = new Scanner(System.in);
System.out.print("These are the current items on hand: ");
testItem1 = keyboard.nextLine();
testItem2 = keyboard.nextLine();
testItem3 = keyboard.nextLine();
System.out.print("Here is the current stock on each item: Jacket:" + testOnHand1 + "\nDesigner Jeans:" + testOnHand2 +
"\nShirt:" + testOnHand3);
System.out.print("Below you will find the current item prices: Jacket:" + testPrice1 + "\nDesigner Jeans:" + testPrice2 +
"\nShirt:" + testPrice3);
}
}
- 02-21-2011, 12:33 AM #2
Do you have a question or should we just read your mind?
- 02-21-2011, 12:35 AM #3
Let me ask you, for a Car to exist does it need to know the details of every other Car that exists on the planet? How about if you want a fourth item such as a Sweater? Will you add another set of variables to hold information about the Sweater?Java Code:public class RetailItem { private String description1; private String description2; private String description3; private int unitsOnHand1; private int unitsOnHand2; private int unitsOnHand3; private double retailPrice1; private double retailPrice2; private double retailPrice3;
-
Poster, please don't post a "here is my code, here is my assignment, fix it for me". As requested above, please ask a specific answerable question.
- 02-21-2011, 12:37 AM #5
Senior Member
- Join Date
- Feb 2010
- Location
- Waterford, Ireland
- Posts
- 748
- Rep Power
- 4
println all that information you took in ie testItem1, testItem2 etc. I am assuming you entered jacket etc for these?
Java Code:testItem1 = keyboard.nextLine(); testItem2 = keyboard.nextLine(); testItem3 = keyboard.nextLine();
- 02-21-2011, 07:03 AM #6
Member
- Join Date
- Feb 2011
- Posts
- 34
- Rep Power
- 0
Never mind, I figured it out but thanks.
- 02-21-2011, 07:50 AM #7
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 8
Sounds like someone failed his assignment because nobody was willing to help him cheat. Well, as they say, you get what you deserve.
- 02-21-2011, 11:12 AM #8
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 8
Then why so bitter?
- 02-21-2011, 04:38 PM #9
Member
- Join Date
- Jan 2011
- Posts
- 13
- Rep Power
- 0
Why not just use an array for the retaill prices, unitsOnHand , and desriptions??
Last edited by biggerthanblue; 02-21-2011 at 04:41 PM.
- 02-21-2011, 04:42 PM #10
Member
- Join Date
- Jan 2011
- Posts
- 13
- Rep Power
- 0
just a tipJava Code:private String desriptions[]={"", "", "", "",}; private int unitsOnHand[]={0, 1, 2, 3}; private double retailprices[]={0.0, 1.1, 2.2, 3.3};
- 02-21-2011, 04:50 PM #11
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,601
- Blog Entries
- 7
- Rep Power
- 17
- 02-22-2011, 03:41 AM #12
Member
- Join Date
- Feb 2011
- Posts
- 34
- Rep Power
- 0
No one is upset and I was not cheating, just trying to find an easier way to display my code. Oh by the way 1 I'm not a dude and 2 I got an A.
Anyways for those who are not jerks. How would I divide 3 different items?
For instance:
If testDays needs to equal testWidgets / testHours / testProduction. How would it be formatted? I have tried everything in my book but it will not compile. Thanks in advance
- 02-22-2011, 03:55 AM #13
I was going to help but then realised that I am probably one of the jerks.
- 02-22-2011, 04:04 AM #14
Member
- Join Date
- Feb 2011
- Posts
- 34
- Rep Power
- 0
Wow really wasn't talking about you but ok.
- 02-22-2011, 04:09 AM #15
Either way do you think it is a good idea to abuse those you are asking for help?
- 02-22-2011, 04:25 AM #16
Member
- Join Date
- Feb 2011
- Posts
- 34
- Rep Power
- 0
Masijade was not helping me at all, all he or she was doing was being a jerk. I don't know if you agree or disagree with him or her but the point remains I stated I figured it out so no one would waste their time in responding. Either way do you think it's a good idea did for someone who is in fact a beginner looking for help to have someone be jerk to them while trying to learn?? That's what this place is somewhere for someone who has a question to ask it, get an answer and understand it. Not to go through the BS of someone who thinks they are better then everyone else. Duh that is why I'm here I know someone on here knows more then I, hence the reason I asked the question.
-
He was not criticizing your asking a question, but how you didn't ask it. There really was no question in your original post, but just your assignment and some non-working code which here is called a homework dump or a code dump. I think most folks here will bend over backwards to help you if you put the same amount of effort in asking your question (and in asking an actual question) that you're requesting that they expend in answering it. But asking a question is a learned art, and you will get better at it with time and effort.
Best of luck.
- 02-22-2011, 04:56 AM #18
Member
- Join Date
- Feb 2011
- Posts
- 34
- Rep Power
- 0
Your right but stating I was angry or upset b/c no one answered my question was incorrect. I figured it out it's that simple. To say I failed my assignment and that I get what I deserve and that I'm bitter is ridiculous. I understand how I need to phrase my questions but what he or she wrote had nothing to do with how my question was phrased or helping me.
Sounds like someone failed his assignment because nobody was willing to help him cheat. Well, as they say, you get what you deserve.
- 02-22-2011, 04:59 AM #19
Well well well... These seems to be some kind of mis-understanding here.
Quizzle23,
Yesterday there was a internet troll [named AnyJavaPros] spamming all over the place in this forum. He was randomly interrupting genuine threads. The 2 responses that Masijade had in this thread were in response to that spammer's abusive posts and NOT related to you or your questions. You can't see the spammer's posts because he has been banned permanently and his posts were deleted by Moderators.
Masijade isn't a jerk, but a genuine guy willing to help others. I hope the mis-understanding is cleared.
You can continue posting your questions and we would be very happy guiding you. :)
GoldestJava Is A Funny Language... Really!.gif)
Click on * and add to member reputation, if you find their advices/solutions effective.
- 02-22-2011, 05:10 AM #20
Member
- Join Date
- Feb 2011
- Posts
- 34
- Rep Power
- 0
Similar Threads
-
The null message is driving me crazy
By Yakg in forum New To JavaReplies: 5Last Post: 12-02-2010, 07:03 PM -
image does not refresh-driving me crazy
By jambon in forum AWT / SwingReplies: 1Last Post: 04-09-2010, 04:25 PM -
THIS PROGRAM IS DRIVING ME CRAZY!!! help fixing it
By syntrax in forum New To JavaReplies: 2Last Post: 12-18-2009, 04:27 AM -
Loop driving me loopy!!!!!
By soc86 in forum New To JavaReplies: 8Last Post: 01-16-2009, 01:00 AM -
Errors driving me crazy! although compiles fine
By irishsea2828 in forum New To JavaReplies: 1Last Post: 04-08-2008, 03:23 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks