0% found this document useful (0 votes)
41 views

Latih 8 Nama: Oggy Riza Erlangga NIM: A22.2018.02682: Membuat Konversi Suhu Celcius, Fahrenheit, Reamur, Dan Kelvin

This document contains a Java program that allows a user to convert between Celsius, Fahrenheit, Reamur, and Kelvin temperature scales. The program uses a menu driven interface to select which conversion to perform, then prompts the user to input a temperature and outputs the equivalent values in the other scales. The conversions are performed using standard formulas for changing between the different scales.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views

Latih 8 Nama: Oggy Riza Erlangga NIM: A22.2018.02682: Membuat Konversi Suhu Celcius, Fahrenheit, Reamur, Dan Kelvin

This document contains a Java program that allows a user to convert between Celsius, Fahrenheit, Reamur, and Kelvin temperature scales. The program uses a menu driven interface to select which conversion to perform, then prompts the user to input a temperature and outputs the equivalent values in the other scales. The conversions are performed using standard formulas for changing between the different scales.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

LATIH 8

NAMA : OGGY RIZA ERLANGGA

NIM : A22.2018.02682

SOAL

Membuat Konversi Suhu Celcius, Fahrenheit, Reamur, dan Kelvin.


FLOW CHART

Double : Celcius, Fahrenheit, Reamur, Kelvin

Pilihan Konversi
Suhu

1. Celcius : 2. Fahrenheit : 3. Reamur : 4. Kelvin : 5. Exit


R = (4/5)*C C = 5/9*(F-32) C = (5/4)*R C = k-273
K = C+273 R = 4/9*(F-32) K = (5/4)*R+273 R = 4/5*(K-273)
F = (9/5)*C+32 K = 5/9*(F-32)+273 F = (9/4)*R+32 F = 9/5*(K-273)+32

Selesai
import java.io.*;

public class Latih_8 {

public static void main(String[] args) throws Exception {

BufferedReader baca = new BufferedReader(new

InputStreamReader(System.in));

do {

double c,r,f,k;

System.out.println("==================================");

System.out.println("=========Menu Kalkulator==========");

System.out.println("==================================");

System.out.println("1. Hitung Celcius");

System.out.println("2. Hitung Reamur");

System.out.println("3. Hitung Fahrenheit");

System.out.println("4. Kelvin");

System.out.println("5. Keluar (Exit)");

System.out.print("Pilih (1-5) : ");

int nopil = Integer.parseInt(baca.readLine());

switch(nopil) {

case 1 :

System.out.print("Masukkan Suhu Celcius : ");

c = Double.parseDouble(baca.readLine());

f=(c*9)/5+32;

r=0.8*c;

k= c+273;

//cetak hasil

System.out.println("Fahrenheit \t= "+f);

System.out.println("Reamur \t\t= "+r);

System.out.println("Kelvin \t\t= "+k);


System.out.println("");

break;

case 2 :

System.out.print("Masukkan Suhu Reamur : ");

r = Double.parseDouble(baca.readLine());

f=((2.25)*r)+32;

c=1.25*r;

k=1.25*r+273;

//cetak hasil

System.out.println("Fahrenheit \t= "+f);

System.out.println("Celcius \t= "+c);

System.out.println("Kelvin \t\t= "+k);

System.out.println("");

break;

case 3 :

System.out.print("Masukkan Suhu Fahrenheit : ");

f= Double.parseDouble(baca.readLine());

c= (double)5/9*(f-32);

r= (double)4/9*(f-32);

k= (double)5/9*(f-32)+273;

//cetak hasil

System.out.println("Celcius \t= "+c);

System.out.println("Reamur \t\t= "+r);

System.out.println("Kelvin \t\t= "+k);

System.out.println("");

break;

case 4 :

System.out.print("Masukkan Suhu kelvin : ");

k= Double.parseDouble(baca.readLine());
f= 2.25*(k-273)+32;

r= 0.8*(k-273);

c= k-273;

//cetak hasil

System.out.println("Fahrenheit \t= "+f);

System.out.println("Reamur \t\t= "+r);

System.out.println("Celcius \t\t= "+c);

System.out.println("");

break;

case 5 :

System.exit(0);

break;

} while (true);

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy