I am wanting to calculate the days between the start date of cycle and end date of cycle. the user will input the dates. i want to be able to use that input to calculate how long the cycle last as numberofdays.
the following is my current code and basic idea of how i want it to run. I have seen similar posts but nothing towards using an unknown user date. Any help would be appreciated thank you.
import java.util.Scanner;
import java.util.*;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Scanner;
import javax.swing.JOptionPane;
import javax.swing.*;
import java.awt.*;
import java.time.*;
import java.util.Calendar;
public class project1
{
public static void main (String [] args)
{
int StartDate = 0; //Declaring Number of Toppings
int EndDate = 0 ; //Declaring Charge Per Topping in decimal
Scanner inNumber= new Scanner (System.in); //Crate Scanner for input of number of toppings
Scanner inText = new Scanner(System.in); //Creat Scanner for input of Name of Customers
System.out.println(" Female Calendar Entry System ");
System.out.println( " " ) ;
String CustomersName = " ";
System.out.print( "Please enter your name ==> ") ;
CustomersName = inText.nextLine(); //Inputing Customers Name
System.out.println( " " ) ;
Date thisDate= new Date();
SimpleDateFormat dateForm = new SimpleDateFormat ("dd/MM/Y");
String startDate = dateForm.format(thisDate);
System.out.println(" Todays Date " +(dateForm.format(thisDate)));
System.out.println( " " ) ;
// To take the input
Scanner scanner = new Scanner(System.in);
System.out.println("Enter Cycle start date ");
String date = scanner.next();
SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/Y");
Date date2=null;
System.out.println( " " ) ;
Scanner scanner2 = new Scanner(System.in);
System.out.println("Enter Cycle end date ");
String date3 = scanner.next();
SimpleDateFormat date3Format = new SimpleDateFormat("dd/MM/Y");
Date date4=null;
System.out.println("\n\n--- Female Calender Results ---"); //Recipt for pizza order with name number of topings and overal price
System.out.println( " " ) ;
System.out.println("Client Name: " + CustomersName);
System.out.println("Lenght of cycle:") ; // this should have the number of days the cycle lasted
System.out.println("Aproximently next cycle: " + (" ")); // this should have 28 days end date of cycles
System.out.println(" ");
}
}