Posted: September 16th, 2017

Can the following conversions involving casting be allowed? If so, find the converted result:

EX 1:
Part a: Can the following conversions involving casting be allowed? If so, find the converted result:
char c = ‘A’;
i = (int)c;
float f = 1000.34f;
int i = (int)f;
double d = 1000.34;
int i = (int)d;
int i = 97;
char c = (char)i;
Part b: Show the output of the following statements:
System.out.println("1" + 1);
System.out.println('1' + 1);
System.out.println("1" + 1 + 1);
System.out.println("1" + (1 + 1));
System.out.println('1' + 1 + 1);
Part c: Show the following output:
float f = 12.5F;
int i = (int)f;
System.out.println("f is " + f);
System.out.println("i is " + i);
Programming Exercises
EX 2:
(Payroll) Write a program that reads the following information and prints a payroll statement:
1)      Employee’s name (e.g., Smith).
2)      Number of hours worked in a week (e.g., 10).
3)      Hourly pay rate (e.g., 6.75).
4)      Federal tax withholding rate (e.g., 20%).
5)      State tax withholding rate (e.g., 9%).
6)      Use console input and output. A sample run of the console input and output is shown in Figure below:
Reading Exercise
Read chapter 2. Propose 6 – 12 keywords. Compose 2 – 3 sentences to describe each chapter in a concise, comprehensive, and unambiguous manner.

Expert paper writers are just a few clicks away

Place an order in 3 easy steps. Takes less than 5 mins.

Calculate the price of your order

You will get a personal manager and a discount.
We'll send you the first draft for approval by at
Total price:
$0.00
Live Chat+1-631-333-0101EmailWhatsApp