Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

12. Write a declaration statement for each of the following variables using the

ID: 3594969 • Letter: 1

Question

12. Write a declaration statement for each of the following variables using the variable type and variable name that would be best for each value. Assign values if directed.

(Android Developer Bootcamp Book, Chapter 3 Questions)

.

a. The population of the state of Alaska

b. Your weekly pay using the most common type for this type number

c. The smallest data type you can use for your age

d. Assign the first initial of your first name

e. Assign the present minimum wage using the most common type for this type of number

f. Assign the name of the city in which you live

g. The answer to a true/false question

13. Name two numeric data types that can contain a decimal point.

14. What is the solution to each of the following arithmetic expressions?

a. 3 + 4 * 2 + 6

b. 16 / 2 * 4 - 3

c. 40 - (6 + 2) / 2

d. 3 + 68 % 9

Explanation / Answer

a. population of usa is 3.2 * 10^8. It can fit in int datatype


int pop;

b. Pay can contain fractional values.

double weeklyPay

c. Smallest data type is byte

byte age

d. We only need to store a single character

char firstInitial;

e. wage can contain decimal points, So,

double minWage;

f. String is best datatype for storing names

String cityName;

g. boolean datatype supports true or falseboolean

boolean isCorrect

13. Float and Double are 2 datatypes in java that supports decimal point

14.

a. 3 + 4*2 + 6
= 3 + 8 + 6 = 17

b. 16/2*4-3
= 8*4-3 = 29

c. 40-(8)/2 = 40-4 = 36

d. 3+68%9 = 3+5 = 8

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote