hiya all
i am doing a program here on switch case, have a fair idea on switch case but the lecturer now decides to teach us it
the program goes like this. have to find the retail price, commission and enter the employee id num but i having some problems with the calculation. did i do something wrong, do i have to prompt for the commission it is just the output. here is the code and the print out

int empnum, trans_code, retail_price, commission ;



        System.out.println("Hi what is the employeee number");
        empnum = kbd.nextInt();

        System.out.println("hi what is the commission work for");
        commission = kbd.nextInt();

        System.out.println("hello, what is your transaction code");
        trans_code = kbd.next().charAt(0);

        switch (trans_code){
            case 'S':
                retail_price =  5 / 100;
                commission = retail_price + commission;
                System.out.println("the employee number is " + empnum);
                System.out.println("the retail price is " + retail_price);
                System.out.println("the commission is " + commission);
                break;

            case 'M':
                retail_price = 7 / 100;
                commission = retail_price + commission;
                System.out.println("the employee number is " + empnum);
                System.out.println("the retail price is " + retail_price);
                System.out.println("the commission is "+ commission);
                break;

            case 'L':
                retail_price = 10 / 100;
                commission = retail_price + commission;
                System.out.println("the employee number is " + empnum);
                System.out.println("the retail price is "+ retail_price);
                System.out.println("the commission is " + commission);
                break;

            default:
                System.out.println("you have the incorrect transaction code");
                break;



        }
        here is the output
        Hi what is the employeee number
326
hi what is the commission work for
400
hello, what is your transaction code
L
the employee number is 326
the retail price is 0 (why is dis reading zero)
the commission is 400
BUILD SUCCESSFUL (total time: 14 seconds)

(Play the Jeopary theme)....

"What is an Integer?"

In short, your result is less than 1 so in integers, what will the answer be?

hi rproffitt
i dont understand what u mean

He's right.
Think about it. What is the result of5/100in integer arithmetic?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.