Problems 9-35 odd numbers only(9,11,13,15 …35) public statie void main (Suringtl
ID: 3604794 • Letter: P
Question
Problems 9-35 odd numbers only(9,11,13,15 …35)
public statie void main (Suringtl arg) count 1: sumcount + pPRIMS x25.67 newNum count ONS2i sum + count sum x = x + sum+ COUNT Systen.out.printIn(" count “ + count + ", sum s" +sum+ PRINE Prime) 26. What action must be taken, before a variable can be used in a program 27. Explain why the class String need not be explhcily impoted in a 28. Write equivalent compound statements for the following, if possiblo program using an import statement a, x=2*x; c. sum=sum+num; e. y=y/ (x + 5) ; 29. Write the following compound statements as equivalet simple statements x+= 5-2; by 2x+5-2 x-= z + y-t; sum += num; 30. Suppose a, b, and e are int variables and a-5 and b- 6. What value is assigned to each variable atter each statement executes? If a variable is undefined at a particular statement, report UND (undetined) 3 a= (b++) + 3; c= 2 * a (++b); b= 2 * (++e) - (a++); ai. Suppose a, b, and sum are int variables and e is a double variable Whar value is assigned to each variable after each statement executes? Suppove a 3,b 5, and c 14.1.Explanation / Answer
27)
All classes in java.lang package are implicitly imported.This is a feature of the Java language.
As String class is in java.lang package you need to import it explicitly.
29)
x = x + 5 - z;
y = y * (2 * x + 5 - z);
w = w + 2 * z + 4;
x = x - z + y - t;
sum = sum + num;
x = x/(y-2);
31)
sum = a + b + (int) c ; // 3 + 5 + 14 => 22
c /= a; // c = c/a => c = 14.1/3 = > 4.7
b += (int)c - a; // b = b+c-a => 5 + 4 - 3 => 6
a*=2*b+(int)c; // a = a * 2 * b + c => 3*2*6 + 4 => 40
33)
id = 100*num + SECRET; // 100*34 + 17 => 3417
mysteryNum = num*PRIME_NUM - 3 * SECRET => 340*11 - 3*17 => 3740 - 51 => 3689
Output would be:
Name : Miller
Id: 3417
Mystery number: 3689
35)
The program requires two integers and a string.
the order :: int, string, int
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.