Introduction to Computer Science
(Question 1)import java.util.Scanner;public class testingquestion1 {      public static void main(String[] args)    {        Scanner temp = new Scanner (System.in);        int employeenumber;        double retailprice, commission;        char code;        System.out.println(“Enter employeenumber:”);        employeenumber = temp.nextInt();        System.out.println(“Enter the retailprice of an item:”);                retailprice = temp.nextDouble();                System.out.println(“Enter the price of code:”);                code = temp.next().charAt(0);                if (code==A || code==a)                {                    commission = retailprice * 0.06;                    System.out.printf(“the commission is:$%.2f

“,commission);                }                else if (code==B || code==b)                {                    commission = retailprice * 0.08;                    System.out.printf(“commission is:$%.2f

“,commission);                }                else if (code ==C || code ==c)
{                    commission = retailprice * 0.10;                      System.out.printf(“commission is:$%.2f
“,commission);                }                else                {                    System.out.println(“Invalid code”);                }    }}Screenshot(output) for question 1[pic 1]Explanation: For question one it is hard to figure out how to code properly because it is hard to figure how the flower bracket works on Java script compared to MATLAB. Firstly i made an mistake on running too many time to make the program execute, so i manage to figure out i have to close all the running test to RUN the question 1 output. secondly mistake i made is about the flower bracket. once a RED colour underline i cant execute the program i have to figure out when to open or close the flower brackets, Example: IF Open flower bracket hit “Enter” for display  commission = retailprice * 0.06; and  display commission (System.out.printf(“the commission is:$%.2f

“,commission);) and a close bracket is auto typed by java programming. as for question compared to the other 2 question there is a challenging part where i have to figure how to put the Input, double and char code.

Get Your Essay

Cite this page

Char Code And Running Test. (July 7, 2021). Retrieved from https://www.freeessays.education/char-code-and-running-test-essay/