Skip to content
Amhussami edited this page Nov 21, 2018 · 1 revision

Welcome to the HelloWorld wiki!

Java Umrechnner

by Abdulmoti Alhosami

`/*

  • To change this license header, choose License Headers in Project Properties.
  • To change this template file, choose Tools | Templates
  • and open the template in the editor. */ package javaapplication1;

import java.util.Scanner;

/** *

  • @author Amhussami */ public class JavaApplication1 {

    /**

    • @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here System.out.println("bitte auswahlen: 1-für lang ** 2- für masse **3-für voulumen 4-für geschw"); Scanner sc=new Scanner(System.in); int option=sc.nextInt();

      switch (option){ case 1: System.out.println("1 for km to m , 2 for mile to km , 3 for cm to inch ,4 for inch to cm "); int b=sc.nextInt(); switch (b){ case 1: System.out.println("bitte wert eingeben");double wert=sc.nextDouble(); System.out.printf( wert0.621+" Mile" ); break; case 2: System.out.println("bitte wert eingeben");double wert2=sc.nextDouble(); System.out.printf( wert21.60934+" KM" ); break; case 3:System.out.println("bitte wert eingeben");double wert3=sc.nextDouble(); System.out.printf(wert30.393701+" Zoll"); break; case 4 : System.out.println("bitte wert eingeben");double wert4=sc.nextDouble(); System.out.printf(wert42.54+" cm"); break;

       } // the end of Mass
       break;
       case 2: System.out.println("1 for kg to pounds , 2 for pounds to kg ,  3 for Grammto oz ,4 for oz to Gramm   ");
       int c=sc.nextInt();
       switch (c){
           case 1 : System.out.println("bitte wert eingeben");double wert=sc.nextDouble();
           System.out.printf(  wert*2.20462+" pounds" ); break;
           case 2: System.out.println("bitte wert eingeben");double wert2=sc.nextDouble();
           System.out.printf(  wert2*0.453592+" kg" ); break;
           case 3:System.out.println("bitte wert eingeben");double wert3=sc.nextDouble();
           System.out.printf(wert3*0.035274+" oz"); break;
           case 4 : System.out.println("bitte wert eingeben");double wert4=sc.nextDouble();
           System.out.printf(wert4*28.3495+" Gramm");   break;
      

      } break; case 3: System.out.println("1 for Liter to m^3 , 2 for m^^3 to liter , 3 for l to Gallon ,4 for Gallon to L "); int d=sc.nextInt(); switch (d){ case 1 : System.out.println("bitte wert eingeben");double wert=sc.nextDouble(); System.out.printf( wert2.20462+" m^3" ); break; case 2: System.out.println("bitte wert eingeben");double wert2=sc.nextDouble(); System.out.printf( wert20.453592+" liter" ); break; case 3:System.out.println("bitte wert eingeben");double wert3=sc.nextDouble(); System.out.printf(wert30.264172+" Gallon"); break; case 4 : System.out.println("bitte wert eingeben");double wert4=sc.nextDouble(); System.out.printf(wert43.78541+" Liter"); break;

    } break; case 4: System.out.println("1 for km/h to miles/h , 2 miles/h to km/h , 3 km/h to m/s ,4 for m/s to km/h "); int e=sc.nextInt(); switch (e){ case 1 : System.out.println("bitte wert eingeben");double wert=sc.nextDouble(); System.out.printf( wert0.621371+" mph" ); break; case 2: System.out.println("bitte wert eingeben");double wert2=sc.nextDouble(); System.out.printf( wert21.60934+" kmh" ); break; case 3:System.out.println("bitte wert eingeben");double wert3=sc.nextDouble(); System.out.printf(wert30.277778+" M/S"); break; case 4 : System.out.println("bitte wert eingeben");double wert4=sc.nextDouble(); System.out.printf(wert43.6+" kmh"); break; } } } } `

Clone this wiki locally