i am having problem with this. i have google and search but i cant seem to figure it out
/** The date June 10, 1960, is special because when we write it in the following format, the month times the day equals the year: 6/ 10/ 60 Write a program that asks the user to enter a month ( in numeric form), a day, and a two-digit year. The program should then determine whether the month times the day is equal to the year. If so, it should display a message saying the date is magic. Otherwise, it should display a message saying the date is not magic. */ import javax.swing.JOptionPane; public class Year { public static void main(String[] args) { int month; int day; int year; month = Integer.parseInt(JOptionPane.showInputDialog( "Enter a month in numeric form" )); day = Integer.parseInt(JOptionPane.showInputDialog( "Enter a day in numeric form" )); year = Integer.parseInt(JOptionPane.showInputDialog( "Enter a year in numeric form (2 digits only)")); int goodYear = month * day * year; int magic = goodYear; if ( (goodYear) == (magic) ) { JOptionPane.showMessageDialog(null, " This date is magic " ); } if ( (goodYear)(magic)) { JOptionPane.showMessageDialog(null, " This date is not magic"); } } }
the problem is in the first part of the code as a comment.
i am having problems with this part below =
int goodYear = month * day * year; int magic = goodYear; if ( (goodYear) == (magic) ) { JOptionPane.showMessageDialog(null, " This date is magic " ); } if ( (goodYear)!(magic)) { JOptionPane.showMessageDialog(null, " This date is not magic"); } } }
on the second if i am trying to say that if good year doesn't equal magic that it should display the message below but idk how to do it. or if i am even doing the equation right.
anny suggestions.