State whether each of the following is true or false. If false, explain why.
a. An algorithm is a procedure for solving a problem in terms of the actions to execute and the order in which these actions execute.
b. A set of statements contained within a pair of parentheses is called a block.
c. A selection statement specifies that an action is to be repeated while some condition remains true.
d. A nested control statement appears in the body of another control statement.
e. Java provides the arithmetic compound assignment operators +=, -=, *=, /= and %= for abbreviating assignment expressions.
f. The primitive types (boolean, char, byte, short, int, long, float and double) are portable across only Windows platforms.
g. Specifying the order in which statements (actions) execute in a program is called program control.
h. The unary cast operator (double) creates a temporary integer copy of its operand.
i. Instance variables of type boolean are given the value TRue by default.
j. Pseudocode helps a programmer think out a program before attempting to write it in a programming language.
Write four different Java statements that each add 1 to integer variable x.
State whether each of the following is true or false. Explain why.
It is late at night, and you decide to get a glass of milk before bed. Try to write
pseudocode describing the process of going to the kitchen and getting the milk. Be
very specific and make sure you have all actions in the correct sequence. For example,
remember you must open the refrigerator door before you reach in to retrieve the milk
container. What if there is no glass in the cupboard? Did you check whether the glass
was right side up before you started pouring? Now consider how many small
decisions you make every day, and consider how involved it would be to write a
program to instruct a robot to do the things you do in a day!
State whether each of the following is true or false. If false, explain why.
Write four different Java statements that each add 1 to integer variable x.
Explain four (4) reasons why its necessary to use methods in your Java programs.
Assignment 1
Write a program in Java that returns the maximum for three numbers
Assignment 2
Based on Assignment 1, write an algorithm for your implementation
It is late at night, and you decide to get a glass of milk before bed. Try to write
pseudocode describing the process of going to the kitchen and getting the milk. Be
very specific and make sure you have all actions in the correct sequence. For example,
remember you must open the refrigerator door before you reach in to retrieve the milk
container. What if there is no glass in the cupboard? Did you check whether the glass
was right side up before you started pouring? Now consider how many small
decisions you make every day, and consider how involved it would be to write a
program to instruct a robot to do the things you do in a day!
Draw a flow chart to compute the sum of the series:
𝑓(𝑥) = 1 + 𝑥 + 𝑥
2 + 𝑥
3 + … + 𝑥
𝑛
Provide a Pseudocode to illustrate the assignment of 10 to X if X < Y otherwise
5 is assigned to X.
Flow chart for the sum of the series f(x)=1+x +x^2+x^3+...+x^n