A Java program to ask the users number of days and then it will convert into years, weeks, and days using Java programming language.
I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details. If you want to advertise on my website kindly contact me also in my email address also. Thank you.
My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.
My mobile number here in the Philippines is 09173084360.Please subscribe to my channel https://www.youtube.com/channel/UCOs-lpOoIeJoh6gpJthPoGg
Thank you very much for your support.
Program Listing
days.java
import java.util.Scanner;
public class days {
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
char ch;
do {
System.out.println();
System.out.print("\tDays Into Years, Weeks, and Days in Java ");
System.out.println("\n");
System.out.print("\tHow many days? ");
int days = input.nextInt();
int years=0;
int weeks=0;
/* Conversion of days in to years, weeks and days */
years = (days / 365);
weeks = (days % 365) / 7;
days = days - ((years * 365) + (weeks));
System.out.println("\n");
System.out.println("\t" + years + " Year, " + weeks + " Weeks, and " + days+ " Days\n");
System.out.print("\n");
System.out.print("\tDo you want to continue (Type y or n) : ");
ch = input.next().charAt(0);
} while (ch == 'Y'|| ch == 'y');
System.out.println();
System.out.print("\t THANK YOU FOR USING THIS PROGRAM");
System.out.println("\n\n");
input.close();
}
}