Hello everyone, I�m new to java and would appreciate any help; I�m trying to put together a program that calculates commission. The program requires me to create a class containing two overloaded methods named computeCommission and three variables. The first method contains two double arguments representing the sales and rate, multiplies them and displays the results. The second method contains a double variable and an int variable representing sales figure and an int commission rate. This method must divide the commission rate figure by 100.0 before multiplying by the sales figure and displaying the commission . Any and all suggestion would be appreciated.
Next time you post, please use the "code" tags below the box; it makes code much easier to read.
Not a good idea to have everything in static methods. Remove static everywhere except before "main" which has to be static.
Try this sort of thing in the main methodYou need to work out how to call the two methods.
In the (double, double) method, you don't declare a type for the "commission" variable. Probably best to have a field called commission, of type double, and don't declare anything in the compute methods.
You can't have two variables in the same method both with the same name (commRate). I would declare your three variables as local variables in the main method.
In the (double, int) method you will get problems with the intComm and doubleComm. I think you simply want to work out that commission is sales / 100.0 * commRate. Then you just print out commission.
Try that lot; if you have any problems, come back to us.
the program code you have written is similar to structured programming i.e C. In Object oriented programming you have to split the problem into two parts its properties or data and methods or procedures that make use of the data provided. the combination of the above two is called as object
i advise to first try to identify objects in your programs that will help you to understand JAVA more...