es
Feedback
Tech Jargon - Decoded

Tech Jargon - Decoded

Ir al canal en Telegram

Confused by tech terms? Don’t worry, we’ve got you 🤝 We make things simple, one concept at a time. Learn daily Easy & clear Turn Confusion into clarity. #tech #it #softwareengineer #cs #development

Mostrar más
2 018
Suscriptores
Sin datos24 horas
-77 días
-4030 días
Archivo de publicaciones
💻 Simple Grade Calculator (A, B, C, D, F)
import java.util.Scanner;

public class SimpleGradeCalculator {

    public static void main(String[] args) {

        Scanner input = new Scanner(System.in);

        System.out.print("Enter your marks: ");
        int marks = input.nextInt();

        char grade;

        if (marks >= 90) {
            grade = 'A';
        } else if (marks >= 80) {
            grade = 'B';
        } else if (marks >= 70) {
            grade = 'C';
        } else if (marks >= 60) {
            grade = 'D';
        } else {
            grade = 'F';
        }

        System.out.println("Your grade is: " + grade);

        input.close();
    }
}
📤 Output:
Input: 85
Output: Enter your marks: Your grade is: B

Input: 92
Output: Enter your marks: Your grade is: A

Input: 55
Output: Enter your marks: Your grade is: F

Input: 71
Output: Enter your marks: Your grade is: C

Input: 60
Output: Enter your marks: Your grade is: D

💻 Find Maximum of Three Numbers
import java.util.Scanner;

public class FindMaximumOfThreeNumbers {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);

        System.out.print("Enter the first number: ");
        int firstNumber = scanner.nextInt();

        System.out.print("Enter the second number: ");
        int secondNumber = scanner.nextInt();

        System.out.print("Enter the third number: ");
        int thirdNumber = scanner.nextInt();

        int maximumNumber;

        if (firstNumber >= secondNumber && firstNumber >= thirdNumber) {
            maximumNumber = firstNumber;
        } else if (secondNumber >= firstNumber && secondNumber >= thirdNumber) {
            maximumNumber = secondNumber;
        } else {
            maximumNumber = thirdNumber;
        }

        System.out.println("The maximum number is: " + maximumNumber);

        scanner.close();
    }
}
📤 Output:
Input: 10
Input: 5
Input: 15
Output: Enter the first number: Enter the second number: Enter the third number: The maximum number is: 15

Input: 2
Input: 2
Input: 2
Output: Enter the first number: Enter the second number: Enter the third number: The maximum number is: 2

Input: -5
Input: -10
Input: -1
Output: Enter the first number: Enter the second number: Enter the third number: The maximum number is: -1

Conditional Statements - else-if ladder

💻 Check if String Starts with Vowel
import java.util.Scanner;

public class StringStartsWithVowel {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.print("Enter a string: ");
        String inputString = scanner.nextLine();

        if (inputString != null && !inputString.isEmpty()) {
            char firstChar = Character.toLowerCase(inputString.charAt(0));
            if (firstChar == 'a' || firstChar == 'e' || firstChar == 'i' || firstChar == 'o' || firstChar == 'u') {
                System.out.println("The string starts with a vowel.");
            } else {
                System.out.println("The string does not start with a vowel.");
            }
        } else {
            System.out.println("The string is empty.");
        }

        scanner.close();
    }
}
📤 Output:
Input: Apple
Output: The string starts with a vowel.
Input: Banana
Output: The string does not start with a vowel.
Input: umbrella
Output: The string starts with a vowel.
Input:
Output: The string is empty.
Input: Orange
Output: The string starts with a vowel.
Input: xyz
Output: The string does not start with a vowel.

💻 Check if Number is Palindrome
import java.util.Scanner;

public class PalindromeNumberChecker {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        System.out.print("Enter a number: ");
        int number = scanner.nextInt();

        int originalNumber = number;
        int reversedNumber = 0;

        while (number > 0) {
            int remainder = number % 10;
            reversedNumber = reversedNumber * 10 + remainder;
            number = number / 10;
        }

        if (originalNumber == reversedNumber) {
            System.out.println(originalNumber + " is a palindrome number.");
        } else {
            System.out.println(originalNumber + " is not a palindrome number.");
        }

        scanner.close();
    }
}
📤 Output:
// Code not available

💻 Check if Character is Uppercase or Lowercase
import java.util.Scanner;

public class CheckCase {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        System.out.print("Enter a character: ");
        char inputChar = scanner.next().charAt(0);

        if (Character.isUpperCase(inputChar)) {
            System.out.println("The character is uppercase.");
        } else if (Character.isLowerCase(inputChar)) {
            System.out.println("The character is lowercase.");
        } else {
            System.out.println("The character is not an alphabet.");
        }

        scanner.close();
    }
}
📤 Output:
Input: A
Output: The character is uppercase.

Input: a
Output: The character is lowercase.

Input: 5
Output: The character is not an alphabet.

Input: $
Output: The character is not an alphabet.

💻 Check if Triangle is Valid
import java.util.Scanner;

public class TriangleValidator {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        System.out.print("Enter the first angle of the triangle: ");
        int angle1 = scanner.nextInt();

        System.out.print("Enter the second angle of the triangle: ");
        int angle2 = scanner.nextInt();

        System.out.print("Enter the third angle of the triangle: ");
        int angle3 = scanner.nextInt();

        // Check if the sum of angles is 180
        if (angle1 + angle2 + angle3 == 180) {
            System.out.println("The triangle is valid.");
        } else {
            System.out.println("The triangle is not valid.");
        }

        scanner.close();
    }
}
📤 Output:
Input: 60
Input: 60
Input: 60
Output: The triangle is valid.

Input: 90
Input: 45
Input: 45
Output: The triangle is valid.

Input: 100
Input: 50
Input: 20
Output: The triangle is not valid.

💻 Check if Number is Prime
import java.util.Scanner;

public class PrimeNumberChecker {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);

        System.out.print("Enter a number: ");
        int number = scanner.nextInt();

        boolean isPrime = true;

        if (number <= 1) {
            isPrime = false;
        } else {
            for (int i = 2; i <= Math.sqrt(number); i++) {
                if (number % i == 0) {
                    isPrime = false;
                    break;
                }
            }
        }

        if (isPrime) {
            System.out.println(number + " is a prime number.");
        } else {
            System.out.println(number + " is not a prime number.");
        }

        scanner.close();
    }
}
📤 Output:
Input: 7
Output: 7 is a prime number.

Input: 10
Output: 10 is not a prime number.

Input: 1
Output: 1 is not a prime number.

Input: 0
Output: 0 is not a prime number.

Input: 2
Output: 2 is a prime number.

Input: 4
Output: 4 is not a prime number.

💻 Check if Person is Eligible to Vote
import java.util.Scanner;

public class VotingEligibilityChecker {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);

        System.out.print("Enter your age: ");
        int age = scanner.nextInt();

        if (age >= 18) {
            System.out.println("You are eligible to vote.");
        } else {
            System.out.println("You are not eligible to vote.");
        }

        scanner.close();
    }
}
📤 Output:
Input: 25
Output: Enter your age: You are eligible to vote.

Input: 16
Output: Enter your age: You are not eligible to vote.

💻 Check Profit or Loss from Cost and Sell Price
import java.util.Scanner;

public class ProfitLossChecker {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        System.out.print("Enter the cost price: ");
        double costPrice = scanner.nextDouble();

        System.out.print("Enter the selling price: ");
        double sellingPrice = scanner.nextDouble();

        if (sellingPrice > costPrice) {
            double profit = sellingPrice - costPrice;
            System.out.println("Profit of: " + profit);
        } else if (costPrice > sellingPrice) {
            double loss = costPrice - sellingPrice;
            System.out.println("Loss of: " + loss);
        } else {
            System.out.println("No profit, no loss.");
        }

        scanner.close();
    }
}
📤 Output:
Input: 100
Input: 120
Output: Profit of: 20.0

Input: 100
Input: 80
Output: Loss of: 20.0

Input: 100
Input: 100
Output: No profit, no loss.

💻 Check if Character is Alphabet or Digit
import java.util.Scanner;

public class CheckAlphabetOrDigit {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);

        System.out.print("Enter a character: ");
        char ch = scanner.next().charAt(0);

        if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')) {
            System.out.println(ch + " is an alphabet.");
        } else if (ch >= '0' && ch <= '9') {
            System.out.println(ch + " is a digit.");
        } else {
            System.out.println(ch + " is neither an alphabet nor a digit.");
        }

        scanner.close();
    }
}
📤 Output:
Input: A
Output: Enter a character: A is an alphabet.

Input: 5
Output: Enter a character: 5 is a digit.

Input: $
Output: Enter a character: $ is neither an alphabet nor a digit.

💻 Check if Number is Even or Odd
import java.util.Scanner;

public class EvenOddChecker {

    public static void main(String[] args) {

        Scanner input = new Scanner(System.in);

        System.out.print("Enter an integer: ");
        int number = input.nextInt();

        if (number % 2 == 0) {
            System.out.println(number + " is an even number.");
        } else {
            System.out.println(number + " is an odd number.");
        }

        input.close();
    }
}
📤 Output:
Input: 4
Output: Enter an integer: 4 is an even number.

Input: 7
Output: Enter an integer: 7 is an odd number.

💻 Check if Number is Positive or Negative
import java.util.Scanner;

public class PositiveNegativeCheck {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);

        System.out.print("Enter a number: ");
        int number = scanner.nextInt();

        if (number > 0) {
            System.out.println("The number is positive.");
        } else if (number < 0) {
            System.out.println("The number is negative.");
        } else {
            System.out.println("The number is zero.");
        }

        scanner.close();
    }
}
📤 Output:
Input: 10
Output: Enter a number: The number is positive.
Input: -5
Output: Enter a number: The number is negative.
Input: 0
Output: Enter a number: The number is zero.

Conditional Statements - if-else

💻 Check if Character is Alphabet
import java.util.Scanner;

public class AlphabetChecker {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.print("Enter a character: ");
        char inputChar = scanner.next().charAt(0);

        if ((inputChar >= 'a' && inputChar <= 'z') || (inputChar >= 'A' && inputChar <= 'Z')) {
            System.out.println(inputChar + " is an alphabet.");
        } else {
            System.out.println(inputChar + " is not an alphabet.");
        }

        scanner.close();
    }
}
📤 Output:
Input: A
Output: Enter a character: A is an alphabet.

Input: g
Output: Enter a character: g is an alphabet.

Input: 5
Output: Enter a character: 5 is not an alphabet.

Input: $
Output: Enter a character: $ is not an alphabet.

💻 Check if Number is Perfect Square
import java.util.Scanner;

public class PerfectSquareCheck {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.print("Enter a number: ");
        int number = scanner.nextInt();

        if (number < 0) {
            System.out.println("The number is not a perfect square.");
        } else {
            double squareRoot = Math.sqrt(number);
            if (squareRoot == Math.floor(squareRoot)) {
                System.out.println("The number is a perfect square.");
            } else {
                System.out.println("The number is not a perfect square.");
            }
        }
        scanner.close();
    }
}
📤 Output:
Input: 25
Output: The number is a perfect square.

Input: 10
Output: The number is not a perfect square.

Input: -9
Output: The number is not a perfect square.

💻 Check if Person is Adult
import java.util.Scanner;

public class AdultCheck {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        System.out.print("Enter the age of the person: ");
        int age = scanner.nextInt();

        if (age >= 18) {
            System.out.println("The person is an adult.");
        } else {
            System.out.println("The person is not an adult.");
        }

        scanner.close();
    }
}
📤 Output:
Input: 25
Output: Enter the age of the person: The person is an adult.
Input: 16
Output: Enter the age of the person: The person is not an adult.
Input: 18
Output: Enter the age of the person: The person is an adult.

💻 Check if String is Empty
import java.util.Scanner;

public class StringIsEmptyChecker {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);

        System.out.print("Enter a string: ");
        String inputString = scanner.nextLine();

        if (inputString.isEmpty()) {
            System.out.println("The string is empty.");
        } else {
            System.out.println("The string is not empty.");
        }

        scanner.close();
    }
}
📤 Output:
Input: Hello
Output: The string is not empty.
Input:
Output: The string is empty.
Input:
Output: The string is not empty.

💻 Check if Number is Divisible by 5
import java.util.Scanner;

public class DivisibleBy5Checker {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);

        System.out.print("Enter a number: ");
        int number = input.nextInt();

        if (number % 5 == 0) {
            System.out.println(number + " is divisible by 5.");
        } else {
            System.out.println(number + " is not divisible by 5.");
        }

        input.close();
    }
}
📤 Output:
Input: 25
Output: 25 is divisible by 5.

Input: 17
Output: 17 is not divisible by 5.

Input: 0
Output: 0 is divisible by 5.

Input: -10
Output: -10 is divisible by 5.

💻 Check if Temperature is Freezing
import java.util.Scanner;

public class CheckIfTemperatureIsFreezing {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        System.out.print("Enter the temperature in Celsius: ");
        double temperatureInCelsius = scanner.nextDouble();

        if (temperatureInCelsius < 0) {
            System.out.println("The temperature is freezing!");
        } else {
            System.out.println("The temperature is not freezing.");
        }

        scanner.close();
    }
}
📤 Output:
Input: -5
Output: Enter the temperature in Celsius: The temperature is freezing!

Input: 25
Output: Enter the temperature in Celsius: The temperature is not freezing.

Input: 0
Output: Enter the temperature in Celsius: The temperature is not freezing.