Question

You work for a software company has just created a new incentive for salespeople to earn...

You 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 $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.

The 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.

Compile your Java® application files into a ZIP folder.

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

Please find the code below::

package fileIO;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.Scanner;

public class AnnualSale {
   public static void main(String[] args) {
      
       double annualSale;  
       Scanner sc = new Scanner(System.in);
       System.out.print("Enter amount of annual sale : ");
       annualSale = sc.nextDouble();
       double fixedSalary = 30000;
       double incentive = annualSale*.07;
       double total = incentive+fixedSalary;
       try {
           PrintWriter writer = new PrintWriter(new File("output.txt"));
           writer.write("Fixed salary            : "+fixedSalary);
           writer.write("\nAnnual sale             : "+annualSale);
           writer.write("\nIncentive                 : "+incentive);
           writer.write("\nTotal annual compensation : "+total);
          
           System.out.print("Fixed salary                : "+fixedSalary);
           System.out.print("\nAnnual sale                 : "+annualSale);
           System.out.print("\nIncentive                 : "+incentive);
           System.out.print("\nTotal annual compensation : "+total);
          
          
           writer.close();
           System.out.println("\nOutput has been sent to output.txt");
          
       } catch (FileNotFoundException e) {
           // TODO Auto-generated catch block
           e.printStackTrace();
       }
   }
}

output:

output.txt is as below

Add a comment
Know the answer?
Add Answer to:
You work for a software company has just created a new incentive for salespeople to earn...
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
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