GithubHelp home page GithubHelp logo

jaison080 / oop_lab Goto Github PK

View Code? Open in Web Editor NEW
10.0 1.0 4.0 674 KB

Contains solutions to all OOP Lab Programs

Home Page: https://jaison080.github.io/oop_lab/

Java 100.00%
java object oop oriented objectoriented ktu-s3 object-oriented-programming mec mecthrikkakara modelengineeringcollege

oop_lab's Introduction

Object Oriented Programming Lab(2019 Scheme)

OOP LAB

Contains solutions for all OOP Lab Programs. This repository contains all you need for OOP Lab of KTU Semester 3. The program description are given below and you can open the corresponding program from the repository.


CYCLE 1

  • 1.This is a simple Java program. Solution
  • 2.Num Program. Solution
  • 3.User input example. Solution
  • 4.Find the sum of digits in an integer read from the keyboard. Solution
  • 5.Find the largest of N numbers, without using array. Solution

CYCLE 2

  • 6.Write a Java program that checks whether a given string is a palindrome or not. Solution
    Input: String read from keyboard
    Output: Message displayed.
  • 7.Write a Java program to find the frequency of given character in a string. Solution
    Input: String read from keyboard Character read from keyboard.
    Output: Number of occurrences of the character in the string
  • 8.Write a Java program to multiply two given matrices. Solution
    Input: Dimensions of two matrices (MxN, PxQ) : If dimensions are suitable for multiplication, read two integer matrices, say A and B
    Output: Matrices A, B and C = A*B displayed / Error message

CYCLE 3

  • 9.Write a Java program to reverse a given string. Solution
  • 10.Write a Java program to display the transpose of a given matrix. Solution
  • 11.Write a Java program to find the second smallest element in an array. Solution
  • 12.Write a Java program to check whether a given number is prime or not. Solution

CYCLE 4

  • 13.Write two Java classes Employer and Engineer. Engineer should inherit from Employee class. Employee class to have two methods display() and calcSalary(). Write a program to display the engineer salary and to display from Employee class using a single object instantiation.(ie. only one object creation allowed)
    -> display() only prints the name of the class and doe snot return any value. Ex. "Name of class in Employee"
    -> calcSalary() in Employee displays "salary of employee is 10000" and calcSalary() in Engineer displays "Salary of employee is 20000".
    Solution
  • 14.Write a Java program to which creates a class named "Employee" having the following members: Name, Age, Phone number, Address, Salary. It also has a method named 'printSalary()' which prints the salary of the Employee. Two classes 'Officer' and 'Manager' classes have data members 'specialization' and 'department' respectively. Now, assign name, age, phone number, address and salary to an officer and a manager by making an object of both of these classes and print the same. Solution

CYCLE 5

  • 15.Write a Java program to create an abstract class named Shape that contains an empty method named numberOfSides(). Provide three classes named Rectangle, Triangle, and Hexagon such that each one of the classes extends the class Shape. Each one of the classes contains only the method numberOfSides()that shows the number of sides in the given geometrical structures. Solution
  • 16.Write a Java program to calculate the area of different shapes namely circle, rectangle and triangle using the concept of method overloading. Solution
  • 17.Write a Java program to demonstrate the use of garbage collector. Solution

CYCLE 6

  • 18.Write a Java program for implementing a doubly linked list( elements of the list may be integers).
    Make it a menu driven program with following options,
    i) Insert (insertion may be at tail end)
    ii) Delete (read the element to delete, search it and then delete, print error message if not found)
    iii) Display list
    iv) Exit.
    Solution
  • 19.Write a Java program that implements Quick sort algorithm for sorting a list of numbers in ascending order. Solution
  • 20.Write a Java program that implements Quick sort algorithm for sorting a list of names in ascending order. Solution
  • 21.Write a Java program that implements the Binary Search algorithm. Solution

CYCLE 7

  • 22.Extend the implementation of Singly linked list to Doubly Linked List. Solution
  • 23.Extend the Quicksort program to sort a list of names. Use compareTo() method for comparing strings. Solution
  • 24.Write a Java program to illustrate Interface Inheritance. Solution

CYCLE 8

  • 25.Write a File Handling program in Java with Reader/Writer. Solution
  • 26.Write a Java program that read from a file and write to file by handling all file related exceptions. Solution

CYCLE 9

  • 27.Write a Java program that implements a Multi-Threaded program which has three threads. First thread generates a random integer every 1 second. if the value is even, second thread computes the square of the number and prints. If the value is odd, the third thread will print the value of cube of that number. Solution
  • 28.Write a Java program that shows Thread Synchronization. Solution

CYCLE 10

  • 29.Write a Java program that reads a line of integers and then displays each integer, and the sum of all the integers. (use String Tokenizer class of java.util). Solution
  • 30.Write a Java program to display all records from a table using Java Database Connectivity (JDBC). Solution

CYCLE 11

  • 31.Write a Java program that works as a simple calculator. Arrange buttons for digits and the +,-,*,/ operations properly. Add a text field to display the result. Handle any exceptions like divide by zero. Use Java Swing. Solution
  • 32.Write Java program that simulates a traffic light. The program lets the user select one of three lights.: Red, Green or Yellow. When a radio button is selected, the light is turned on and only one light can be on at a time/ No light is on when the program starts. Solution

EXTERNAL EXAM QUESTION

  • 33.Write a Java program that creates two textfields and a button named REVERSE.The first textfield inputs the string from the user and when the button is pressed the second textfield displays the each word reversed in a sentence. Solution

Made with ❤️ Jaison Dennis

oop_lab's People

Contributors

jaison080 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.