Skip to content

adarsh4997/java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

77 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Java Programs

This repository contains a collection of Java programs demonstrating various concepts and functionalities.

This may not be an updated README file. Head to Geekster folder for more insights.

Feel free to give your insights and code correction

Programs

1. DataTypeStore.java

  • File Name: DataTypeStore.java
  • Description: This program showcases the usage of different data types in Java and how to store and manipulate data.

2. DayofWeek.java

  • File Name: DayofWeek.java
  • Description: This program determines the day of the week based on user input and demonstrates the use of conditional statements.

3. JavaEOF.java

  • File Name: JavaEOF.java
  • Description: This program illustrates the use of End-of-File (EOF) in Java when reading input from the console.

4. evenodd.java

  • File Name: evenodd.java
  • Description: This program checks whether a given number is even or odd and prints the result.

5. inttostring.java

  • File Name: inttostring.java
  • Description: This program converts an integer to a string and demonstrates string manipulation in Java.

6. characterOccurrence.java

  • File Name: characterOccurrence.java
  • Description: This program counts occurrences of the characters 'a' (or 'A') and 's' (or 'S') in a given string.

7. AlternateCharacters.java

  • File Name: AlternateCharacters.java
  • Description: This program prints every alternate character in a given string.

8. runSumCalc.java

  • File Name: runSumCalc.java
  • Description: The program prompts the user for the number of integers to input (n) and then processes each integer, updating and printing the running sum after each input.

9. AlternatePositionArrayPrint.java

  • File Name: AlternatePositionArrayPrint.java
  • Description: This program prints elements at alternate positions in an array.

10. GCD.java

  • File Name: GCD.java
  • Description: This program calculates the Greatest Common Divisor (GCD) of two numbers.

11. Permutation.java

  • File Name: Permutation.java
  • Description: This program generates and prints all permutations of a given string.

12. addOne.java

  • File Name: addOne.java
  • Description: This program adds 1 to the last digit of a given number.

13. addTwoArray.java

  • File Name: addTwoArray.java
  • Description: This program adds two arrays element-wise and prints the result.

14. characterOccurence.java

  • File Name: characterOccurence.java
  • Description: This program counts occurrences of the characters 'a' (or 'A') and 's' (or 'S') in a given string.

15. diamondPattern.java

  • File Name: diamondPattern.java
  • Description: This program prints a diamond pattern using asterisks.

16. divideAndSteps.java

  • File Name: divideAndSteps.java
  • Description: This program calculates the number of steps needed to reach 1 by repeatedly dividing a number by 2.

17. dumrooPattern.java

  • File Name: dumrooPattern.java
  • Description: This program prints a pattern resembling the shape of a dumroo (Indian drum).

18. examresult.java

  • File Name: examresult.java
  • Description: This program takes exam scores as input and determines the result (pass or fail) based on a predefined passing threshold.

19. factorial.java

  • File Name: factorial.java
  • Description: This program calculates the factorial of a given number.

20. findIndex.java

  • File Name: findIndex.java
  • Description: This program finds and prints the index of a specific element in an array.

21. firstIndexOfX.java

  • File Name: firstIndexOfX.java
  • Description: This program finds and prints the first index of the element 'X' in an array.

22. hollowRectangle.java

  • File Name: hollowRectangle.java
  • Description: This program prints a hollow rectangle pattern using asterisks.

23. hollowSquareWithoutTop.java

  • File Name: hollowSquareWithoutTop.java
  • Description: This program prints a hollow square pattern without the top side using asterisks.

24. identicalArray.java

  • File Name: identicalArray.java
  • Description: This program checks if two arrays are identical (have the same elements in the same order).

25. invertedRightAngleTriangle.java

  • File Name: invertedRightAngleTriangle.java
  • Description: This program prints an inverted right-angle triangle pattern using asterisks.

26. invertedTriangle.java

  • File Name: invertedTriangle.java
  • Description: This program prints an inverted triangle pattern using asterisks.

27. isArmstrong.java

  • File Name: isArmstrong.java
  • Description: This program checks whether a given number is an Armstrong number.

28. isPrime.java

  • File Name: isPrime.java
  • Description: This program checks whether a given number is a prime number.

29. leapyear.java

  • File Name: leapyear.java
  • Description: This program checks whether a given year is a leap year.

30. modifyIndex.java

  • File Name: modifyIndex.java
  • Description: This program modifies the value at a specified index in an array.

31. nCrCalculate.java

  • File Name: nCrCalculate.java
  • Description: This program calculates the combination (nCr) of two given numbers, representing "n choose r."

32. nonMatchingNumberFirstPosition.java

  • File Name: nonMatchingNumberFirstPosition.java
  • Description: This program finds and prints the position of the first non-matching element in two arrays.

33. numberFormReverse.java

  • File Name: numberFormReverse.java
  • Description: This program takes a number as input, reverses its digits, and prints the reversed number.

34. numberOfSteps.java

  • File Name: numberOfSteps.java
  • Description: This program calculates and prints the number of steps needed to reduce a given number to zero, following a specific set of rules.

35. pattern.java

  • File Name: pattern.java
  • Description: This program prints a pattern using numbers in a specific sequence.

36. perfectnumber.java

  • File Name: perfectnumber.java
  • Description: This program checks whether a given number is a perfect number.

37. productExceptSelf.java

  • File Name: productExceptSelf.java
  • Description: This program calculates the product of all elements in an array, except for the element at the current position.

38. pyramid.java

  • File Name: pyramid.java
  • Description: This program prints a pyramid pattern using asterisks.

39. removeElementandPrintSize.java

  • File Name: removeElementandPrintSize.java
  • Description: This program removes a specified element from an array and prints the size of the modified array.

40. rightAngleNumberPattern.java

  • File Name: rightAngleNumberPattern.java
  • Description: This program prints a right-angled number pattern using integers.

41. rightAngleTriangle.java

  • File Name: rightAngleTriangle.java
  • Description: This program prints a right-angled triangle pattern using asterisks.

42. rightAngleTriangle1.java

  • File Name: rightAngleTriangle1.java
  • Description: This program prints a right-angled triangle pattern with numbers in ascending order.

43. runSumCalc.java

  • File Name: runSumCalc.java
  • Description: This program prompts the user for the number of integers to input (n) and then processes each integer, updating and printing the running sum after each input.

44. salaryCalc.java

  • File Name: salaryCalc.java
  • Description: This program calculates the net salary of an employee based on the basic salary and allowances.

45. secondLargestArray.java

  • File Name: secondLargestArray.java
  • Description: This program finds and prints the second-largest element in an array.

46. squareLadder.java

  • File Name: squareLadder.java
  • Description: This program prints a square ladder pattern using asterisks.

47. sumOfElementsExceptSelf.java

  • File Name: sumOfElementsExceptSelf.java
  • Description: This program calculates the sum of all elements in an array, excluding the element at the current position.

48. swapUsingBitwise.java

  • File Name: swapUsingBitwise.java
  • Description: This program swaps two numbers using bitwise XOR operations.

49. targetArray.java

  • File Name: targetArray.java
  • Description: This program checks if it is possible to reach a target array from another array by performing specific operations.

50. timeconverter.java

  • File Name: timeconverter.java
  • Description: This program converts time from 24-hour format to 12-hour format.

How to Use

To run these programs in Visual Studio Code, follow these steps:

  1. Install Java:

  2. Install Visual Studio Code:

  3. Install Java Extension Pack:

    • Open VS Code and go to Extensions (or press Ctrl + Shift + X), then search for "Java Extension Pack" and install it.
  4. Open Project in VS Code:

    • Clone this repository to your local machine using Git.
    • Open the cloned project folder in Visual Studio Code.
  5. Run Java Programs:

    • Navigate to the specific program file (e.g., DataTypeStore.java) in the VS Code Explorer.
    • Open the file and run the program using the integrated terminal or the "Run" button.

Feel free to contribute, provide feedback, or suggest improvements. Happy coding!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages