Total members 11889 |It is currently Thu Mar 28, 2024 11:31 am Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





Program to compute commission using two overloaded methods
I've been assigned a project. I am to compute Commission by using two overloaded methods. I have to create a class named Commission that includes 3 variables:double sales figure, a double commission rate, and an integer commission rate. Create two overloaded methods named computeCommission().
The first method takes two double arguments representing sales and rate, multiplies them, and then displays the results. The second method takes two arguments: a double sales figure and an integer commission rate. It 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. Okay, that's the assignment! Following is the coding that I did. Where did I go wrong because when I execute this (java Commission).....I get NOTHING.

Code:

public class Commission
{
    public static void main(String[] args)
    {
        double salesFig = 4000.00;
        double commRate = 0.075;
        int commRateFig = 7;
        computeCommission ();
    }
    public static void computeCommission(double salesFig, double commRate)
    {
        double commission;
        commission = commRate * salesFig;
        System.out.println("The commission on $" + salesFig + "is $" + commission);
    }
    public static void computeCommission(double salesFig, int commRateFig)
    {
        double commission;
        commission = commRateFig / 100.0 * salesFig;
        System.out.println("The commission on $" + salesFig + "at  %" + commRateFig + "is 

$"
 + commission);
    }
}
 





Author:
Newbie
User avatar Posts: 1
Have thanks: 0 time

Code:
double commission;
commission = commRateFig / 100.0 * salesFig;
System.out.println("The commission on $" + salesFig + "at %" + commRateFig + "is



Author:
Newbie
User avatar Posts: 2
Have thanks: 0 time
Post new topic Reply to topic  [ 2 posts ] 

  Related Posts  to : Program to compute commission using two methods
 errors in commission program     -  
 compute area of the circle.     -  
 compute binomial coefficients     -  
 loop to compute the tuition in ten years     -  
 compute number of files in directory     -  
 Compute FFT (Fourier Transform) in ITK for a 2d image     -  
 compute maximum and minimum values, also scaling factor.     -  
 Which methods is best for SEO?     -  
 What Are Constructor Methods?     -  
 Calling Overloaded Methods     -  









Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com