Question

Write a Java® application, using NetBeans IDE, that calculates the total annual compensation of a salesperson....

Write a Java® application, using NetBeans IDE, that calculates the total annual compensation of a salesperson.
Consider the following: A salesperson will earn a fixed salary of $30,000.
A salesperson will also receive a commission as a sales incentive. Commission is a percentage of the salesperson's annual sales. The current commission is 7% of total sales.
The total annual compensation is the fixed salary plus the commission earned.
he Java® application should meet the following technical requirements:
The application should have at least one class, in addition to the application's controlling class. (A controlling class is where the main function resides).
A file needs to be created to contain the output.
There should be proper documentation in the source code.
The application should ask the user to enter annual sales, and it should display the total annual compensation.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Note: Could you plz go through this code and let me know if u need any changes in this.Thank You
_________________

// AnnualCompensation.java

public class AnnualCompensation {
   private double annualSales;

   public AnnualCompensation(double annualSales) {
       this.annualSales = annualSales;
   }

   public double calcTotAnnualCompensation() {
       return 30000 + annualSales * 0.07;
   }

}

___________________________

// Test.java

import java.io.FileWriter;
import java.io.IOException;
import java.util.Scanner;

public class Test {

   public static void main(String[] args) {
double annualSales;
       /*
       * Creating an Scanner class object which is used to get the inputs
       * entered by the user
       */
       Scanner sc = new Scanner(System.in);

       System.out.print("Enter annual Sales Amount :$");
       annualSales=sc.nextDouble();
      
       AnnualCompensation ac=new AnnualCompensation(annualSales);
  
       try {
           FileWriter fw=new FileWriter("OutFile.txt");
           fw.write("Total Annual Compensation :$"+ac.calcTotAnnualCompensation());
           fw.close();
       } catch (IOException e) {
           e.printStackTrace();
       }
      
   }

}
______________________________

Output:

Enter annual Sales Amount :$450000

____________________________

// OutFile.txt

Total Annual Compensation :$61500.0

_______________Could you plz rate me well.Thank You

Add a comment
Know the answer?
Add Answer to:
Write a Java® application, using NetBeans IDE, that calculates the total annual compensation of a salesperson....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • ou work for a software company has just created a new incentive for salespeople to earn...

    ou work for a software company has just created a new incentive for salespeople to earn a commission on each sale. The current program only allows for a fixed salary. The Chief Information Officer (CIO) has asked you to create a new program that allows the functionality for a fixed salary and commission. Write a Java® application, using NetBeans IDE, that calculates the total annual compensation of a salesperson. Consider the following: A salesperson will earn a fixed salary of...

  • Ok So I have the code I need! and it runs on online codechef IDE! The...

    Ok So I have the code I need! and it runs on online codechef IDE! The code is below: import java.util.Scanner; import java.io.FileWriter; public class Main { public static void main(String[] args) {    Scanner sc = new Scanner(System.in);    double sales; System.out.print("Enter annual sales: "); sales = sc.nextDouble();    double fixed = 30000;    double commission = (7.0*sales)/100.0;    double total = fixed + commission;    System.out.println("Fixed Salary: "+fixed); System.out.println("Annual Sales: "+sales); System.out.println("Commission: "+commission); System.out.println("Total Salary: "+total);      ...

  • Write a Java application with a class name of Payroll, for the “Travel Agency”, that willCalculate...

    Write a Java application with a class name of Payroll, for the “Travel Agency”, that willCalculate the weekly paycheck for both Salaried and Hourly employees. Salaried employees will be paid 1/52 of their annual pay minus 18% withheld for federal and state taxes, as well as 4% for retirement pension. Salaried employees do not collect overtime pay. There are two types of Hourly employees; permanent employees and temporary weekly employees. •Permanent weekly employees will be paid their hourly rate minus...

  • write up an essay on the problems in budgeting derived from the articles (i do Upvote...

    write up an essay on the problems in budgeting derived from the articles (i do Upvote the answers ) Why Budgeting Kills Your Company HBSWK Pub. Date: Aug '1 1, 2003 Why doesn't the budget process work? Read what experts say about not only changing your budgeting process, but whether your company should dispense with budgets entirely. by Loren Gary The average billion-dollar company spends as many as 25,000 person-days per year putting together the budget. If this all paid...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT