Tanya Ini koding java. Sheratan gasuka java.

Discussion in 'Komputer dan Gadget' started by Kudryavka, 19 October 2013.

Thread Status:
Not open for further replies.
  1. Kudryavka

    Kudryavka Riajuu-wannabe

    197
    11
    88
    Tax Rate for Personal is as follows:
    LAYER OF INCOMETAX RATE
    Until Rp 50.000.000,-5%
    More Than Rp 50.000.000,- Until Rp 250.000.000,-15%
    More Than Rp 250.000.000,- Until Rp 500.000.000,-25%
    More Than Rp 500.000.000,-30%

    Assignment:

    Create a program to accept input : name and income of the person.
    Tax can be calculated using the table above!
    *Tax will be calculated after income being subtracted with non-tax income (PTKP)

    Criteria that needs to be satisfied:
    · Input : name, income
    · Output : [name] must pay tax : [tax]

    Note : You may use non-tax income : Rp. 24.300.000,-

    soalnya begitu sih.. no, gw ga minta kerjain dari 0 macem bocah.
    Cuman mau tanya ini gw ujung2nya stuck ampe ngitung pajaknya wakakakak
    monggo diperiksa
    Code:
    import java.util.Scanner;
    
    public class IncomeTax {
        public static void main (String[]args) {
                String name;
                Scanner input = new Scanner (System.in);
                System.out.print("Input the name : ");
                name = input.next();
                int income,tax;
                System.out.print("Input the income : ");
                income = input.nextInt();
                    if(income<=0){
                        System.out.println("Income not valid");
                    }
                    else{
                //mechanism
                tax=income*12-24300000;
                    if{(tax<=0 && <50000000);
                        System.out.println("Income can't compute");
                    }
                System.out.println(name+" must pay tax : "+tax);
                }
    
    
    
    
    
    
        }
    }
    yg jelas, ada 6 error kalo di compile.
    Mohon bantuan Flame-kun Dejiko dan Kurumi

    You have income 10.000.000 IDR / month
    first multiply it by 12.

    12 x 10.000.000 = 120.000.000
    and then you minus the annual income with non-tax income 24.300.000

    120.000.000 - 24.300.000 = 95.700.000
    for tax rate it should be like this

    5% * 50.000.000 = A
    15% * 43.700.000 = B

    and finally you plus A and B to get the final answer
     
    Last edited: 19 October 2013
  2. Sheratan

    Sheratan Parental Advisory Staff Member Uploader Donatur Event Winner VN Development Team Masa Latihan

    3.728
    738
    248
    Code:
    tax=income*12-24300000;
    if{(tax<=0 && <50000000);
    System.out.println("Income can't compute");
    }
    Ngaco disitu tuh
     
  3. Kudryavka

    Kudryavka Riajuu-wannabe

    197
    11
    88
    kalo ngga digituin nanti tetep kehitung dong pajaknya
    hasilnya bisa minus2 juga ..
    padahal pajak baru dihitung kalo nyentuh 50jt kan ._.
     
  4. Sheratan

    Sheratan Parental Advisory Staff Member Uploader Donatur Event Winner VN Development Team Masa Latihan

    3.728
    738
    248
    Bukan...

    harusnya

    Code:
    tax=income*12-24300000;
    if(tax<=0 && <50000000) {
    System.out.println("Income can't compute");
    }
    Perhatikan tutup kurung dan ; nya

    Bentar, ini (tax<=0 && <50000000) serius nih?

    Logikanya lo mau antara 0 dan 50 juta kan?
     
  5. Kudryavka

    Kudryavka Riajuu-wannabe

    197
    11
    88
    ud dicoba2, masukin codingnya jadi gini
    Code:
    import java.util.Scanner;
    
    public class IncomeTax {
        public static void main (String[]args) {
                String name;
                Scanner input = new Scanner (System.in);
                System.out.print("Input the name : ");
                name = input.next();
                int income,tax;
                System.out.print("Input the income : ");
                income = input.nextInt();
                    if(income<=0){
                        System.out.println("Income not valid");
                    }
                    else{
    
                        //mechanism
                tax=income*12-24300000;
                if(tax<=0 && <50000000) {
                System.out.println("Income can't compute");
                }
                //final output
                System.out.println(name+" must pay tax : "+tax);
    
    
    
        }
    }
    dapet 3 error :
    IncomeTax.java:19: error: illegal start of type
    if(tax<=0 && <50000000) {
    ^
    IncomeTax.java:19: error: illegal start of expression
    if(tax<=0 && <50000000) {
    ^
    IncomeTax.java:19: error: ')' expected
    if(tax<=0 && <50000000) {
    ^
    3 errors

    Tool completed with exit code 1

    itu mksdnya apa?
     
  6. Sheratan

    Sheratan Parental Advisory Staff Member Uploader Donatur Event Winner VN Development Team Masa Latihan

    3.728
    738
    248
    itu error di perbandingannya.

    Kayaknya lo harus ganti metode perbandingannya deh. Bentar coba gw pikirkan hmm

    0 - 50 juta = 5%
    > 50 juta - 250 juta = 15%
    > 250 juta - 500 juta = 25%
    sisanya 30%

    jika 0 - 50 juta maka blablabla
    else if
    jika > 50 juta - 250 juta maka blablaba
    else if
    jika > 250 juta - 500 juta maka blablabla
    else
    blablabla

    hmm...
     
  7. Sheratan

    Sheratan Parental Advisory Staff Member Uploader Donatur Event Winner VN Development Team Masa Latihan

    3.728
    738
    248
    Bentar. Gw mau tanya.

    kalau gw masukin income 10 juta, harusnya gw bayar berapa?
     
  8. Yatohime

    Yatohime Financial Affairs Chief Staff Member Uploader

    214
    73
    93
    Kurang tutup kurawal buat else nya
     
  9. Kudryavka

    Kudryavka Riajuu-wannabe

    197
    11
    88
    desperate nyoba lagi.
    Code:
    import java.util.Scanner;
    
    public class IncomeTax {
        public static void main (String[]args) {
                String name;
                Scanner input = new Scanner (System.in);
                System.out.print("Input the name : ");
                name = input.next();
                int income,tax;
                System.out.print("Input the income : ");
                income = input.nextInt();
                    if(income<=0){
                        System.out.println("Income not valid");
                    }
                        //mechanism
                tax=income*12-24300000;
                    else if(tax<50000000){
                System.out.println("Income can't compute");
                    }
                else{
                //final output
                System.out.println(name+" must pay tax : "+tax);
                    }
        }
    }
    dapet error yg ga ngerti mksdnya apa
    IncomeTax.java:17: error: 'else' without 'if'
    else if(tax<50000000){
    ^
    1 error

    Tool completed with exit code 1

    kan 10juta dikali 12 dulu terus di kurangin 24300000
    baru nanti dihitung berdasarkan pajaknya itu yg 50jt
     
    Last edited by a moderator: 19 October 2013
  10. Yatohime

    Yatohime Financial Affairs Chief Staff Member Uploader

    214
    73
    93
    Itu ada else tapi ga ada if sebelumnya

    malah 1 line coding yang ga ada hubungannya ama if mestinya dikurung kurawal juga atau else nya ilangin
     
  11. Sheratan

    Sheratan Parental Advisory Staff Member Uploader Donatur Event Winner VN Development Team Masa Latihan

    3.728
    738
    248
    Setahu gw ya, kalau ada kondisi

    if a < 0 = asik
    elsif
    a < 50 = ganteng
    else
    keren

    itu bisa jalan dan logikanya benar, tanpa perlu pakai >= 0 && < 50
     
  12. Yatohime

    Yatohime Financial Affairs Chief Staff Member Uploader

    214
    73
    93
    Parah deh

    Code:
    import java.util.Scanner;
    
    public class IncomeTax {
        public static void main (String[]args) {
                String name;
                Scanner input = new Scanner (System.in);
                System.out.print("Input the name : ");
                name = input.next();
                int income,tax;
                System.out.print("Input the income : ");
                income = input.nextInt();
                    if(income<=0){
                        System.out.println("Income not valid");
                    }
                        //mechanism
                      
                    else if(tax<50000000){              
                System.out.println("Income can't compute");
                    }
                else{
                //final output
               tax=income*12-24300000; 
                System.out.println(name+" must pay tax : "+tax);
                    }
        }
    }
    Ga bakal error ini
     
  13. Sheratan

    Sheratan Parental Advisory Staff Member Uploader Donatur Event Winner VN Development Team Masa Latihan

    3.728
    738
    248
    Oh iya, lo bisa coba pakai case kalau mau lebih ringkas daripada else if
     
  14. Kudryavka

    Kudryavka Riajuu-wannabe

    197
    11
    88
    ud ngira2 pake case gimana. Ngga bisa. Buat make switch case nilainya harus pasti. Gabisa pake lebih dari kurang dari dan otomatis gabisa dipake kalo gw ga salah nangkep dari dosen gw yang bening beut
     
  15. TheWizard

    TheWizard Audiophile

    201
    56
    73
    ini... diapain dong...

    kaga mudeng maksudnya perintah ini
     
  16. Dejiko

    Dejiko 6 years old Staff Member

    2.326
    547
    253
    anggaplah pendapatan kita itu 60jt.
    50jt itu dikali 5%
    10jtnya dikali 15%

    totalnya berapa itu pajak kita

    tapi kalau pendpatan kita cuma 40jt. kan gak sampai 50jt tuh. jadinya cuma,
    40jt x 5%

    hasilnya pajak kita
     
  17. Sheratan

    Sheratan Parental Advisory Staff Member Uploader Donatur Event Winner VN Development Team Masa Latihan

    3.728
    738
    248
    jadi ((10 juta * 12) - 24.300.000) * 5%

    begitu?
     
  18. Kudryavka

    Kudryavka Riajuu-wannabe

    197
    11
    88
    itu ada tingkatannya..
    jadi ngga cuman 5%, tapi ada 15 25 ampe 30%
     
  19. Flame-kun

    Flame-kun 大蛇武錬葬! Staff Member

    529
    257
    148
    Btw vin, lu ngecompile javanya itu pake apa?
     
  20. Yatohime

    Yatohime Financial Affairs Chief Staff Member Uploader

    214
    73
    93
    Keliatannya dia pakai textpad tp gtw lagi ,

    Thread di lock sementara ya

    Kalau butuh tanya2 lagi PM/VM aja :)
     
Thread Status:
Not open for further replies.

Share This Page