Java is the most famous language and it is becoming the most papolar programming language. This is famous for its easy to use and Security.
Today I will give you a code to count your age in Days, Minutes, Months and Seconds..
Here is the code and try it your own
Code:
package com.company;
import java.util.Scanner;
public class calculator_java {
public static void main(String[] args) {
long age;
long beat;
Scanner sc = new Scanner(System.in);
System.out.println("In which category you want to get age?");
System.out.println("The Enter age will be counted as year ");
System.out.println("Day:\n Hour:\n Minute:\n Second:");
System.out.println("\nType (1) for day\n Type (2) for Hours\n " +
"Type (3) for Minute\n Type (4) for second ");
int enter = sc.nextInt();
if (enter == 1) {
System.out.println("Enter your age: ");
int day = sc.nextInt();
if (day <= 0) System.out.println("Enter correct Age Please! ");
else {
System.out.println(" your age in Days is:\t ");
age = day * 365;
System.out.println(age);
System.out.println("Your heart beat according to your age in normal condition is : ");
beat = age * 115200;
System.out.println(beat);
}
}
if (enter == 0) {
System.out.println("Enter correct Digit Please!");
}
if (enter == 2) {
System.out.println("Enter your age: ");
int hours = sc.nextInt();
if (hours <= 0) System.out.println("Enter correct Age please! ");
else {
System.out.println("Your age in Hours is : ");
age = hours * 365 * 24;
System.out.println(age);
System.out.println("Your heart beat according to your age in normal condition is : ");
beat =4800*age;
System.out.println(beat);
}
}
if (enter == 3) {
System.out.println("Enter your age : ");
int min = sc.nextInt();
if (min <= 0)
System.out.println("Enter correct Age Please! : ");
else {
System.out.println("your age in minutes is: ");
age = min * 1440 * 365;
System.out.println(age);
System.out.println("Your heart beat according to your age in normal condition is : ");
beat = age * 80;
System.out.println(beat);
}
}
if (enter == 4) {
System.out.println("enter your age: ");
int sec = sc.nextInt();
if (sec <= 0) System.out.println("Enter correct Age Please! :");
else {
System.out.println("your age in seconds is:");
age = sec * 365 * 86400;
System.out.println(age);
System.out.println("Your heart beat according to your age in normal condition: ");
beat = age*2;
System.out.println(beat);
}
}
System.out.println("Developed by\n(M.Hamza)");
}
}
0 Comments
If you want any type of script please massege me on
hamzaw4hla@gmail.com