Posts

CS8382-OBJECT ORIENTED PROGRAMMING LABORATORY-TO GERNERATE EMPLOYEE SALARY SLIP PROGRAM IN JAVA

CS8382-OBJECT ORIENTED PROGRAMMING LABORATORY     TO GERNERATE EMPLOYEE SALARY SLIP PROGRAM IN JAVA PROGRAM import java.util.Scanner; class Employee{ String Emp_name; int Emp_id; String Address; String Mail_id; long Mobile_no; void display(String Emp_name,int Emp_id,String Mail_id,long Mobile_no,String Address){ System.out.println(Emp_name); //Syetem.out.println(Address); System.out.println(Emp_id); System.out.println(Mail_id); System.out.println(Mobile_no); } } class Programmer extends Employee{   int BP; /*int  DA= (int) (0.97*BP);  HRA=(int) (0.10*BP);  PF=(int) (0.12*BP);  */ void display(int BP){     System.out.println(BP);  System.out.println("DA:"+0.97*BP);  System.out.println("HRA:"+0.10*BP);     System.out.println("PF:"+0.12*BP);  System.out.println("SATFF CLUD FUND:"+0.001*BP);         } } class Assistant_Professor extends Employee{  ...

CS8382-OBJECT ORIENTED PROGRAMMING LABORATORY-CONVERSTION PROGRAMS USING PACKAGES IN JAVA

CS8382-OBJECT ORIENTED PROGRAMMING LABORATORY CONVERSTION PROGRAMS USING PACKAGES IN JAVA Program Convertor.java package mypack; import mypack.*; import converter.*; import java.util.*; public class Converter { public static void main(String[] args) {        double amt,val = 0;        int a;               System.out.println("\n***menu for money conversion***\n 1.dollar to inr\n 2.inr to dol\n 3.erupo to in \n 4. int to eruop\n5. jan to in \n 6. int to ja\n7.km to meter\n 8. metter to km \n 9.miles to km\n 10. km to miles \n 11.hours to mintues \n 12. mintues to hors\n Enter your choice[0-12]:");        Scanner read= new Scanner(System.in);        a=read.nextInt();          switch(a){              ...

CS8382-OBJECT ORIENTED PROGRAMMING LABORATORY-TO CALCULATE EB BILL IN JAVA

CS8382-OBJECT ORIENTED PROGRAMMING LABORATORY       To calculate EB bill Program: import java.util.*; class CalculateElectricityBill {        double billpay;     CalculateElectricityBill(long units)     {         if(units<100)         billpay=units*1.20;       else if(units<=300)         billpay=100*1.20+(units-100)*2;       else if(units>300)         billpay=100*1.20+200 *2+(units-300)*3;                   }        } class ComputeElectricityBill {         public static void main(String args[])         {           long units;...

CS8461- OPERATING SYSTEMS LABORATORY-Write C programs to simulate UNIX commands like cp, ls, grep, etc.

Write C programs to simulate UNIX commands like cp, ls, grep, etc. x Before seeing the program you have to learn about what is the meaning of the following commands. cp - copy- it is used to copying contents from one file to another file. Syntax: cp Source Destination ls -list- its used to list all file names in the directory. Syntax: ls grep- The grep filter searches a file for a particular pattern of characters, and displays all lines that contain that pattern. Syntax: grep [options] pattern [files] Options Description -c : This prints only a count of the lines that match a pattern -h : Display the matched lines, but do not display the filenames. -i : Ignores, case for matching -l : Displays list of a filenames only. -n : Display the matched lines and their line numbers. Below code is included code of  both cp & ls command. Program: #include<stdio.h> #include<stdlib.h> #include<dirent.h> #define D...

CS8382-OBJECT ORIENTED PROGRAMMING LABORATORY-TO FIND THE MAXIMUM VALUE FROM THE GIVEN TYPE OF ELEMENTS USING GENERIC FUNCTION

CS8383-OBJECT ORIENTED PROGRAMMING LABORATORY-TO FIND THE MAXIMUM VALUE FROM THE GIVEN TYPE OF ELEMENTS USING  GENERIC FUNCTION CS8382-OBJECT ORIENTED PROGRAMMING LABORATORY PROGRAM: import java.util.Scanner; public class MaximumTest {    // determines the largest of three Comparable objects        public static <T extends Comparable<T>> T maximum(T x, T y, T z) {       T max = x;   // assume x is initially the largest              if(y.compareTo(max) > 0) {          max = y;   // y is the largest so far       }              if(z.compareTo(max) > 0) {          max = z;   // z is the largest now                        }       return ma...

CS8382-OBJECT ORIENTED PROGRAMMING LABORATORY-TO GERNERATE RANDOM NUMBER USING LINEAR CONGRUENTIAL METHOD IN JAVA

CS8382-OBJECT ORIENTED PROGRAMMING LABORATORY GERNERATE RANDOM NUMBER USING  LINEAR CONGRUENTIAL METHOD IN JAVA PROGARM:  import java.util.*; public class myRnd {         final int m,a,b;      int x;   public myRnd(){             Scanner in=new Scanner(System.in);         System.out.println("enter the value of m");         m=in.nextInt();                 System.out.println("enter the value of a");         a=in.nextInt();         System.out.println("enter the value of b");         b=in.nextInt();                               x = m / 2;   }          double next() {           ...

CS8382-OBJECT ORIENTED PROGRAMMING LABORATORY-Create user defined Exception Handling in Java

CS8382-OBJECT ORIENTED PROGRAMMING LABORATORY CREATE A USER DEFINED EXCEPTION HANDLING IN JAVA  PROGRAM: import java.util.Scanner; import java.io.*; public class Demo{ public static void main(String args[]){ try { int ch;   System.out.println("enter\n1.arithmeticexception\n2.arrayindexOfBoundexception\n3.Nullpointerexception\n4.NumberFormtexception \n enter your choice:\n"); Scanner in=new Scanner(System.in); ch=in.nextInt(); switch(ch) {   case 1:            int  a;            a=args.length;            System.out.println("a"+a);            int b=42/a;             break; case 2:            int c[]={1};            c[42]=99;            break; case 3:             ...