Question

In: Computer Science

Mobile Business Programming Exercise 1.      Which ones are valid? (Please estimate each one of the following...

Mobile Business Programming Exercise

1.      Which ones are valid? (Please estimate each one of the following statements)

int x y = 3;

string appName = “Girls Crush”;

float RealNumber = 3.11;

String [3] myUsers = {“Eric”, “Steve”, “Linda”};

ArrayList <String> values = ArrayList <String> ( );

int [ ] income = new int [5];

float abc = 3.22

2. Fill out the blanks

________ (a > b)

              {   sum = a+b; }

              _________

                             { sum = 0; }

3. Fill out the blanks

___________ getTotal (int a, int b)

{

              total = a + b;

              ______________ total;

}

4. Fill out the blanks

___________ method1 (String txt1, String txt2)

{

              _____________ comparison;

comparison = txt1.equalTo(txt2);

}

5. What is the final result, given that a = 1, b =2, c =3, and d =5?

a<=d || a>3 || c > d || b < d

6. What is the final result, given that a = 100, b =99, c =93, and d =101?

a<=d && c < 98 && b < d

7. What is the final result of the variable sum, given that a = 100, b =99, c =93, and d =101?

              if (a > d || b < c)

                             {

                                           sum = 100;

}

else

{

              sum = 0;

}

8. Fill out the blanks

___________ method2 (String txt1, String txt2)

{

              _____________ comparison;

comparison = txt1.equalTo(txt2);

if (comparison)

{

              ___________ “The two text messages are the same.”;

}

else

{

              ___________ “The two text messages are different.”;

}

}

Solutions

Expert Solution

1. The valid statements are

float RealNumber = 3.11;

int [ ] income = new int [5];

2.

if (a > b)

              {   sum = a+b; }

else

                             { sum = 0; }

3.

int getTotal (int a, int b)

{

              total = a + b;

return total;

}

4.

void method1 (String txt1, String txt2)

{

boolean comparison;

comparison = txt1.equalTo(txt2);

}

5.

True

6.

True

7.

sum =0

8.

String method2 (String txt1, String txt2)

{

boolean comparison;

comparison = txt1.equalTo(txt2);

if (comparison)

{

return “The two text messages are the same.”;

}

else

{

return “The two text messages are different.”;

}

}

Please let me know in comments if you have trouble understanding any part


Related Solutions

1. Which of the following is a valid alternative hypothesis for a one-sided hypothesis test about...
1. Which of the following is a valid alternative hypothesis for a one-sided hypothesis test about a population proportion p? p = 0.6 p > 0.3 p < 0 p ≠ 0.7 2. Which of the following statements about a confidence interval is NOT true? A confidence interval of size α indicates that there is a probability of α that the parameter of interest falls inside the interval. A confidence interval is generally constructed by taking a point estimate plus...
1. Which of the following is a valid alternative hypothesis for a one-sided hypothesis test about...
1. Which of the following is a valid alternative hypothesis for a one-sided hypothesis test about a population proportion p? a p = 0.6 b p > 0.3 c p < 0 d p ≠ 0.7 2. Which of the following statements about a confidence interval is NOT true? a A confidence interval of size α indicates that there is a probability of α that the parameter of interest falls inside the interval. b A confidence interval is generally constructed...
Conditions for instruments to be valid include all of the following except: (A) each one of...
Conditions for instruments to be valid include all of the following except: (A) each one of the instrumental variables must be normally distributed. (B) at least one of the instruments must enter the population regression of ?? on the ??s and the ??s. (C) perfect multicollinearity between the predicted endogenous variables and the exogenous variables must be ruled out. (D) each instrument must be uncorrelated with the error term
1.Which of the following is not a requirement of a valid contract in the context of...
1.Which of the following is not a requirement of a valid contract in the context of revenue recognition? a. In writing b. Commercial substance c. Terms for payments d. Enforceable rights and obligations 2.Which of the following does not identify a good or service as "distinct"? a. The customer can benefit from the good or service on its own. b. The entity regularly sells the good or service separately. c. The customer can benefit from the good or service together...
a) Given the following information, please estimate the modified durations of the two bonds. Which one...
a) Given the following information, please estimate the modified durations of the two bonds. Which one is riskier? (The coupon payment is made seminally. Par value is $1,000.) Time to maturity (years) Coupon Interest rate A. 20 8% 4% B. 30 10% 5% b) If a bank expects the interest rate will rise, it should issue Bond A, given everything else equal. Do you agree? Why?
Please use any of the methods to prove whether each of the following arguments is valid...
Please use any of the methods to prove whether each of the following arguments is valid or invalid. For each problem, please identify the method that you have decided to employ and make sure to show your work. 1. It is obvious that nuclear energy is needed. Nuclear energy is needed if and only if solar energy cannot be harnessed. And it is also true both that solar energy can be harnessed only if funds to do so are available,...
Which of the following is a valid C statement? Explain what each valid statement does. For invalid statements, explain the problem.
  Which of the following is a valid C statement? Explain what each valid statement does. For invalid statements, explain the problem.  a. int items [5];  b. int items [];  c. int items = {3, 7,2 };  d. int items [] = {3, 7, 2};  e. int items [3] = {3, 7,2};  
Exercise (a) Use Euler's method with each of the following step sizes to estimate the value...
Exercise (a) Use Euler's method with each of the following step sizes to estimate the value of y(1.6), where y is the solution of the initial-value problem y' = y, y(0) = 6. (i)    h = 1.6 (ii)    h = 0.8 (iii)    h = 0.4 Exercise (b) We know that the exact solution of the initial-value problem in part (a) is y = 6ex. Draw, as accurately as you can, the graph of y = 6ex, 0 ≤ x ≤ 1.6, together with...
Which of the following are valid limitation of the central limit theorem? Select one or more...
Which of the following are valid limitation of the central limit theorem? Select one or more answers: 1) The random variables must have finite variance 2) The random variables must have finite mean 3) The random variables under sample average must be normal 4)The random variables must be under sample average 5) The random variables under sample average must be i.i.d
1. Please list one pro and one con for each of the following theories. Please complete...
1. Please list one pro and one con for each of the following theories. Please complete answers with at least 3 sentences for each pro and for each con. So, each theory would have a total of at least 6 sentences. a. psychoanalytic theory b. behaviorism c. cognitive theory d. sociocultural theory **You may use reliable, trustworthy resources and APA referencing should be implemented. Please help. If possible need by tommorrow.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT