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
Loops - While

💻 Unit Converter Using Switch
import java.util.Scanner;

public class UnitConverterUsingSwitch {

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

        System.out.println("Select conversion type:");
        System.out.println("1. Inches to Centimeters");
        System.out.println("2. Kilograms to Pounds");
        System.out.println("3. Celsius to Fahrenheit");
        System.out.print("Enter your choice (1-3): ");

        int choice = scanner.nextInt();

        switch (choice) {
            case 1:
                System.out.print("Enter inches: ");
                double inches = scanner.nextDouble();
                double centimeters = inches * 2.54;
                System.out.println(inches + " inches is equal to " + centimeters + " centimeters");
                break;
            case 2:
                System.out.print("Enter kilograms: ");
                double kilograms = scanner.nextDouble();
                double pounds = kilograms * 2.20462;
                System.out.println(kilograms + " kilograms is equal to " + pounds + " pounds");
                break;
            case 3:
                System.out.print("Enter Celsius: ");
                double celsius = scanner.nextDouble();
                double fahrenheit = (celsius * 9 / 5) + 32;
                System.out.println(celsius + " Celsius is equal to " + fahrenheit + " Fahrenheit");
                break;
            default:
                System.out.println("Invalid choice. Please enter a number between 1 and 3.");
        }

        scanner.close();
    }
}
📤 Output:
Select conversion type:
1. Inches to Centimeters
2. Kilograms to Pounds
3. Celsius to Fahrenheit
Enter your choice (1-3): Input: 1
Enter inches: Input: 10
10.0 inches is equal to 25.4 centimeters

Select conversion type:
1. Inches to Centimeters
2. Kilograms to Pounds
3. Celsius to Fahrenheit
Enter your choice (1-3): Input: 2
Enter kilograms: Input: 50
50.0 kilograms is equal to 110.231 pounds

Select conversion type:
1. Inches to Centimeters
2. Kilograms to Pounds
3. Celsius to Fahrenheit
Enter your choice (1-3): Input: 3
Enter Celsius: Input: 25
25.0 Celsius is equal to 77.0 Fahrenheit

Select conversion type:
1. Inches to Centimeters
2. Kilograms to Pounds
3. Celsius to Fahrenheit
Enter your choice (1-3): Input: 4
Invalid choice. Please enter a number between 1 and 3.

💻 Season Identification from Month
import java.util.Scanner;

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

        System.out.print("Enter the month (1-12): ");
        int monthNumber = scanner.nextInt();

        String season;

        switch (monthNumber) {
            case 12:
            case 1:
            case 2:
                season = "Winter";
                break;
            case 3:
            case 4:
            case 5:
                season = "Spring";
                break;
            case 6:
            case 7:
            case 8:
                season = "Summer";
                break;
            case 9:
            case 10:
            case 11:
                season = "Autumn/Fall";
                break;
            default:
                season = "Invalid month";
        }

        System.out.println("The season is: " + season);
        scanner.close();
    }
}
📤 Output:
Input: 1
Output: The season is: Winter

Input: 6
Output: The season is: Summer

Input: 9
Output: The season is: Autumn/Fall

Input: 13
Output: The season is: Invalid month

💻 Grade Calculator Using Switch
import java.util.Scanner;

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

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

        char grade;

        switch (marks / 10) {
            case 10:
            case 9:
                grade = 'A';
                break;
            case 8:
                grade = 'B';
                break;
            case 7:
                grade = 'C';
                break;
            case 6:
                grade = 'D';
                break;
            default:
                grade = 'F';
                break;
        }

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

        scanner.close();
    }
}
📤 Output:
Input: 95
Output: Your grade is: A

Input: 82
Output: Your grade is: B

Input: 75
Output: Your grade is: C

Input: 61
Output: Your grade is: D

Input: 50
Output: Your grade is: F

💻 Menu-Driven Program for Shapes
import java.util.Scanner;

public class ShapeMenu {

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

        int choice;

        do {
            System.out.println("Shape Menu:");
            System.out.println("1. Calculate Area of Circle");
            System.out.println("2. Calculate Area of Square");
            System.out.println("3. Calculate Area of Rectangle");
            System.out.println("4. Exit");
            System.out.print("Enter your choice: ");
            choice = scanner.nextInt();

            switch (choice) {
                case 1:
                    System.out.print("Enter radius of the circle: ");
                    double radius = scanner.nextDouble();
                    double circleArea = Math.PI * radius * radius;
                    System.out.println("Area of circle: " + circleArea);
                    break;
                case 2:
                    System.out.print("Enter side of the square: ");
                    double side = scanner.nextDouble();
                    double squareArea = side * side;
                    System.out.println("Area of square: " + squareArea);
                    break;
                case 3:
                    System.out.print("Enter length of the rectangle: ");
                    double length = scanner.nextDouble();
                    System.out.print("Enter breadth of the rectangle: ");
                    double breadth = scanner.nextDouble();
                    double rectangleArea = length * breadth;
                    System.out.println("Area of rectangle: " + rectangleArea);
                    break;
                case 4:
                    System.out.println("Exiting...");
                    break;
                default:
                    System.out.println("Invalid choice. Please enter a number between 1 and 4.");
            }
        } while (choice != 4);

        scanner.close();
    }
}
📤 Output:
Shape Menu:
1. Calculate Area of Circle
2. Calculate Area of Square
3. Calculate Area of Rectangle
4. Exit
Enter your choice: Input: 1
Enter radius of the circle: Input: 5
Area of circle: 78.53981633974483
Shape Menu:
1. Calculate Area of Circle
2. Calculate Area of Square
3. Calculate Area of Rectangle
4. Exit
Enter your choice: Input: 2
Enter side of the square: Input: 7
Area of square: 49.0
Shape Menu:
1. Calculate Area of Circle
2. Calculate Area of Square
3. Calculate Area of Rectangle
4. Exit
Enter your choice: Input: 3
Enter length of the rectangle: Input: 10
Enter breadth of the rectangle: Input: 5
Area of rectangle: 50.0
Shape Menu:
1. Calculate Area of Circle
2. Calculate Area of Square
3. Calculate Area of Rectangle
4. Exit
Enter your choice: Input: 5
Invalid choice. Please enter a number between 1 and 4.
Shape Menu:
1. Calculate Area of Circle
2. Calculate Area of Square
3. Calculate Area of Rectangle
4. Exit
Enter your choice: Input: 4
Exiting...

💻 Traffic Light Simulator
import java.util.Scanner;

public class TrafficLightSimulator {

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

        System.out.println("Enter the current traffic light colour (red, yellow, green):");
        String lightColour = scanner.nextLine().toLowerCase();

        switch (lightColour) {
            case "red":
                System.out.println("STOP!");
                break;
            case "yellow":
                System.out.println("Get Ready!");
                break;
            case "green":
                System.out.println("GO!");
                break;
            default:
                System.out.println("Invalid colour input.");
        }

        scanner.close();
    }
}
📤 Output:
Input: red
Output: Enter the current traffic light colour (red, yellow, green):
STOP!

Input: Yellow
Output: Enter the current traffic light colour (red, yellow, green):
Get Ready!

Input: green
Output: Enter the current traffic light colour (red, yellow, green):
GO!

Input: blue
Output: Enter the current traffic light colour (red, yellow, green):
Invalid colour input.

💻 Vowel or Consonant Using Switch
import java.util.Scanner;

public class VowelOrConsonantSwitch {

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

        System.out.print("Enter an alphabet: ");
        char alphabet = scanner.next().charAt(0);

        switch (alphabet) {
            case 'a':
            case 'e':
            case 'i':
            case 'o':
            case 'u':
            case 'A':
            case 'E':
            case 'I':
            case 'O':
            case 'U':
                System.out.println(alphabet + " is a vowel");
                break;
            default:
                if ((alphabet >= 'a' && alphabet <= 'z') || (alphabet >= 'A' && alphabet <= 'Z')) {
                    System.out.println(alphabet + " is a consonant");
                } else {
                    System.out.println(alphabet + " is not an alphabet");
                }
        }

        scanner.close();
    }
}
📤 Output:
Input: a
Output: a is a vowel

Input: b
Output: b is a consonant

Input: A
Output: A is a vowel

Input: B
Output: B is a consonant

Input: 1
Output: 1 is not an alphabet

💻 Arithmetic Operations Using Switch
import java.util.Scanner;

public class ArithmeticOperationsSwitch {

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

        System.out.print("Enter first number: ");
        double num1 = scanner.nextDouble();

        System.out.print("Enter second number: ");
        double num2 = scanner.nextDouble();

        System.out.print("Enter an operator (+, -, *, /): ");
        char operator = scanner.next().charAt(0);

        double result;

        switch (operator) {
            case '+':
                result = num1 + num2;
                System.out.println("Result: " + result);
                break;
            case '-':
                result = num1 - num2;
                System.out.println("Result: " + result);
                break;
            case '*':
                result = num1 * num2;
                System.out.println("Result: " + result);
                break;
            case '/':
                if (num2 != 0) {
                    result = num1 / num2;
                    System.out.println("Result: " + result);
                } else {
                    System.out.println("Cannot divide by zero!");
                }
                break;
            default:
                System.out.println("Invalid operator!");
        }

        scanner.close();
    }
}
📤 Output:
Input: 10
Input: 5
Input: +
Output: Result: 15.0

Input: 10
Input: 5
Input: -
Output: Result: 5.0

Input: 10
Input: 5
Input: *
Output: Result: 50.0

Input: 10
Input: 5
Input: /
Output: Result: 2.0

Input: 10
Input: 0
Input: /
Output: Cannot divide by zero!

Input: 10
Input: 5
Input: %
Output: Invalid operator!

💻 Number to Month Name Converter
import java.util.Scanner;

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

        System.out.print("Enter a month number (1-12): ");
        int monthNumber = scanner.nextInt();

        String monthName;

        switch (monthNumber) {
            case 1:
                monthName = "January";
                break;
            case 2:
                monthName = "February";
                break;
            case 3:
                monthName = "March";
                break;
            case 4:
                monthName = "April";
                break;
            case 5:
                monthName = "May";
                break;
            case 6:
                monthName = "June";
                break;
            case 7:
                monthName = "July";
                break;
            case 8:
                monthName = "August";
                break;
            case 9:
                monthName = "September";
                break;
            case 10:
                monthName = "October";
                break;
            case 11:
                monthName = "November";
                break;
            case 12:
                monthName = "December";
                break;
            default:
                monthName = "Invalid Month Number";
        }

        System.out.println("The month is: " + monthName);

        scanner.close();
    }
}
📤 Output:
Input: 1
Output: The month is: January

Input: 7
Output: The month is: July

Input: 12
Output: The month is: December

Input: 0
Output: The month is: Invalid Month Number

Input: 13
Output: The month is: Invalid Month Number

💻 Simple Calculator Using Switch
import java.util.Scanner;

public class SimpleCalculatorSwitch {

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

        System.out.print("Enter first number: ");
        double firstNumber = scanner.nextDouble();

        System.out.print("Enter second number: ");
        double secondNumber = scanner.nextDouble();

        System.out.print("Enter an operator (+, -, *, /): ");
        char operator = scanner.next().charAt(0);

        double result;

        switch (operator) {
            case '+':
                result = firstNumber + secondNumber;
                break;
            case '-':
                result = firstNumber - secondNumber;
                break;
            case '*':
                result = firstNumber * secondNumber;
                break;
            case '/':
                if (secondNumber == 0) {
                    System.out.println("Cannot divide by zero!");
                    scanner.close();
                    return;
                }
                result = firstNumber / secondNumber;
                break;
            default:
                System.out.println("Invalid operator!");
                scanner.close();
                return;
        }

        System.out.println("Result: " + result);
        scanner.close();
    }
}
📤 Output:
Input: 10
Input: 5
Input: +
Output: Result: 15.0

Input: 10
Input: 5
Input: -
Output: Result: 5.0

Input: 10
Input: 5
Input: *
Output: Result: 50.0

Input: 10
Input: 5
Input: /
Output: Result: 2.0

Input: 10
Input: 0
Input: /
Output: Cannot divide by zero!

Input: 10
Input: 5
Input: %
Output: Invalid operator!

💻 Day of the Week Using Switch
import java.util.Scanner;

public class DayOfWeekUsingSwitch {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        System.out.print("Enter a number between 1 and 7: ");
        int dayNumber = scanner.nextInt();

        String dayName;

        switch (dayNumber) {
            case 1:
                dayName = "Monday";
                break;
            case 2:
                dayName = "Tuesday";
                break;
            case 3:
                dayName = "Wednesday";
                break;
            case 4:
                dayName = "Thursday";
                break;
            case 5:
                dayName = "Friday";
                break;
            case 6:
                dayName = "Saturday";
                break;
            case 7:
                dayName = "Sunday";
                break;
            default:
                dayName = "Invalid day number";
        }

        System.out.println("The day is: " + dayName);
        scanner.close();
    }
}
📤 Output:
Input: 1
Output: Enter a number between 1 and 7: The day is: Monday

Input: 4
Output: Enter a number between 1 and 7: The day is: Thursday

Input: 7
Output: Enter a number between 1 and 7: The day is: Sunday

Input: 9
Output: Enter a number between 1 and 7: The day is: Invalid day number

Conditional Statements - Switch Case

💻 Arithmetic Operation Menu
import java.util.Scanner;

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

        System.out.println("Welcome to the Arithmetic Operation Menu!");
        System.out.println("Please select an operation:");
        System.out.println("1. Addition");
        System.out.println("2. Subtraction");
        System.out.println("3. Multiplication");
        System.out.println("4. Division");

        System.out.print("Enter your choice (1-4): ");
        int choice = scanner.nextInt();

        System.out.print("Enter first number: ");
        double num1 = scanner.nextDouble();

        System.out.print("Enter second number: ");
        double num2 = scanner.nextDouble();

        double result;

        if (choice == 1) {
            result = num1 + num2;
            System.out.println("Result of addition: " + result);
        } else if (choice == 2) {
            result = num1 - num2;
            System.out.println("Result of subtraction: " + result);
        } else if (choice == 3) {
            result = num1 * num2;
            System.out.println("Result of multiplication: " + result);
        } else if (choice == 4) {
            if (num2 == 0) {
                System.out.println("Cannot divide by zero!");
            } else {
                result = num1 / num2;
                System.out.println("Result of division: " + result);
            }
        } else {
            System.out.println("Invalid choice. Please enter a number between 1 and 4.");
        }

        scanner.close();
    }
}
📤 Output:
Welcome to the Arithmetic Operation Menu!
Please select an operation:
1. Addition
2. Subtraction
3. Multiplication
4. Division
Enter your choice (1-4): Input: 1
Enter first number: Input: 10
Enter second number: Input: 5
Output: Result of addition: 15.0

💻 BMI Category Calculator
import java.util.Scanner;

public class BmiCategoryCalculator {

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

        System.out.print("Enter your weight in kilograms: ");
        double weight = scanner.nextDouble();

        System.out.print("Enter your height in meters: ");
        double height = scanner.nextDouble();

        double bmi = weight / (height * height);

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

        if (bmi < 18.5) {
            System.out.println("Category: Underweight");
        } else if (bmi < 25) {
            System.out.println("Category: Normal weight");
        } else if (bmi < 30) {
            System.out.println("Category: Overweight");
        } else {
            System.out.println("Category: Obese");
        }

        scanner.close();
    }
}
📤 Output:
Input: 70
Input: 1.75
Output: Your BMI is: 22.857142857142858
Output: Category: Normal weight

Input: 50
Input: 1.60
Output: Your BMI is: 19.531249999999996
Output: Category: Normal weight

Input: 100
Input: 1.80
Output: Your BMI is: 30.864197530864196
Output: Category: Obese

Input: 45
Input: 1.7
Output: Your BMI is: 15.577656675749714
Output: Category: Underweight

Input: 85
Input: 1.7
Output: Your BMI is: 29.411764705882355
Output: Category: Overweight

💻 Find Roots of Quadratic Equation
import java.util.Scanner;

public class QuadraticEquationRoots {

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

        System.out.print("Enter the coefficient a: ");
        double a = scanner.nextDouble();

        System.out.print("Enter the coefficient b: ");
        double b = scanner.nextDouble();

        System.out.print("Enter the coefficient c: ");
        double c = scanner.nextDouble();

        double discriminant = b * b - 4 * a * c;

        if (discriminant > 0) {
            double root1 = (-b + Math.sqrt(discriminant)) / (2 * a);
            double root2 = (-b - Math.sqrt(discriminant)) / (2 * a);
            System.out.println("Root 1 = " + root1);
            System.out.println("Root 2 = " + root2);
        } else if (discriminant == 0) {
            double root = -b / (2 * a);
            System.out.println("Root = " + root);
        } else {
            double realPart = -b / (2 * a);
            double imaginaryPart = Math.sqrt(-discriminant) / (2 * a);
            System.out.println("Root 1 = " + realPart + " + " + imaginaryPart + "i");
            System.out.println("Root 2 = " + realPart + " - " + imaginaryPart + "i");
        }

        scanner.close();
    }
}
📤 Output:
Input: 1
Input: -5
Input: 6
Output: Root 1 = 3.0
Output: Root 2 = 2.0

💻 Check Character Type (Alphabet, Digit, Special)
import java.util.Scanner;

public class CharacterTypeChecker {

    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 a special character.");
        }

        scanner.close();
    }
}
📤 Output:
Input: A
Output: A is an alphabet.
Input: 5
Output: 5 is a digit.
Input: $
Output: $ is a special character.
Input: a
Output: a is an alphabet.

💻 Number to Word Converter (1-10)
import java.util.Scanner;

public class NumberToWordConverter {

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

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

        if (number == 1) {
            System.out.println("One");
        } else if (number == 2) {
            System.out.println("Two");
        } else if (number == 3) {
            System.out.println("Three");
        } else if (number == 4) {
            System.out.println("Four");
        } else if (number == 5) {
            System.out.println("Five");
        } else if (number == 6) {
            System.out.println("Six");
        } else if (number == 7) {
            System.out.println("Seven");
        } else if (number == 8) {
            System.out.println("Eight");
        } else if (number == 9) {
            System.out.println("Nine");
        } else if (number == 10) {
            System.out.println("Ten");
        } else {
            System.out.println("Invalid input. Please enter a number between 1 and 10.");
        }

        scanner.close();
    }
}
📤 Output:
Input: 3
Output: Enter a number between 1 and 10: Three

Input: 11
Output: Enter a number between 1 and 10: Invalid input. Please enter a number between 1 and 10.

Input: 7
Output: Enter a number between 1 and 10: Seven

💻 Day of the Week Based on Number (1-7)
import java.util.Scanner;

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

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

        String dayOfWeek;

        if (dayNumber == 1) {
            dayOfWeek = "Monday";
        } else if (dayNumber == 2) {
            dayOfWeek = "Tuesday";
        } else if (dayNumber == 3) {
            dayOfWeek = "Wednesday";
        } else if (dayNumber == 4) {
            dayOfWeek = "Thursday";
        } else if (dayNumber == 5) {
            dayOfWeek = "Friday";
        } else if (dayNumber == 6) {
            dayOfWeek = "Saturday";
        } else if (dayNumber == 7) {
            dayOfWeek = "Sunday";
        } else {
            dayOfWeek = "Invalid Input! Please enter a number between 1 and 7.";
        }

        System.out.println("Day of the week: " + dayOfWeek);

        scanner.close();
    }
}
📤 Output:
Input: 1
Output: Day of the week: Monday

Input: 4
Output: Day of the week: Thursday

Input: 7
Output: Day of the week: Sunday

Input: 8
Output: Day of the week: Invalid Input! Please enter a number between 1 and 7.

💻 Calculate Electricity Bill Based on Units
import java.util.Scanner;

public class ElectricityBillCalculator {

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

        System.out.print("Enter the number of units consumed: ");
        int unitsConsumed = scanner.nextInt();

        double electricityBill;

        if (unitsConsumed <= 50) {
            electricityBill = unitsConsumed * 3.50;
        } else if (unitsConsumed <= 150) {
            electricityBill = (50 * 3.50) + (unitsConsumed - 50) * 4.00;
        } else if (unitsConsumed <= 250) {
            electricityBill = (50 * 3.50) + (100 * 4.00) + (unitsConsumed - 150) * 5.20;
        } else {
            electricityBill = (50 * 3.50) + (100 * 4.00) + (100 * 5.20) + (unitsConsumed - 250) * 6.50;
        }

        System.out.println("Electricity bill amount: ₹" + electricityBill);

        scanner.close();
    }
}
📤 Output:
Input: 30
Output: Electricity bill amount: ₹105.0

Input: 100
Output: Electricity bill amount: ₹375.0

Input: 200
Output: Electricity bill amount: ₹970.0

Input: 300
Output: Electricity bill amount: ₹1670.0

💻 Check Triangle Type (Equilateral, Isosceles, Scalene)
import java.util.Scanner;

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

        System.out.print("Enter the length of side 1: ");
        int side1 = scanner.nextInt();

        System.out.print("Enter the length of side 2: ");
        int side2 = scanner.nextInt();

        System.out.print("Enter the length of side 3: ");
        int side3 = scanner.nextInt();

        if (side1 == side2 && side2 == side3) {
            System.out.println("The triangle is Equilateral.");
        } else if (side1 == side2 || side1 == side3 || side2 == side3) {
            System.out.println("The triangle is Isosceles.");
        } else {
            System.out.println("The triangle is Scalene.");
        }

        scanner.close();
    }
}
📤 Output:
Input: 5
Input: 5
Input: 5
Output: The triangle is Equilateral.

Input: 5
Input: 5
Input: 7
Output: The triangle is Isosceles.

Input: 3
Input: 4
Input: 5
Output: The triangle is Scalene.