Results 1 to 2 of 2
  1. #1
    lowpro is offline Member
    Join Date
    Nov 2007
    Location
    boston
    Posts
    10
    Rep Power
    0

    Unhappy 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

  2. #2
    hardwired's Avatar
    hardwired is offline Senior Member
    Join Date
    Jul 2007
    Posts
    1,576
    Rep Power
    8

    Default

    Java 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;
        }

Similar Threads

  1. Calling main method
    By eva in forum New To Java
    Replies: 7
    Last Post: 11-06-2009, 01:37 PM
  2. method calling?
    By frejon26 in forum New To Java
    Replies: 4
    Last Post: 01-25-2008, 03:38 AM
  3. Calling method from another class
    By asahli in forum New To Java
    Replies: 1
    Last Post: 12-15-2007, 06:24 PM
  4. Help with Calling a method
    By Albert in forum New To Java
    Replies: 3
    Last Post: 07-10-2007, 03:27 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •