Map

Translate

English French German Spain Italian Dutch

Russian Brazil Japanese Korean Arabic Chinese Simplified
Translate by Google ( UBLO 7 )

visitor

Flag Counter

About Me

PROGRAM SEWA MOBIL PERHARI (JAVA)

Create a Java code to calculate car rent payment.
- gas = 250000
- car = 500000 per day
- TotalPayment???
Display Total Payment using specifiers!
CODE :

package sewamobil;

import java.util.Scanner;

public class rumus {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        double day = 500000;
        double gas = 250000;       
        double d,g, JumlahHariSewaMobil, JumlahBahanBakarGas , TotalPembayaran;
        @SuppressWarnings("resource")
        Scanner input = new Scanner(System.in);
                //input
                System.out.println("Pembayaran sewa Mobil \n");
                System.out.println("Hari Sewa Mobil : ");
                d = input.nextDouble();
                System.out.println("Bahan Bakar Gas :");
                g = input.nextDouble();
               
                //process
                JumlahHariSewaMobil = day * d;
                JumlahBahanBakarGas = gas * g;
                TotalPembayaran = JumlahHariSewaMobil + JumlahBahanBakarGas;
                               
                //output
                System.out.println("\nJumlahHariSewaMobil = " + JumlahHariSewaMobil);
                System.out.println("\nJumlahBahanBakarGas = " + JumlahBahanBakarGas);
                System.out.println("\nTotalPembayaran = " + TotalPembayaran);
    }

}


HASIL :


0 komentar:

Posting Komentar