ishanjogalekar / Java-Programs

Different Java Codes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Java Codes - Different Java Codes.

Included topics :

  1. Java core.
  2. Java polymorphism.
  3. Java file handling.
  4. Java multithreading.
  5. Java object oriented programming.

Note: Program links are given in front of questions directly.

Java

Questions

  1. calendar - Date and weekday finder in Java. ->Calendar Program
  2. BMI calculator. ->BMI calculator
  3. Vowelgram in Java. ->Vowelgram
  4. Hostel registration program based on CGPA of student in Java (Multi-threading concepts and file handling with .txt file). :- Create classes Students and HostelBlocks with necessary details.
    a)Store the objects as collections in a File.
    b)Create threads for Hostel_Incharge to allocate rooms based on CGPA.
    c)If incharges are trying to allocate the same rooms, handle the situation using inter thread communication. ->Hostel Registration
  5. Fibonacci Series in Java. ->Fibonacci series
  6. Define an abstract class called Travel [defined in package1] with few appropriate data members and methods for getting and displaying the same,
    a)create two subclasses called InternationalTravel and NationalTravel with new necessary data members respectively.
    b)Create at least three objects for both of the subclasses and just display the info in package2 based on your travel experience so far.
    c)Also create a method which scans the places which you would like to travel along with tentative year, in which you may travel and display that as well [Future plans]. ->Travelling Program
  7. Create a class called Student with Data members :
    (A) Regno
    (B) Name
    (C) static data member named as Univ_name and static counter variable to store number of objects created and
    Methods :
    (a) GetMethod
    (b) PrintMethod
    (c) Constructor
    (d) Parametrized constructor
    Also create a class called Courses with details like Course code,name,slot and venue along with necessary methods.
    (I)Main method has to be provided in Registration class
    (II) create 4 course objects with two A1 slot courses, two B1 slot courses
    (III)create two students objects and get display all course details to them and inform them to choose two subjects
    (IV) if the selected courses have same slots, ask student to choose without clashing
    (V) print the selected course in a table format with all necessary details.
    ->Students' Subject program
  8. Design a class called Participants with properties like Name,Phno,Branch and University, TestResult_Classification[L1,L2,L3,L4,L5].
    Create a static method to display a message as follows based on the selection criteria,
    (i) If student test result classification is L1, congratulate the student and inform that he/she has been selected for both Full time intership as well as Full time job.
    (ii) If student test result classification is L2 or L3, inform the student that he/she has been selected for Full time intership and Job may be offered based on intership Performance.
    (iii) If student test result classification is L4 or L5, inform that he/she has been selected for Part time intership of 21 days.
    Note: A)Don’t use if statement for conditional check, instead use Switch Case statement.
    B)Create atleast three Participants objects of array and then invoke static method to display the message.
    ->Internship result program
  9. Create a class person with datamembers like name,age, phno with methods getvalues and printvalues,
    I)store the class in a package called pack1.
    II)Define a class named student in subpackage SubPack1 and extend the class defined as person.
    II)Use this class in a program of different package Pack2, create an object and invoke the methods defined in pack1 class file.
    ->subpackages in Java
  10. Create a program to take input from user as 1/2/3,
    i)If user enters 1, display info about Arithmetic Exception,
    ii)If enters 2 and 3 for Null pointer exception and Array index out of bound exception, respectively.
    Use: try, Catch block for each exception individually.
    ->Exceptions handling try-catch in Java
  11. Throw program example in Java. ->Throw in Java
  12. Five events - E1, E2, E3, E4 and E5 are going to be organized for Rivera in VIT,
    Registration is open for all B.Tech students. With the total strength of 1000 students,
    Simulate the registration for each event by generating 1000 random numbers in the range of 1 – 5.(1 for event E1 like wise).
    I)Store the values in an array.
    II)Create six threads to equally share the task of counting the number of registration details for all the events.
    III)Use synchronized method or synchronized block to update the count variables. IV)The main thread should receive the final registration count for all events and display the list of students who have not registered in any event.
    ->Event handling using multi-threading in Java
  13. Java Famous problem - Roti Problem
    In a family, Mom prepares roti for her children.Mom makes roti and stacks it up in a vessel, and Children eats from it.
    I)The max capacity of the vessel is 10.
    II)If roti empties, Children wait for mom to prepare new roti.
    Develop a program for the given scenario using inter thread communication concept in Java programming.
    ->Roti problem in Java
  14. Write your information [as string as well as MyInfo Class object] like regno, name, cgpa and phno into a file
    a)Read from the file and print in the console.
    b)Use Serialization and Deserialization in the program.
    ->My Information using .txt files in Java
  15. Traverse a file (.txt) and count the words CSE1007 and JAVA, print the count of these words (Total count of "CSE1007" like this) in console.
    Note - Also include other words in that file.
    ->Count words in .txt file in Java
  16. OddEvenTest :- Checking number is odd or even using Java recursive approch & User defined methods. ->Odd & Even no using users defined method
  17. Maximum number in array using User defined method in Java. ->Maximum number using user defined method
  18. Checking number is strong or not in Java
    Note - Strong number is a number whose sum of all digits’ factorial is equal to the number ‘n’. example : 145 = 1! + 4! + 5!
    ->Strong number
  19. Make 2 linked list add numbers in it. print multiplication of corresponding index numbers in another linked list. ->Multiplication in 2 linked lists
  20. Java Program to add two integers but take integers input as String.Convert String to int (without type conversion) and add integers. ->Add 2 integers as strings in Java
  21. Java Magic Number program.
    Magic number is -> Consider an example , 325 is a magic number because the sum of its digits (3+2+5) is 10, and again sum up the resultant (1+0),
    we get a single digit (1) as the result. Hence, the number 325 is a magic number.Some other magic numbers are 1234, 226, 10, 1, 37, 46, 55, 73, etc.
    ->Magic number
  22. Print missing alphabets in String.
    Example: If "Ishan" is String then missing alphabets are : {b c d e f g j k l m o p q r t u v w x y z} consider only lower case.
    ->Missing alphabets in string
  23. Find largest digit in number.
    Example: If number is "128" then largest digit is: 8
    ->Largest digit in number
  24. Find smallest and largest digit in number using Math Package.
    Example: If number is "128" then smallest digit is : 1 and largest digit is: 8
    ->Smallest and Largest digit in number
  25. Sort Hash-map using Tree-map with respective to keys in Hash-map.
    ->Sort Hash-map
  26. Given an array of integers nums containing n + 1 integers where each integer is in the range [1,n] inclusive.There is only one repeated number in nums, return this repeated number.
Input: nums = [1,3,4,2,2]
Output: 2

->Find Duplicate Number

  1. Given number N and K , weird nucountmbers netween 1 to N. Weird number is number is not divisible by K and sum of digits is divisible by K.
Input:  N = 11 , K = 2
Output: 1

->Weird-Number

  1. Find and remove third consonant in String from the end of string.
Input: String = asdfguihj
Output: g

->Remove Consonant

  1. Complementary DNA (Codewars question) - Deoxyribonucleic acid (DNA) is a chemical found in the nucleus of cells and carries the "instructions" for the development and functioning of living organisms.In DNA strings, symbols "A" and "T" are complements of each other, as "C" and "G". Your function receives one side of the DNA (String); you need to return the other complementary side. DNA strand is never empty or there is no DNA at all.
Input: "ATTGC"
Output: "TAACG"

->Question link
->Complementary DNA

  1. Find the next perfect square (Codewars question) - Complete the findNextSquare method that finds the next integral perfect square after the one passed as a parameter. Recall that an integral perfect square is an integer n such that sqrt(n) is also an integer.If the parameter is itself not a perfect square then -1 should be returned. You may assume the parameter is non-negative.
Input: 121
Output: 144

->Question link
->Next Square
31. Get the Middle Character (Codewars question) - You are going to be given a word. Your job is to return the middle character of the word. If the word's length is odd, return the middle character. If the word's length is even, return the middle 2 characters.

Input: test
Output: es

->Question link
->Middle char


AES Cryptography:

AES cryptography using Java XML JAR.
AES is symmetric cryptography technique or algorithm ->AES Cryptography Note - Check AES_cryptography folder within main brach for project.


Project :- SPA (Single Page Application)

SPA Project

Spring Maven Intellij Idea MySql HTML CSS Bootstrap FontAwesome

I) Spring Boot application using Maven.
II) pom.xml contains all dependencies.
III) Also used MySql as relation database.
IV) Devloped in Intellij Idea IDE.
Note - Check SPA folder within main brach for project.


About

Different Java Codes


Languages

Language:Java 83.5%Language:HTML 16.5%