Total members 11895 |It is currently Tue Dec 03, 2024 8:30 pm 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 binomial coefficients     -  
 compute area of the circle.     -  
 Compute FFT (Fourier Transform) in ITK for a 2d image     -  
 loop to compute the tuition in ten years     -  
 compute number of files in directory     -  
 compute maximum and minimum values, also scaling factor.     -  
 Which methods is best for SEO?     -  
 What Are Constructor Methods?     -  
 methods in ActionListener interface     -  



cron





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