Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-26-2007, 11:21 AM
Member
 
Join Date: Nov 2007
Location: boston
Posts: 10
lowpro is on a distinguished road
i'm no good in calling Method please help
/*hi everyone i'm having problem here.i try it alot but i can get it print the value of commission anyony please help.thnks adv. it suppst to print SalesAmnt commission
10000 9000.0
until
100000 11700.0 please help with any commts if possible thks*/


import javax.swing.JOptionPane;

public class C5E11 {
public static void main (String [] args){
double commission = 10000;
double result = 0;

System.out.println(" sales Amount\t\tCommission");


for( double m = 10000; m <= 100000; m = m + 5000){
result = commission;
System.out.print( m+"\n");
//System.out.print("\t\t");

//System.out.print(result );
}// end loop

}// end main

public static double computerCommission(double salesAmount) {
double commission ;
if (salesAmount >= 10000.01)
commission = 500 * 0.08 * 0.1 + (salesAmount - 10000) * 0.12;
else if(salesAmount >= 5000.01)
commission = 5000 * 0.08 + (salesAmount - 5000) * 0.01;
else
commission = salesAmount * 0.08;

return commission;
}




}// end class
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 11-26-2007, 06:15 PM
Senior Member
 
Join Date: Jul 2007
Posts: 1,022
hardwired is on a distinguished road
Code:
public static void main(String[] args) { double commission = 10000; double result = 0; System.out.println(" sales Amount\t\tCommission"); for( double m = 10000; m <= 100000; m = m + 5000){ result = computeCommission(m); System.out.print( " " + m); System.out.print("\t\t"); System.out.print(result + "\n"); }// end loop }// end main public static double computeCommission(double salesAmount) { double commission; if (salesAmount > 10000) commission = 500 * 0.08 * 0.1 + (salesAmount - 10000) * 0.12; else if(salesAmount > 5000) commission = 5000 * 0.08 + (salesAmount - 5000) * 0.01; else commission = salesAmount * 0.08; return commission; }
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
method calling? frejon26 New To Java 4 01-25-2008 04:38 AM
Calling main method eva New To Java 1 12-22-2007 01:14 PM
Calling method from another class asahli New To Java 1 12-15-2007 07:24 PM
Help with Calling a method Albert New To Java 3 07-10-2007 04:27 PM


All times are GMT +3. The time now is 10:57 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org