Posts

Showing posts from August, 2021
Image
 package javaapplication16; import java.util.Scanner; public class JavaApplication16 {     public static void main(String[] args) {        int month;         System.out.println("Enter the number of mounth from 1 to 12");        Scanner months=new Scanner(System.in);        month=months.nextInt();                 switch (month)         {             case 1:                 System.out.println("jan");                 break;                   case 2:                 System.out.println("feb");                 break;                     case 3:     ...
Image
      package javaapplication14; public class JavaApplication14 {     public static void main(String[] args) {   if (1>2)         {         System.out.println("1 is greater than 2");         }         else         {         System.out.println("2 is greater than 1");         }              }      }
Image
 //Q 3 Write a Java program that reads a number and prints "zero" if the number is zero. Otherwise,         //print "positive" or "negative". And if the number is greater than 100 print the number is to large positive               System.out.println("Enter a  number");      Scanner input =new Scanner(System.in);      int num=input.nextInt();      if (num<1)      {          System.out.println("The Number is Too Small");      }      else if(num>100)      {          System.out.println("The Number is Too large positive ");      }      else      {          System.out.println("The Number is positive");      }          }           }
Image
  package javaapplication14; import java.util.Scanner; public class Javaapplication14 {     public static void main(String[] args) {double n1,n2,n3;                  System.out.println("Enter number 1");         Scanner n11 =new Scanner(System.in);         n1=n11.nextDouble();         System.out.println("Enter number 2");        Scanner n12 =new Scanner(System.in);         n2=n12.nextDouble();         System.out.println("Enter number 3");         Scanner n13 =new Scanner(System.in);         n3=n13.nextDouble();         double result = n2*n2 - 4*(n1*n3);         if(result>0)         {             double r1=(-n2+Math.pow (result,0.5))/2*n1;            ...
Image
 package javaapplication14; public class JavaApplication14 {     public static void main(String[] args) { //Write a Java program to get a number from the user and print whether it is positive or negative.         int a = 10;         if (a>0)                 {                System.out.println("The number is positive");                    }         else         {         System.out.println("The number is negative");         }              }      }
Image
 package javaapplication8; import java.util.Scanner; class method {          public class JavaApplication8 {     public static void main(String[] args){         int name;          Scanner In =new Scanner(System.in);         System.out.println("Enter your name digits =");         name= In.nextInt();                          swich (name)                 {                     case 1:         System.out.println("  ****   *    *    *  *        *        *****  *****");         System.out.println(" *       *    *   *    *      * *...
Image
 package javaapplication9; import java.util.Scanner; public class JavaApplication9 {     public static void main(String[] args) {         int NA;         Scanner In =new Scanner(System.in);         System.out.println("Enter your accademy Name Digits =");         NA= In.nextInt();         int xz = 9;         if(xz == NA)         {             System.out.println("*     *    * *    *       *      *        **     **   ****    *****   ****   ***** ");             System.out.println("* *   *   *   *    *     *      * *         **  **  ...
Image
  package javaapplication10; import java.util.Scanner; public class Javaapplication10 {     public static void main(String[] args) {  int name;  System.out.println("plz Enter your name digits");  Scanner hi = new Scanner(System.in);  name = hi.nextInt();    switch (name)          {      case 1:         System.out.println("  ****    ");         System.out.println(" *       ");         System.out.println(" *       ");         System.out.println("  ***    ");         System.out.println("     *   ");         System.out.println("     *   ");         System.out.println( " ****   ");          break;       ...