What's new

Java Java Need Help

Super Galaxy

Forum Veteran
Joined
Oct 26, 2018
Posts
942
Reaction
537
Points
710
Age
22
Need help po paano po ba program nito Pinapagawa po kasi saamin kong pwede po sana ako makahingi ng program

Write a conversion program focused on meter conversion. (e.g. m to km, m to cm, and so on) Use the table, and program below for your reference. Copy and paste your work in the space provided.
1.PNG
tenor.gif
 

Attachments

Last edited:
implement mo lang yung mga formulas sa metric conversions sa program mo tapus mag declare ka ng number na babasehan (pwede din na input ng user) tapos convert mo lang sa centimeters to meter to km...etc. yun na maigging output mo, pero baka mali pagkaintindi ko kasi di ka nag provide ng further instructions.
 
Use x as yung icoconvert mo. Then yung y yung result. Also gamitan mo ng multiple class kasi may tatlong conversion ka

Java:
class Converter {
public static void main (string[] args) {
double x, y;
Scanner input = new Scanner(System.in);
System.out.println("Enter value: ");
x = input.nextDouble();
}
}

tsaka gamitan mo ng magtatanong muna kung anong conversion yung gagamitin tas direct mo na sa code na yan.
 
Java:
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        double x;

        //cm to mm
        System.out.println("Enter the centimeter");
        x = scanner.nextDouble();
        System.out.println("The conversion to millimeters is:" + (x*10));

        //meter to cm
        System.out.println("Enter the meter");
        x = scanner.nextDouble();
        System.out.println("The conversion to centimeters is:" + (x*100));

        //km to meter
        System.out.println("Enter the kilometer");
        x = scanner.nextDouble();
        System.out.println("The conversion to meters is:" + (x*1000));

        }
    }

Eto TS para simple lang.
 
Last edited:
Napaka simple lang naman nung gagawin may sample naman na eh, Btw wala naman sinabi na need mag input ng value so tingin ko no need muna gumamit ng Scanner. Maliban na lng kung stated sa requirements.
 
Back
Top