Can anyone help me with a simple java programm in linux?

i just started learning how to write java code in high school and we had an assignment which required us to write a program that would calculate the amount of kilometers u traveled into miles and vis-versa but we had to give the user a chance to pick which one they had to do and our teacher told us to give them the option using 1 to calculate from kilometers to miles and 2 to calculate miles to kilometers .....
and i got confused so please help

Encephalopathic wrote:
First figure out an algorithm: how would you solve this problem just using pencil and paper. Once you know your equations and steps to take, then translate to Java. Why not give it a try first? You can't break your computer by doing this. Then come back with your code if you are still stuck.
Good luck.galaxyboy25,
This is very good advice. Getting into the habit of working out problems on paper/whiteboard first will save you many a headache later on. I'm relatively new to programming as well (only about 2 years professional experience) but this technique has helped me immensely in my work. In my mind, writing code is easy--figuring out what to write is where the real challenge is.
One other thing. In addition to sketching your problem on paper, it always helps to break a problem into very small, simple, and easily solvable pieces. Then put them together. In doing this you will find that not only will this make your task of problem solving much easier but you also end up writing cleaner and more flexible code.
-Thok

Similar Messages

Maybe you are looking for

  • Web hosting on home computer not responding (sometimes)

    Using iWeb I published my personal website to my home computer, an iMac with i3 processor. Sometimes it works fine, but other times the website fails to open' because the server where this page is located isn't responding,'  I figure this is probably

  • Ipod dont work

    my ipod mini dont work by that i meen it will not turn on i tride to restart it but that dosnt work also to connect to the cop but it dosnt react help me i need it as soon as posibol

  • Simultaneous E71 Bluetooth handsfree and Headphon...

    I have Bluetooth handsfree (factory) built into my Car Audio that is non-A2DP. So to listen to Audio on the E71 I need to connect through Headphone to the Car Stereo system. When I do this , Bluetooth Handsfree malfunctions. The Audio (that Im listen

  • Battert health.

    My mbp is at 86 cycles and a health of 46% is this good or bad? what can/should i do about it. I've have the mac book pro for just over a year. any ideas?

  • Recoloring a halftone pattern in Illustrator

    Hello, I have a question regarding changing the color of a halftone pattern created in Illustrator. Here is what I do step by step: 1) fill the expanded text with a black and white gradient 2) apply Effects>Pixelate>Color Halftone 3) expand the halft