Hello I am new here and to Java. I have a code I typed up and found out I need to use two originally written classes. I do not know where to split the code and how to call one class from the next. Can someone here help me?
package annualcompensation;
import java.util.Scanner; // import Scanner
public class AnnualCompensation { // initiate class AnnualCompensation
public static void main(String[] args) {//main method
Scanner input = new Scanner (System.in);// calls new scanner input
String FirstName;// holds first name
String LastName;// holds last name
Double BasePay = 50000.00;// holds base pay
Double CommPerc = .05;// holds commision percentage
Double CommAmou;// holds commision amount
Double AnnSales;//holds annual sales
Double TotalPay;// holds total pay
Double SalesTarget = 100000.00;// holds sales target
System.out.print("Enter First Name ");// calls for first name
FirstName = input.nextLine(); // accepts first name
System.out.print("Enter Last Name ");// calls for last name
LastName = input.nextLine();// accepts last name
System.out.print("Enter Annual Sales ");// calls for annual sales
AnnSales = input.nextDouble();// accepts annual sales amount
if (AnnSales >= 0.8 * SalesTarget && AnnSales <= SalesTarget)
{
CommAmou = AnnSales * CommPerc;
}
else if(AnnSales >= SalesTarget)
{
CommAmou = 1.25 * CommPerc * AnnSales;
}
else {
CommAmou = 0.00;
}// declares value for CommAmou
TotalPay = BasePay + CommAmou;// declares value for TotalPay
System.out.printf(FirstName + " " + LastName + " " +
"has earned a commision of $" + "%.2f\n", CommAmou);
// outputs name and commision amount
System.out.printf(FirstName + " " + LastName + " " +
"has earned an annual pay of $" + "%.2f\n\n", TotalPay);
// outputs name and total pay
System.out.println("Potential Salary Amounts\n");// outputs text
System.out.println("Total Sales \tTotal Compensation"); // outputs text
double Display = 5000 + AnnSales;// holds display value
while (Display <= 1.50 * AnnSales)// initiate loop to find display value
{
double Display2 = (Display * CommPerc)*1.25 + BasePay;
System.out.printf("%.2f\t%.2f\n", Display, Display2);
Display = Display + 5000;// diplay value increase by 5000
}// close while loop
}// close main method
}// close class AnnualCompensation