Sie sind auf Seite 1von 5

/*

* 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 uasFuad;

import java.util.Scanner;

/**

* @author Muhammad Fuad Ardiono

* email : fuadardiono16@gmail.com

*/

public class uasFuad {

public static void main(String[] args){

//home obj data

int home_type[] = new int[100];

String home_size[] = new String[100];

int home_ground_size[] = new int[100];

int home_price[] = new int[100];

int ground_price_per_meter = 1300000;

//make obj mock home


for(int i=0; i < 3; i++){

if(i == 0){

home_type[i] = 36;

home_size[i] = "8 X 12";

home_ground_size[i] = 96;

home_price[i] = 0;

if(i == 1){

home_type[i] = 45;

home_size[i] = "10 X 15";

home_ground_size[i] = 150;

home_price[i] = 0;

if(i == 2){

home_type[i] = 56;

home_size[i] = "10 X 20";

home_ground_size[i] = 200;

home_price[i] = 0;

//user data

String name;
int cart_length;

int selected_house_index[] = new int[100];

int discount = 0;

int discount_percentage = 0;

int total_price = 0;

int total_should_paid = 0;

int iteration;

//input user name

System.out.println("Input nama pembeli rumah = ");

name = new Scanner(System.in).nextLine();

//input how much home they buy

System.out.println("Input banyaknya rumah yang dibeli = ");

cart_length = new Scanner(System.in).nextInt();

for(int i = 0; i < cart_length; i++){

for(int x = 0; x < 3; x++){

System.out.println(x+1+". Type " + home_type[x] +", ukuran " + home_size[x] + ", luas tanah "
+home_ground_size[x]);

System.out.println("Input nomor tipe rumah yang dipilih = ");

selected_house_index[i] = new Scanner(System.in).nextInt() - 1;


}

for(int z = 0; z < cart_length;z++){

System.out.println("selected house index " + selected_house_index[z]);

int price = home_ground_size[selected_house_index[z]] * ground_price_per_meter;

home_price[selected_house_index[z]] = price;

total_price += price;

if(total_price > 200000000){

discount_percentage = 2;

discount = discount_percentage * total_price / 100;

total_should_paid = total_price - discount;

//print to screen

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

System.out.println("NO | Nama | Type | Ukuran | Luas Tanah | Harga|");

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

for(int i =0; i < cart_length; i++){

System.out.println(i+1+" |"+name+" | "+home_type[selected_house_index[i]] +

" | "+ home_size[selected_house_index[i]] +


" | " + home_ground_size[selected_house_index[i]] +

" | " + home_price[selected_house_index[i]] );

System.out.println("Total harga tanah " + total_price);

System.out.println("Diskon " + discount_percentage + "%");

System.out.println("Total Harga Diskon " + discount);

System.out.println("Total Harga Jual " + total_should_paid);

Das könnte Ihnen auch gefallen