You are on page 1of 2

Q1.

Define a Java class Worker with the following specification: Data members wno integer wname String hrwrk, wgrate float (hourworked and wage rate per hour) totwage float (hrwrk*wgrate) Member methods calcwg() A method to find hrwrk*wgrate with float return type. in_data() A method to accept values for wno, wname, hrwrk, wgrate and invoke calcwg() to calculate to pay. out_data() A method to display all the data members on the screen. (i) (ii) (iii) Define a class Report with the required specification: Write the code for Calculate Wage buttons click event procedure to operate the class Workers method. Write the code for exit button to exit application.

Q2. Define a class Tour in Java with the description given below:
Data members: TCode of type String NoofAdults of type Integer NoofKids of type Integer TotalFare of Type Float Member Methods: A contructor to assign initial values as follows: Tcode with word NULL NoofAdults as 0 NoofKids as 0 Kilometers as 0 TotalFare as 0 A method AssignFare() which calculates and assigns the value of the data member TotalFare as follows: For each adult Fare(Rs) For Kilometers 500 >=1000 300 <1000 & >=500 200 <500 For each kid the above Fare will be 50% of the fare mentioned in the above table. A method EnterTour() to input the values of the data members TCode, NoofAdults, NoofKids and Kilometers; and invoke the AssignFare() function. A function ShowFare() which displays the total fare for the tour. (i) Define a class Tour with required specification. (ii) Write the code for Calculate Fare buttons click event procedure to operate the class Tours method. (iii) Write the code for Exit button to exit the application. Q3 Define a class Garments in java with the following descriptions: Data Memebers: GCode of type Integer GType GSize of type String of type Integer

GFabric GPrice

of type String of type Float


A method Assign() which calculates and assigns the value of GPrice as follows: For the value of GFabric as COTTON, GType GPrice(Rs) TROUSER 1300

Member Methods:

(i) (ii) (iii)

SHIRT 1100 For GFabric other than COTTON the above mentioned Gprice gets reduced by 10%. A constructor to assign initial values of GCode to 0, GType and GFabric with the word NOT ALLOWED and GSize and GPrice with 0. A function Input() to input the values of data members GCode, GType, GSize and GFabric and invoke the Assign() function. A function Display() which displays the garment price. Define a Garments Worker with required specification. Write the code for Calculate price buttons click event procedure to operate the class Garments method. Write the code for Exit button to exit application.

You might also like