Skip to main content

Posts

Showing posts with the label Class 12th Chapter :- 7

ads1

JAVA PROGRAM || Write a JAVA program to enter marks of five subjects and calculate total, average and percentage.

                                                                                            JAVA PROGRAM   Write a Java program to enter marks of five subjects and calculate total, average and percentage.   (Hint)  Total = s1+s2+s3+s4+s5 Average = total/5 percentage = (total/500)*100 Static :-  class TAP {     public static void main(String args[])     {         double english=50.0,Maths=65.5,SocialScience=72.5,Science=49.0,Computer=48.5,total,average,percentage;         total=english+Maths+SocialScience + Science + Computer;         average = total/5;         percentage = (total/500)*100;         System.out.println("The total marks is :-"+total);         System.out.println("The average  is :-"+average);         System.out.println("The percentage is :-"+percentage);                  } }   Output :-      Dynamic :-  import java.util.*; class TAP {     public static void main(String args[])     {         Scanner in = new Scanner(System.in);         System.ou

Java Program || Write a Java program to enter temperature in Celsius and convert it into Fahrenheit.

                                                                                            JAVA Program       Write a Java program to enter temperature in Celsius and convert it into Fahrenheit. (Hint) fahrenheit = (celsius * 9 / 5) + 32.   Static :-  class fahreheit {     public static void main(String args[])     {         double celsius = 100 ,fahreheit;         fahreheit = (celsius * 9 / 5) + 32;         System.out.println("The fahreheit is :- "+fahreheit);       } } Output :-       Dynamic :- import java.util.*; class fahreheit {     public static void main(String args[])     {         Scanner in = new Scanner(System.in);         System.out.println("Enter the temperature in celsius");         Double cel = in.nextDouble();         double fah = (cel * 9/5)+32;         System.out.println("The Temperature in Fahreheit is :- "+fah);     } } Output :-       

Java Program || Write a Java program to enter length and breadth of a rectangle and find its area.||BCA Sem- 4

     Java Program Static Program :-  class arectangle {     public static void main(String args[])     {         int length = 10,width=20,area;         area = length * width;         System.out.println("The area of rectangle is :-"+area);     } }   Output :-  '   Dynamic :- import java.util.*; class arectangle {     public static void main(String args[])     {         Scanner in = new Scanner(System.in);         System.out.println("Enter the length :- ");         int length = in.nextInt();         System.out.println("Enter the Width :- ");         int width = in.nextInt();         int area = length * width;         System.out.println("The area of Rectangle is :- "+area);        } }   Output :-         

Java Program || Write a Java program to enter length and breadth of a rectangle and find its perimeter.

          JAVA Program                                Static   Write a Java program to enter length and breadth of a rectangle and find its perimeter. class prectangle { public static void main(String args[]) { int length=10,Width=5; int perimeter = 2*(length + Width); System.out.println("The perimeter of rectangle is :- "+perimeter); } } Output :-  Dynamic  import java.util.*; class prectangle { public static void main(String args[]) { Scanner in = new Scanner(System.in); System.out.println("Enter the Length"); int len = in.nextInt(); System.out.println("Enter the Width"); int Width = in.nextInt(); int perimeter = 2*(len + Width); System.out.println("The perimeter of a rectangle is :-" +perimeter); } } Output :- 

Java Program || Write a Java program to enter two numbers and perform all arithmetic operations.

JAVA Program  Static Write a Java program to enter two numbers and perform all arithmetic operations.  Sol  :-  class arithmetic  { public static void main(String args[]) { int a=10,b=20; int add = a+b; int sub = a-b; int mul = a*b; int div = a/b; int mod = a%b; System.out.println("The sum of two number is :-"+add); System.out.println("The sub of two number is :-"+sub); System.out.println("The mul of two number is :-"+mul); System.out.println("The div of two number is :-"+div); System.out.println("The mod of two number is :-"+mod); } } Output :-  Dynamic import java.util.*; class arithmetic  { public static void main(String args[]) { Scanner in = new Scanner(System.in); System.out.println("Enter the first number :- "); int a = in.nextInt(); System.out.println("Enter the Second number :- "); int b = in.nextInt(); int add = a+b; int sub = a-b; int mul =

Java Programming||Write a Java Program to enter two numbers and find their sum.

                                                           JAVA Program                            Static Program  :- 1. Write a Java Program to enter two numbers and find their sum. class sum { public static void main(String args[]) { int a=10; int b=20; int c = a+b; System.out.println("The Sum of two number is :- "+c); } } Output :-  Dynamic  :-  import java.util.*; class sum { public static void main(String args[]) { Scanner in = new Scanner(System.in); System.out.println("Enter the first number :- "); int a=in.nextInt(); System.out.println("Enter the Second number :- "); int b=in.nextInt(); int c = a+b; System.out.println("The sum of two number is :- "+c); } } Output :- 

Java Programming || Write a Java program to Print Hello World. || BCA Sem-4

  JAVA Programming   1. Write a Java program to Print Hello World.  class helloworld { public static void main(String args[]) { System.out.println("Hello World"); } } Output :-  Explain    To create a Java Program ,  First , We have to create a Class, and assign the Name for your java program. Second , We have to write "public static void main(String args[])"   Public :- Public is an Access modifier, If we use public access specifier. It will be easy access the method . If we make the main() method public makes it globally available. Static :- Static is a keyword , Which is when associated with a method , it is a class related method. If we make main method Static ,JVM can invoke it without instantiating the class. Void :- Void is a keyword, basically void means Nothing . It  used to specify that a method doesn’t return anything. Main :- It is a java main method.  It’s not a keyword.  It is basically a identifier that JVM look for  as the starting point

ads2