Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write method headers for the following: Computing a sales commission, given the

ID: 3642825 • Letter: W

Question

Write method headers for the following:

Computing a sales commission, given the sales amount and the commission rate.

public static double commission(double sales, double rate)

Testing whether a number is even, and returning true if it is.

public static boolean even(int num)

Computing the monthly payment, given the loan amount, number of years, and annual interest rate.

public static double monthlyPmt(double loan, int years, double interestRate)

The lab assignment is to complete the above three (3) methods and then write a test Java program/class to test each method.

Explanation / Answer

class Methods { public Methods() { } public static double commission(double sales, double rate) { return sales*rate/100; } public static boolean even(int num) { if(num%2==0) return true; else return false; } public static double monthlyPmt(double loan, int years, double interestRate) { return (loan+(loan*years*interestRate/100)); } } public class Test { public static void main(String args[]) { Methods methods = new Methods(); methods.commission(1000,5) methods.even(5); methods.monthlyPmt(1000,5,14); } }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote