-
NEED HELP
Can anyone help me in doing a program ? A program of a converter using control structures and arrays ( measurements-meters to kilometers , liters to mililiters etc. ) and a Text Twist game . Help me please! Thankkk you very much ! im beginner thats why i dont know !
-
Re: NEED HELP
Sure we'll try to help you, but of course no one here will do it for you. Where are you stuck exactly?
-
Re: NEED HELP
Please post the code you are having problems with and ask some questions about the problems.
Work on one program at a time.
-
Re: NEED HELP
HELLO. THIS IS MY PROGRAM. THERE IS NO ERROR BUT CAN ANYONE IMPROVE IT ? HAHA ! into JFRAME because i dont know how to code it in jframe ? its still not finish .
import java.util.Scanner;
public class UnitConverter {
public static void main(String[] args)
{
double initialAmount;
double convertedAmount;
System.out.println("Welcome to Brian's Unit Converter");
System.out.println();
System.out.println("Which unit would you like to convert from:");
System.out.println("centimeter feet inch kilometer meter mile millimeter yard?");
Scanner kboard = new Scanner(System.in);
String fromUnit = kboard.nextLine();
System.out.println();
System.out.println("Which unit would you like to convert to?");
System.out.println("centimeter feet inch kilometer meter mile millimeter yard?");
String toUnit = kboard.nextLine();
System.out.println();
System.out.println("You are converting from " + fromUnit + " to " + toUnit + "?");
System.out.println("How many " + fromUnit + " would you like to convert to " + toUnit + "?");
initialAmount = kboard.nextDouble();
if(fromUnit.equals("centimeter") && toUnit.equals("feet"))
{
convertedAmount = initialAmount * 0.033;
System.out.println(convertedAmount);
}
}
}
-
Re: NEED HELP
-
Re: NEED HELP
Dude relax. /:)
Also use code tags, then your code is better readable for others. :)
Bigger chance others might see the error more easy.
[*code]
code goes here
[*/code]
Remove the *
-
Re: NEED HELP
You need to learn the rudiments of Swing programming to begin to understand what needs to be done. For this I strongly recommend that you check out the Swing tutorials. Best of luck.
-
Re: NEED HELP
Quote:
how to code it in jframe
There is a lot you need to learn to write a GUI application. Start with the tutorial: Trail: Creating a GUI With JFC/Swing (The Java™ Tutorials)