Write a program callednbspcheckpassfailnbspwhich read the


Business Computer Languages

Q1. Identify and correct the error(s) in each of the following:

a) if (1 <= x <= 10)

System.out.println(x);

b) if (x = 1)

y++;

else if (x = 2)

y = y + 2;

c) final double CM_PER_INCH = 2.54;

CM_PER_INCH = 2.55;

Q2. What are the values of the following expressions? In each line, assume that

1. What are the values of the following expressions?  In each line assume that

double  X = 2.5,  Y = -1.5;
int  M = 18,  N = 4;
String  S = "Hello",  T = "World";

i)  X + N * Y - ( X + N ) * Y

ii) M / N + M % N

iii) 5 * X - N / 5

iv) S + T

v)  S + N

vi) ( 1 - ( 1 - ( 1 - ( 1 - N ))))

Q3. Write a program called CheckPassFail which read the mark from user and prints "PASS" if the mark is more than or equal to 60; or prints "FAIL" otherwise.

Solution Preview :

Prepared by a verified Expert
Basic Computer Science: Write a program callednbspcheckpassfailnbspwhich read the
Reference No:- TGS01290563

Now Priced at $30 (50% Discount)

Recommended (91%)

Rated (4.3/5)