0% found this document useful (0 votes)
92 views5 pages

Tugas Pemrograman Berorientasi Objek

This document discusses converting an expedition program from C++ to Java. It provides the Java code for the converted expedition program. The program asks the user to input the weight of goods, destination, and whether express delivery is needed. It then calculates and displays the itemized costs and total cost based on the user inputs.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
92 views5 pages

Tugas Pemrograman Berorientasi Objek

This document discusses converting an expedition program from C++ to Java. It provides the Java code for the converted expedition program. The program asks the user to input the weight of goods, destination, and whether express delivery is needed. It then calculates and displays the itemized costs and total cost based on the user inputs.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

TUGAS PEMROGRAMAN BERORIENTASI OBJEK

“Mengubah Program Ekspedisi dari C++ ke Java”

Nama : Gusti Brantyo Norman


NIM : 64.17.005

UNIVERSITAS TRISAKTI
FAKULTAS TEKNOLOGI INDUSTRI
PROGRAM STUDI TEKNIK INFORMATIKA
CODE C++.
CODE JAVA.
import java.util.Scanner;

public class EkspedisiGusti{


static void Banner() {
System.out.println("
====================================================================");
System.out.println("| |");
System.out.println("| NORMAN OSCORP |");
System.out.println("| JASA PENGIRIMAN BARANG NO.1 SE INDONESIA
|");
System.out.println("| FLASH SENDING METHOD PERTAMA DI
INDONESIA |");
System.out.println("|
====================================================================|");
}
public static void main (String[] args)
{
Scanner input = new Scanner (System.in);
int Berat, BBerat, Bpengiriman, Biaya, BEks, Subtotal, ppn, Total;
Berat = BBerat = Bpengiriman = Biaya = BEks = Subtotal = ppn = Total = 0;
char Tujuan, Eks;
String Layanan;
final int PPN=10;
boolean pilihan;

Banner();
System.out.println();
do {
System.out.println("Masukan Berat Barang (RP100000/KG) : ");
if (input.hasNextInt () ) {
Berat = input.nextInt();
pilihan = true;
}else {
System.out.println("Input salah, Silahkan Masukkan Berat Barang");
pilihan = false;
input.next();
}
} while (!(pilihan));
BBerat = Berat * 100000;
System.out.println();
System.out.println("Pilihan Tujuan Expedisi : ");
System.out.println(" A. Dalam Kota (RP15000)");
System.out.println(" B. Luar Kota (RP30000)");
System.out.println(" C. Luar Pulau (RP50000)");
do {
System.out.println("Masukan Tujuan : ");
Tujuan = input.next().charAt(0);
switch (Tujuan) {
case 'A' : Bpengiriman=15000;
break;
case 'B' : Bpengiriman=30000;
break;
case 'C' : Bpengiriman=50000;
break;
default: System.out.println("SALAH INPUT. INPUT HARUS A/B/C.");
}
}while (Tujuan!= 'A' &&Tujuan!= 'B' &&Tujuan!= 'C');
System.out.println();
Biaya = BBerat+Bpengiriman;
do {
System.out.println("Layanan Ekspres (Y/N) ?");
Eks = input.next().charAt(0);
switch(Eks) {
case 'Y' : BEks = Biaya/10;
Layanan = "Ekspres";
break;
case 'N' : BEks = 0;
Layanan = "Reguler";
break;
default : System.out.println("SALAH INPUT!!!. INPUT HARUS Y/N");
}
} while (Eks !='Y'&&Eks !='N');
Subtotal = Biaya + BEks;
ppn = Subtotal*PPN/100;
Total = Subtotal+ppn;
System.out.println("");
System.out.println("");
System.out.println(" ---------------------Rincian Pembiayaan-----------------");
System.out.println("| 1. Biaya Berat Barang | RP"+BBerat+" |");
System.out.println("| 2. Tujuan | RP"+Bpengiriman+" |");
System.out.println("| 3. "+"Layanan"+" | RP"+BEks+" |");
System.out.println("| 4. Subtotal | RP"+Subtotal+" |");
System.out.println("| PPN(10%) | RP"+ppn+" |");
System.out.println("|____________________________|
___________________________|");
System.out.println("| TOTAL | RP"+Total+" |");
System.out.println(" -----------------------Terima Kasih---------------------");
}
}

OUPUT JAVA.

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