For the questions below use the following variable declarati

For the questions below, use the following variable declarations. As a reminder, strictly larger or smaller than x means that x is not included, and strictly between x and y means that the value is between x and y but does not include x and y: int index, length, width; Boolean longer; string str; Write while condition for a loop that runs as long as index is strictly less than the length of str and the character at position index in String str is not an \"!\". while Write a while condition for a loop that runs as long as the length of name is the same as the length of str, longer is false, and length plus width is strictly greater than the value of index. while Given the following declarations, determine the type and value of each of the expressions listed below. A sample for how you should answer these questions is given below. String myString = \"CSE 1223\"; double costPerBox = 2.0; int numBoxes = 8, boxesPerCrate = 3; boolean foo = true, bar = flase; numBoxes + 3 int, 11 myString.indexOf (\"E\") foo && (numBoxes

Solution

4-while(index<str.length() && str.charAt(index)!=\'!\')
5-while(name.length()==str.length() && longer==false && (length+width)>value[index])
6-false because foo condition is true but the second condition is false.
7-22.0 because when int is multiplied with floating point number then it get gets converted into floating point number.
8-False because the length is 8 and the condition is less then so it is false.
9-2 as the E is at third position and we start with 0 so it will be 2.
10-S as the index start at 0 so character at index 1 is S.
11-2 as the value of numboxes is 11 and boxesPerCrate value is 3 so 11%3 is 2.
12-SE because index starts from 0 so at pos 1 it is S and at pos 2 it is E we will not count at pos 3 because the second parameter is counted 1 less then the given value so we will count 1-2 only.

 For the questions below, use the following variable declarations. As a reminder, strictly larger or smaller than x means that x is not included, and strictly b

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site