| Author |
A Challenge for beginners
|
Anuttama Das
Greenhorn
Joined: Aug 26, 2010
Posts: 1
|
|
I really need your help!
As part of another certification, they presented me the following task for a very beginner java programmer. I have little time to deep into the book! even I have plan to try to understand Java but MY DEADLINE is soon! I hope I'm not being so comfortably but I suspect for some of you this is a really easy task. Not for me!
This is the task:
a. Create a class named Commission that includes three variables: a double sales figure, a double commission rate, and an int commission rate. Create two overloaded methods named computeCommission (). The first method takes two double parameters representing sales and rate, multiplies them, and then displays the results. The second method takes two parameters: a double sales figure and an integer commission rate. This method must divide the commission rate figure by 100.0 before multiplying by the sales figure and displaying the commission. Supply appropriate values for the variables, and write a main () method that tests each overloaded method. Save the file as Commission.java
b. Add a third overloaded method to the Commission application you created in Exercise 1a. The third overloaded method takes a single parameter representing sales. When this method is called, the commission rate is assumed to be 7.5% and the results are displayed. To test this method, add an appropriate call in the Commission program's main () method. Save the application as Commission2.java
|
 |
Christophe Verré
Sheriff
Joined: Nov 24, 2005
Posts: 14685
|
|
Welcome to the ranch You're not asking us to do the job for you, are you ? If so, check HowToAskQuestionsOnJavaRanch. Especially, NotACodeMill and DoYourOwnHomework. If you have a specific problem, something you don't understand, please tell us what it is.
|
[My Blog]
All roads lead to JavaRanch
|
 |
Thomas Young
Greenhorn
Joined: Jul 17, 2008
Posts: 29
|
|
|
[Post removed - don't spoil the surprise!]
|
 |
Jesper de Jong
Java Cowboy
Bartender
Joined: Aug 16, 2005
Posts: 12952
|
|
Welcome to JavaRanch.
The task looks quite basic, and the description pretty much says step by step exactly what you have to do. Are there specific things in the description that you do not understand? If yes, then please tell us what exactly you do not understand. Did you already write some code yourself? If yes, post it here, and tell us where you got stuck.
|
Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32830
|
|
|
Also, always tell us what the thread is about.
|
 |
James Elsey
Ranch Hand
Joined: Dec 21, 2007
Posts: 228
|
|
That should be a walk in the park for most beginners.
Post up the code that you have so far, and people will let you know if its correct, or ways of improving it etc
Ask specific questions if you get stuck, you will learn better than having someone giving you the code
|
Kind Regards, James. OCPJP 1.6 || My SCJP / OCJCP Study Notes
Interested in : SCJP, Google App Engine, Stripes, Android;|| My Bite-Size SCJP Study Blog
|
 |
Ninad Kuchekar
Ranch Hand
Joined: Jan 05, 2010
Posts: 64
|
|
James Elsey wrote:That should be a walk in the park for most beginners.
Ahhh...the honeymoon days...I wish all tasks were as lethargic as this...
What is in name, Task by any other name would be as simple in Java...
Before any one says anything, I admit,... worst quote ever...
@Anuttama : Could you at least begin writing the code, and post what you have reached up to. We could help you further.
-Ninad
|
Don't walk as if you rule the world, walk as if you don't care who rules it...
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32830
|
|
|
Are you sure you know what lethargic means?
|
 |
Ninad Kuchekar
Ranch Hand
Joined: Jan 05, 2010
Posts: 64
|
|
Campbell Ritchie wrote:Are you sure you know what lethargic means?
Ans: Yes, I do.
<light-bulb>It was ironic!</light-bulb>
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32830
|
|
We never have lethargic tasks round here . . . only lethargic students
|
 |
Ninad Kuchekar
Ranch Hand
Joined: Jan 05, 2010
Posts: 64
|
|
Campbell Ritchie wrote:We never have lethargic tasks round here . . . only lethargic students
Hey that's a personified task...
Ninad Kuchekar wrote:I wish all tasks were as lethargic as this...
Sorry I just meant it as an irony...I thought the "thumbs up" would give away the irony....
Back to Anuttama, have had any luck in kicking off??
-Ninad
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32830
|
|
I agree our students are tasks . . . whether they are personified, however, I am never quite sure
|
 |
 |
|
|
subject: A Challenge for beginners
|
|
|