Skip to main content

Help me with homework (a tiny app) :)

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
No replies
EdikNeznanov
Offline
Joined: 2013-09-24

Hi guys! So i'm studying in school and I asked my teacher to learn me Java/C++ instead of Pascal. As I only one guy who want to learn Java I do everything by myself and she only checks my homework. All pupils do their homework in Pascal and I do it in Java so I can't really ask anyone except here.
So about the app. App req: Olympic games strted from 1986 year and going until now every 4 years. I need to create an app which should say which game (by number ) was in that year ( user enters year) and if there wasn't Olympic games played in this year it should say : There wasn't Olympic games in this year.
So here what I got::

<br />
import java.io.*;<br />
import java.util.*;</p>
<p>public class Script<br />
{<br />
   public static void main(String[] args)<br />
   {<br />
      Scanner in = new Scanner(System.in);<br />
      PrintWriter out = new PrintWriter(System.out);</p>
<p>      System.out.println ("Enter year:");<br />
      int b = in.nextInt();<br />
      if (b<1896) System.out.println("First Olympic games was in 1986!");<br />
      int x = (b - 1892) / 4;<br />
      if (x>0) out.println("Game number: "+x);</p>
<p>      out.flush();<br />
   }<br />
}<br />

So the problem is that I can't make it write that in year x was no Olympic games. If there is no olympic games then x=n.yy (not whole number).
Thanks for helping me ! :)