I tried to run Sales 2 file but it's not working. Please help me solve it. Thank you.
Sales file
public class Sales {
private int transactionNo;
private int salespersonNo;
private String name;
private int salesAmount;
//constructor
Sales (int trans, int sP, String name1, int sA){
transactionNo = trans;
salespersonNo = sP;
name = name1;
salesAmount = sA;
}
void displayInformation(){
System.out.println(transactionNo + "" + salespersonNo + "" + name + "" + salesAmount);
}
//setter method
public void setTransactionNo(int trans1){
transactionNo = trans1;
}
public void setSalespersonNo(int salesP1){
salespersonNo = salesP1;
}
public void setName(String name1){
name = name1;
}
public void setSalesAmount(int salesA1){
salesAmount = salesA1;
}
//getter method
public int getTransactionNo(){
return transactionNo;
}
public int getSalespersonNo(){
return salespersonNo;
}
public String getName(){
return name;
}
public int getSalesAmount(){
return salesAmount;
}
}
Sales2 file - This is the file to run the code to let users input their details to calculate and produce the commission report for each salesperson.
import java.util.Scanner;
public class Sales2 {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
System.out.println("SALES COMMISSON");
System.out.println("TNO# SALESNO# NAME AMOUNT COMM RATE COMMISSION ");
Sales sales1 = new Sales();
sales1.setTransactionNo(sc.nextInt());
sales1.setSalespersonNo(sc.nextInt());
sales1.setName(sc.nextLine());
sales1.setSalesAmount(sc.nextInt());
sales1.displayInformation();
}
}