Ken Terp

Greenhorn
+ Follow
since Sep 28, 2006
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Ken Terp

I understand and agree. I do not want anyone to do it for me. I simply
need help with methods, passing and returning values to them as well as calling methods from other methods. I have put in well over 40 hours into this program and have hit a wall. Again by posting the code my intention was not for someone to do it for me. I just need help and that is also why I asked if anyone would be willing to look at it. It seems many of you have forgotten about the help you got when you first started to learn to program in Java. Very friendly place this is.
17 years ago
I am sorry you feel that way as wasting your time was not my intention.
As I stated in my original post. I am new to Java and I am sorry you feel I am wasting your time. I am also new to posting and don't like asking for help unless I really need it. I don't appreciate your attitude. I have spent over 40 hours trying to figure this out and I hit a wall. I do not want the answer... I want help. You have obviously forgotten what it is like to need help with something. Thanks for being so understanding.
17 years ago
That is affirmative. Is that bad?
I guess your response was better than
"Give up!" which is almost what I expected
when posting.
17 years ago
I am supposed to call a method based upon the input of the user.
Then I need to return the a value based upon the calculation done in that method. I am very new to Java and having great difficulty understanding the concept of methods passing values and returning values. Thanks for any insight.

[ October 07, 2006: Message edited by: Bear Bibeault ]
17 years ago
Depending on the type of discount the calculatePrice method has to call the correct method to compute the price for the discount.

computeNoDiscount
computeFreeShipDiscount
computeCouponDiscount
computeSpecialDiscount
17 years ago
Hello
I feel like this might be a stupid question as I am very new to JAVA and I am having quite a bit of difficulty writing a progam, but I am going to ask it anyway. Can you call a different method based upon what a user inputs from within a method using if ,else if statements... here's an example if it helps. I guess one my questions is why can't I just call the method without parameters for example, computeNoDiscount() Any help would be very much appreciated. Thanks.

public static double calculatePrice(double retailPrice, double numOrdered, char discountType) {
if (discountType == 'n')
computeNoDiscount(retailPrice, numOrdered);
else if (discountType == 'c')
computeCouponDiscount(retailPrice, numOrdered);
else if (discountType == 'f')
computeFreeShipDiscount(retailPrice, numOrdered);
else if (discountType == 's')
computeSpecialDiscount(retailPrice, numOrdered);

double fpr;
fpr = retailPrice * numOrdered;
return fpr;
17 years ago
Thanks I think I understand now.
17 years ago
I guess that's why I am so confused. Here's are the instructions exactly as they were given to me.

Write the getCharType method.

Place the method defination code below the main method of the existing program class.

Include the modifier static in the method header.

The getCharType method must:
Take one parameter as input: the promo type as a value of type char.
Determine the full name of the promo type, ie Free shipping, Coupon, Special promo or None.
Return the full name of the promo type as a string.

Thats the instruction I was given. Can it be done? Because I've been trying for about 14 hours now and can't find a way.
17 years ago
Hi, thanks for the reply.

I'm trying to return a String that is associated with a character.
17 years ago
Hello all,

I need a little help at this point as I am completely stumped at this point on how to get this method to work. Any direction would be much appreciated. I have to create a method that takes in one parameter as input as a value char which is easy enough ...

public static char getCharType(char promoType){

The part that I can't seem to grasp is this. Based on that input of char type I have to match it up to a string and return a string. How can I convert a char to a string? I know there is probably a simple answer but it has eluded me for about 12 hours now and the laptop is about to go out the window. Any help or direction would be greatly appreciated.
17 years ago