Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
3 views

Functions in Java

Uploaded by

mayuri
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Functions in Java

Uploaded by

mayuri
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

ASSIGNMENT 3

Write Java programs:


1. Create a class called Employee with the following specifications.
Data Members
eid of int type – stores the employee code
basic of double type – stores basic pay of the employee
totalsal of double type – stores total salary

Methods:
void input( ) – to accept the employee details
void print( ) - to print the Employee ID, basic and total salary
void salaryCal( ) – to calculate the total salary of the employee that is calculated
as follows:
HRA = 30% of basic pay
DA = 40% of basic pay
total _salary = basic pay + HRA + DA
If employee code <= 15, a special allowance of 20% of basic is added to
total_salary else a special allowance of Rs.1000 is added to the total_salary.

Write the main function to create an object of employee class and invoke the
methods appropriately to accomplish the task.

2. Design a class Student to check whether a student is eligible for taking admission
in Class XI with the following specifications:
Instance variables/Data Members:
Id ( integer value ) : stores the id of a student
Physics ( integer value ) : stores marks secured in Physics
Chemistry ( integer value ) : stores marks secured in Chemistry
Maths ( integer value ) : stores marks secured in Maths
streamCode (integer value ) : stores stream code
Member Methods:
void input( ) : to accept the data members by accepting the details of the student
void check ( ) : to check the eligibility for course and assign the appropriate
Stream Code to streamCode with the following conditions
Marks Stream Code Eligibility
90 % or more in all the subjects 100 Science with
Computer
Average marks 90 % or more 200 Bio Science
Average marks 80 % or more and less than 90 300 Science with Hindi
%

void display() : to display the eligibility


Write the main method to create an object of the class and call the member methods .

****************
1|MAYURI’S COMPUTER ACADEMY

You might also like