Fewpal
0 votes
13 views
in Information Technology by (47.6k points)
closed by

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 Answer

+1 vote
by (52.3k points)
selected by
 
Best answer

(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) ;

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...