Skip to main content

Java Projects

How to Make Basic Java programs:




Java is one of the best programming language to make GUI and many other departmental software for making computer handling software . Through java programming you can make games , calculators , ticket Machine and related software because it deals with some wide range of built in functions which every programming language do exist..







Here below is the Code through which you can easily make some basic four programs :


Even or Odd :


import java.util.Scanner;
public class EvenorOdd
{
 public static void main(String Args[])
 {
  int x;
  System.out.println("Enter the number");
  Scanner input = new Scanner(System.in);
  x=input.nextInt();
  
  if(x % 2 ==0)
   System.out.println("The number is even");
  else
   System.out.println("The number is odd");
 }
}



Radius :


import java.util.Scanner;
public class Radius {
 public static void main(String[] args) {
  Scanner scn= new Scanner(System.in);
  float rad;
  System.out.print("Please Enter Radius of a Circle: ");
  rad = scn.nextFloat();
  
  float pi = (float) Math.PI;
  float diam = 2*rad;
  float cir = 2*pi*rad;
  float area = pi*(rad*rad);
  
  System.out.printf("A Circle of Radius %s has: Diameter: %s Circumference: %s Area: %s ", rad, diam, cir, area); 
 }
}



Maximum and Minimum value :
import java.util.Scanner;

public class MaxMin
{
 public static void main(String arg[])
 {
  Scanner cp = new Scanner (System.in);
  
  int inputVal;
  int max = 0;
  int min = 0;

  for(int i=1; i<=5;i++)
  {
   System.out.println(String.format("Enter Value #%s: ", String.valueOf(i)));
   inputVal = cp.nextInt();
   if(i==1)
   {
    min = inputVal;
    max = inputVal;
   }
   if(inputVal > max) {
    max = inputVal;
   }
   if(inputVal < min)
   {
    min = inputVal;
   }
  }
  System.out.println(String.format("Max Value is %s.", max));
  System.out.println(String.format("Min Value is %s.", min));
 }
}


Spacing between digits :
import java.util.Scanner;

public class Spacing{
 
 public static void main(String[] args) {
  Scanner scn= new Scanner(System.in);
  
  int i;
  int maxminAllowed= 5;
  
  System.out.print("Enter 5 Digits: ");
  i = scn.nextInt();
   
  String s = String.valueOf(i);
  int charCount = s.length();
  
  if(charCount == maxminAllowed)
  {
   char[] charss  = s.toCharArray();
   System.out.printf("%s \t %s \t %s \t %s \t %s",charss[0],charss[1],charss[2],charss[3],charss[4]);
  }else if(charCount > maxminAllowed){
   System.out.printf("You can not enter Numbers Greater than %s", maxminAllowed);
   System.out.println("");
   main(args);
  }else {
   System.out.printf("You can not enter Numbers Less than %s", maxminAllowed);
   System.out.println("");
   main(args);
  }
 }
}

    


Keep Sharing !

Comments

Popular posts from this blog

DTN

The word business is for them who use it in a efficient way to make a better way for their earning but now a days we don't consider a business who don't have their online presence because the people prefer online shopping rather then to go out for shopping because it requires time.So, that's why customers who do online shopping are more considerable to make your market better. In the same context   DTN founded to sell a quality authentic jadeite bangles now moving to digital landscape of shopping. Below are the details of their initiative which was initiated in 2004 DTN is found just recently, a merger between DDJADE and DTN . They sell good quality authentic jadeite bangles since 2014. Now, they are expanding it to technology products. Their vision and motto is selling good quality and authentic goods at fractional cost compared to big companies DDJADE was founded in 2014 with the mind set of providing authentic jade bangle, bracelet, silver and...

Graphic designing

Adobe Photoshop: The Best thing in this software is this it is a Collection of built in features and has more editor effect to use in its own way. You can also edit 2D and 3D animation in it and make it easy for Editing you can make Logos , Flyers , header all sort of things you have grip on.. Its has a proper suit for its users. The Adobe Photoshop is the Best app for editing Pictures either they are simple or high definition. Adobe Suit has more features more than we think and assume. The Best Graphic designer is used to from this that he or she will have much work for them they are in finding that SOFTWARE which make them easy to work for many hours. Are you curious to know about more ? https://blog.retouchmypic.com/professional/2017/09/19/5-ways-how-photoshop-changed-the-world/  Do Visit this Blog to know about the Photoshop Hacks  Keep Sharing !

Kashmir

Kashmir The Heaven on Earth  Kashmir is considered one of the part of Paradise on earth because of its beautiful landscape and hilly mountains which makes it different from other northern areas in Pakistan !  Here is the Video Link of some beautiful landscape of Kashmir