EX NO :8 PROGRAM FOR DISPLAYING FILE INFORMATION AIM To write a java program that reads a file name from the user, displays information about whether the file exists, whether the file is readable, or writable, the type of file and the length of the file in bytes. PROCEDURE 1. Create a class filedemo. Get the file name from the user . 2. Use the file functions and display the information about the file. 3. getName() displays the name of the file. 4. getPath() diplays the path name of the file. 5. getParent() -This method returns the pathname string of this abstract pathname’s parent, or null if this pathname does not name a parent directory. 6. exists() – Checks whether the file exists or not. 7. canRead()-This method is basically a check if the file can be read. 8. canWrite()-verifies whether the application can write to the file. ...
To develop a Java application to generate Electricity bill.
PROCEDURE
1.Create a class with the following members Consumer no., consumer name, previous month reading,
current month reading, type of EB connection (i.e domestic or commercial).
2.Compute the bill amount using the following tariff.
If the type of the EB connection is domestic, calculate the amount to be paid as follows:
• First 100 units - Rs. 1 per unit
• 101-200 units - Rs. 2.50 per unit
• 201 -500 units - Rs. 4 per unit
• 501 units - Rs. 6 per unit
If the type of the EB connection is commercial, calculate the amount to be paid as follows:
• First 100 units - Rs. 2 per unit
• 101-200 units - Rs. 4.50 per unit
• 201 -500 units - Rs. 6 per unit
• 501 units - Rs. 7 per unit
3.
Create the object for the created class .Invoke the methods to get the input from the consumer and
display the consumer information with the generated electricity bill.
For codes : github.com/NithyaNarayananV/OOPS_RECORD/tree/main/EXP_1
Github Code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EX NO: 3 PROGRAM TO GENERATE PAYSLIP USING INHERITANCE AIM To develop a java application to generate pay slip for different category of employees using the concept of inheritance. PROCEDURE 1. Create the class employee with name, Empid, address, mailid, mobileno as members. 2. Inherit the classes programmer, asstprofessor,associateprofessor and professor from employee class. 3. Add Basic Pay (BP) as the member of all the inherited classes. 4. Calculate DA as 97% of BP, HRA as 10% of BP, PF as 12% of BP, Staff club fund as 0.1% of BP. 5. Calculate gross salary and net salary. 6. Generate payslip for all categories of employees. 7. Create the objects for the inherited classes and invoke the necessary methods to display the Payslip.
EX NO: 2 PROGRAM TO IMPLEMENT CURRENCY CONVERTER, DISTANCE CONVERTER AND TIME CONVERTER USING PACKAGES AIM To develop a javax application to implement currency converter, distance converter and time converter using the concept of packages. PROCEDURE 1. Create a Package currencyconversion and place the class currency under the package 2. Create the methods to perform currency conversion from dollar to rupee, rupee to dollar, euro to rupee, rupee to euro, yen to rupee and rupee to yen. 3. Create the package distanceconverion and create the class distance within the package 4. Create the methods to convert from meter to km, km to meter, miles to km,km to miles 5. Create the package timeconversion and create the class timer .Create the methods to convert from hours to minutes ,hours to seconds , minutes to hours and seconds to hours 6. Create a class and import the packages currencyconversion, distanceconversion and time conversion. Create the objects for the class currency, distance ...
Comments
Post a Comment