Trending ▼   ResFinder  

ICSE Class X Notes 2020 : Computer Applications : Constructor test

3 pages, 4 questions, 0 questions with responses, 0 total responses,    0    0
Ani Raj
 Bangalore 
+Fave Message
 Home > ananthinaga >

Formatting page ...

1) What is a constructor and what is its use? [2] 2) Given the following code, answer the questions that follow: [3] class Academic { int x,y; void access( ) { int a,b; Academic student = new Academic( ); System.out.println( Object created ); } } (i) What is the object name of class Academic? (ii) Name the class variable used in this program. (iii) Write the local variable used in this program. 3) What are the (any 2)Rules in defining a constructor?[2] 4) State the difference between Constructor and Method. [2] 5) Create a class with one integer instance variable. Initialize the variable using [2] i. default constructor ii. parameterized constructor. 6) What is Parameterized constructor? [2] 7) Explain Copy constructor? [2] 8) Why do we need a constructor as a class member?[2] 9) How many constructors can a class have?[1] 10) Define a parameterized constructor for the class Floppy that assigns the diameter and storage space passed to it to the member variable diameter and space .[2] Question 1: Class Name : SalaryCalculation Data members : name (String type data) basicPay, specialAlw, conveyanceAlw, gross, pf, netSalary, AnnualSal (All double type data) Member methods : (i) SalaryCalculation( ) - A constructor to assign name of employee (name), basic salary (basicPay) of your choice and conveyance allowance (conveyanceAlw) as Rs.1000.00 (i) void SalaryCal( ) - to calculate other allowances and salaries as given: specialAlw = 25% of basic salary. gross = basicPay + specialAlw + conveyanceAlw. netSalary = gross - pf. AnnualSal = 12 months netSalary. (i) void display( ) - to print the name and other calculations with suitable headings. Write a program in Java to calculate Question 2 Define a class Employee having the following description: Data members/instance variables: pan : to store personal account number name : to store the name taxincome : to store the annual taxable income tax : to store the tax that is calculated Member functions: Employee() : default constructor void input() : to accept the pan number, name and taxable income void calc() : calculate the tax for an employee according to the given conditions: Total Annual Taxable Income Tax Rate Upto Rs. 100000 No tax From Rs. 100001 to Rs. 150000 10% of the income exceeding Rs. 100000 From Rs. 150001 to Rs. 250000 Rs. 5000 + 20% of the income exceeding Rs. 150000 Above Rs. 250000 Rs. 25000 + 30% of the income exceeding Rs. 250000 void display() : output the details of the employee as per given format: Pan Number Name Taxable Income Tax ___________ _____ ______________ ____

Formatting page ...

Formatting page ...

 

  Print intermediate debugging step

Show debugging info


 

 

© 2010 - 2025 ResPaper. Terms of ServiceContact Us Advertise with us

 

ananthinaga chat