Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * 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 konv.suhu;
- import java.util.Scanner;
- class hitungsuhu
- {
- float celkerea (float a)
- {
- return a*4/5;
- }
- float fahkera (float a)
- {
- return (a-32)*4/9;
- }
- }
- /**
- *
- * @author lenovo
- */
- public class KonvSuhu {
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- int pil;
- Scanner input = new Scanner(System.in);
- hitungsuhu s;
- s=new hitungsuhu();
- do {
- System.out.println("Pilihan : ");
- System.out.println("1. celcius ke reamur \n2. fahrenheit ke reamur");
- System.out.println("masukkan pilihan = ");
- pil = input.nextInt();
- switch(pil){
- case 1: System.out.println("input celcius = ");
- float a = input.nextFloat();
- System.out.println(a + " celcius = " +s.celkerea(a) + " reamur");
- break;
- case 2: System.out.println("input fahrenheit = ");
- float b= input.nextFloat();
- System.out.println(b + " fahrenheat = " +s.fahkera(b) + " reamur");
- }
- }while(pil<=2);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement