# Mr. Pawan works as a programmer in “ABC Marketing Company” where he has designed a Salary

13 views

closed

Mr. Pawan works as a programmer in “ABC Marketing Company” where he has designed a Salary generator software to generate the salary of salesman in which Name and Salary are entered by the user. A screenshot of the same is shown below:

Help him in writing the code to do the following :

After selecting appropriate Radio Button, when ‘Commission’ button is clicked, commission should be displayed in the respective text field as each Salesman will get a commission based on the units sold according to the following criteria :

(ii) When ‘Gross Salary’ button is clicked, Gross Salary should be calculated and displayed in the respective text field as per the given formula : Gross Salary = Salary + Commission

(iii) After required selection of Checkbox(es), when ‘Facility Charges’ button is clicked, Facility charges will be displayed in the respective text field according to the following criteria :

(iv) Money will be deducted from the Gross Salary according to the facilities opted by the employee. When ‘Net Salary’ button is clicked, Net Salary should be calculated and displayed in the respective text field as per the given formulae : Net Salary = Gross Salary-Deductions

+1 vote
by (52.3k points)
selected by

(i) We need to double click at the Commission button (jButtonl) and type the following code :

int Commission :

if (jRadioButtonl. isSelected ( ) = True )

Commission = 500 ;

else

if (jRadioButton2. isSelected ( ) = True)

Commission = 1000 ;

else Commission = 2000 ;

jTextField3. setText (Commission) ;

(ii) We need to double click at the ‘Gross Salary’ button (jButton2) and type the following code:

int Gross_Sal ;

int Salary = Integer, parselnt (jTextField2. getText ( ) ) ;

Gross_Sal = Salary + Commission ;

jTextField4.setText (Gross_Sal) ;

(iii) We need to double click at the ‘Facilities Charges’ button (jButton3) and type the following code :

int Fac_Charges ;

if (jCheckBox1. is Selected ( ) == True)

Fac_Charges = 500 ;

else

if (jCheckBox2. isSelected ( ) =True)

Fac_Charges = 2000 ;

else

Fac_Charges = 0 ;

jTextField5. setText (Fac_Charges) ;

(iv) We need to double click at the ‘Net Salary’ button (jButton4) and type the following code :

int Net_Sal ;

Net_Sal = Gross_Sal-Fac_Charges ;

jTextField6. setText (Net_Sal) ;

+1 vote
+1 vote
+1 vote