我在标题中说了这一切,但我主要需要最后一部分的帮助,我无法正确添加它,它在 system.out.printf 中将年双和日显示为正常数字
import javax.swing.*;
public class lab
{
public static void main(String []args)
{
int day=0;
String month=JOptionPane.showInputDialog(null,"what month is it").substring(0,3);
if (month=="jan")
{
day=31;
}
if (month=="feb")
{
day=28;
}
if(month=="mar")
{
day=31;
}
if(month=="apr")
{
day=30;
}
if(month=="may")
{
day=31;
}
if(month=="jun")
{
day=30;
}
if(month=="jul")
{
day=31;
}
if(month=="aug")
{
day=31;
}
if(month=="sep")
{
day=30;
}
if(month=="oct")
{
day=31;
}
if(month=="nov")
{
day=30;
}
if(month=="dec")
{
day=31;
}
String yearString=JOptionPane.showInputDialog("what year is it");
double yeardouble=Double.parseDouble(yearString);
if(yeardouble % 4==0)
{
yeardouble=1;
}
else
yeardouble=0;
double answer = yeardouble + day;
System.out.printf( "theres "+ day + " days in"+ answer );
}
}