This program was designed using NetBeans IDE. The program is intended to calculate total annual compensation of a salesperson. Below is the code that was used to develop the program with the reasons each was used. This program was then tested in NetBeans and ran in NetBeans to determine if the program runs correctly after being built. The program was successfully ran in NetBeans and also in Windows command prompt as shown in the screen shots.
CODE
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
packagecommissioncalculation;
// This program will calculate the total annual compensation of a salesperson.
importjava.util.Scanner;
/**
*
* @author Michael Formet
*/
public class CommissionCalculation
{
/**
* @paramargs the command line arguments
*/
// This is the beginning of the main method
public static void main(String[] args)
{
// always print your last name as the first output of your program
System.out.println("Formet");
Scanner input = new Scanner(System.in);
// This method displays the salesperson's fixed annual salary
doublemonthlySalary= 30000; // Salesperson's fixed monthly salary
doubleannualSalary= monthlySalary * 12; // Salesperson's fixed annual salary , 12 represents months in a year
System.out.println("The Salesperson earns a fixed monthly salary of $"+ monthlySalary + ".");
System.out.println("The Salesperson earns a fixed annual salary of $"+ annualSalary + ".");
// This method displays the salesperson's commission rate
int commission= 5;
System.out.println("The Salesperson will receive a commission of "+ commission + "%.");
// Creates Scanner to collect annual sales input from salesperson
doubleannualSales; // Salesperson's annual sales
System.out.print("Enter annual sales: ");
annualSales = input.nextDouble();
doublecommissionCalc; // Calculates commission of annual sales
doublepercentCalc = commission/100.0; // Makes commission calculable
commissionCalc = annualSales * percentCalc;
System.out.println("The annual sales of the salesperson is $"
+ commissionCalc + " using a " + commission
+ "% commission.");
doubletotalAnnualSum; // Salesperson's total annual compensation
totalAnnualSum = annualSalary + commissionCalc;
System.out.println("The total annual compensation of the salesperson "
+ "is: $" + totalAnnualSum + ".");
} // end main method
}
Attachment:- CommissionCalculation.rar