Logo video2dn
  • Сохранить видео с ютуба
  • Категории
    • Музыка
    • Кино и Анимация
    • Автомобили
    • Животные
    • Спорт
    • Путешествия
    • Игры
    • Люди и Блоги
    • Юмор
    • Развлечения
    • Новости и Политика
    • Howto и Стиль
    • Diy своими руками
    • Образование
    • Наука и Технологии
    • Некоммерческие Организации
  • О сайте

Скачать или смотреть Java Program using Nested Switch to Calculate Area of Circle, Rectangle, &Triangle Full Explanation

  • PROGRAM.. DEVIL
  • 2025-04-24
  • 14
Java Program using Nested Switch to Calculate Area of Circle, Rectangle, &Triangle Full Explanation
  • ok logo

Скачать Java Program using Nested Switch to Calculate Area of Circle, Rectangle, &Triangle Full Explanation бесплатно в качестве 4к (2к / 1080p)

У нас вы можете скачать бесплатно Java Program using Nested Switch to Calculate Area of Circle, Rectangle, &Triangle Full Explanation или посмотреть видео с ютуба в максимальном доступном качестве.

Для скачивания выберите вариант из формы ниже:

  • Информация по загрузке:

Cкачать музыку Java Program using Nested Switch to Calculate Area of Circle, Rectangle, &Triangle Full Explanation бесплатно в формате MP3:

Если иконки загрузки не отобразились, ПОЖАЛУЙСТА, НАЖМИТЕ ЗДЕСЬ или обновите страницу
Если у вас возникли трудности с загрузкой, пожалуйста, свяжитесь с нами по контактам, указанным в нижней части страницы.
Спасибо за использование сервиса video2dn.com

Описание к видео Java Program using Nested Switch to Calculate Area of Circle, Rectangle, &Triangle Full Explanation

Welcome to Program Devil! 😈
In this video, we write a Java program using a nested switch statement to calculate the area of a circle, rectangle, and triangle (equilateral, isosceles, scalene) based on the user's choice. 🧠💻

💡 What You’ll Learn:

Use of switch and nested switch in Java

Taking input using Scanner

Calculating areas of various shapes

Applying formulas for each triangle type

Clean, commented Java code for better understanding:
import java.util.*; // Importing utility package for Scanner

public class nestedswitch {
public static void main(String args[]) {
Scanner in = new Scanner(System.in); // Creating Scanner object to take input

int choice, choice1; // Variables to store user choices
double r, area, b, a, c, s; // Variables for calculation

// Asking user for main shape choice
System.out.println("Enter the choice");
System.out.println("Enter 1 for area of circle");
System.out.println("Enter 2 for area of rectangle");
System.out.println("Enter 3 for area of triangle");
choice = in.nextInt(); // Reading user's shape choice

switch(choice) {
case 1:
// Circle area calculation
System.out.println("Enter the radius of the circle");
r = in.nextDouble();
area = (22.0/7) * r * r; // Area formula: πr² using 22/7 for π
System.out.println("Area of CIRCLE: " + area);
break;

case 2:
// Rectangle area calculation
System.out.println("Enter length and breadth of the rectangle");
r = in.nextDouble(); // Reading length
b = in.nextDouble(); // Reading breadth
area = r * b; // Area formula: length × breadth
System.out.println("Area of RECTANGLE: " + area);
break;

case 3:
// Triangle choice and area calculation using nested switch
System.out.println("Enter the choice for area of the triangle:");
System.out.println("Enter 1 for equilateral triangle");
System.out.println("Enter 2 for isosceles triangle");
System.out.println("Enter 3 for scalene triangle");
choice1 = in.nextInt(); // Reading triangle type

switch (choice1) {
case 1:
// Equilateral triangle area
System.out.println("Enter the side of an equilateral triangle");
a = in.nextInt();
area = (Math.sqrt(3) / 4) * a * a; // Formula: (√3/4) * a²
System.out.println("Area of an EQUILATERAL TRIANGLE: " + area);
break;

case 2:
// Isosceles triangle area
System.out.println("Enter the base of an isosceles triangle");
b = in.nextInt();
System.out.println("Enter the side of an isosceles triangle");
a = in.nextInt();
area = b / 4.0 * Math.sqrt((4 * a * a) - (b * b)); // Derived formula for isosceles triangle
System.out.println("Area of an ISOSCELES TRIANGLE: " + area);
break;

case 3:
// Scalene triangle area using Heron's formula
System.out.println("Enter all three sides of a scalene triangle");
a = in.nextInt();
b = in.nextInt();
c = in.nextInt();
s = (a + b + c) / 2.0; // Semi-perimeter
area = Math.sqrt(s * (s - a) * (s - b) * (s - c)); // Heron’s formula
System.out.println("Area of a SCALENE TRIANGLE: " + area);
break;

default:
// Invalid triangle choice
System.out.println("Wrong Choice");
break;
}
break;

default:
// Invalid shape choice
System.out.println("Enter the correct choice");
}
}
}


👇 Connect with me and stay updated:
📸 Instagram: https://www.instagram.com/program_dev...
📢 Telegram: https://t.me/+iQTEQxvTmq43MGQ1

Don’t forget to LIKE, SHARE, and SUBSCRIBE for more coding content! 🔥

#java program area calculation, #nested switch in java, #wap in java, #java program for area of shapes, #area of circle java, #area of rectangle java, #area of triangle java, #equilateral triangle area java, #isosceles triangle area java, #scalene triangle area java, #java project for beginners, #java coding tutorial, #java nested switch example, #basic java program, #java switch statement, #java beginner project, #programdevil, #learn java programming

Комментарии

Информация по комментариям в разработке

Похожие видео

  • О нас
  • Контакты
  • Отказ от ответственности - Disclaimer
  • Условия использования сайта - TOS
  • Политика конфиденциальности

video2dn Copyright © 2023 - 2025

Контакты для правообладателей [email protected]