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

5. What is the result (or evaluation value) of the following expressions? 7 + 1.

ID: 3751084 • Letter: 5

Question

5. What is the result (or evaluation value) of the following expressions?
7 + 1.0 ____________________________________________
7% 4 ____________________________________________
(int) 2.3 ____________________________________________
(String) 7 ____________________________________________
(double) "23" ____________________________________________
(double) 4 ____________________________________________
"u"+2+"b" ____________________________________________
24
33.33
ha

6. What Java expression would you write to compute the following?
The sum of 4 and 8.1 ____________________________________________
7 cubed ____________________________________________
The value of a double e,
converted to an int ____________________________________________
59.99 (1 + 13.5%) ____________________________________________
20,000 (1 + 3.5%) 2 ____________________________________________
The price of a gallon of
milk ($8.99) after 10% off ____________________________________________
7. Write the following 2 Programs with Expressions and submit the source code.
a. (KeyboardInput.java) Write statements to put inside the main method that
answer each of the following questions.
i. Create an int variable to store the number 7. Create a double to the same
value as the int, converted to a double.
ii. Create a Scanner variable to read numbers from the keyboard. Read an
int from the keyboard, and store it in a variable. Read a String from the
keyboard, and store it in a variable. Print both variables to the screen.
iii. Read in two ints from the keyboard, and print the sum to the screen.
b. (TipCalculation.java) Develop a program to read in two numbers (i.e., one is the
amount of restaurant bill and the other is the percentage of the tip) via
keyboard.120 stands for $120.00 and 15 stands for 15% of tip. Then, the program
will display the amount of tip.

Explanation / Answer

Please Note: I have answered the First Question as per the Chegg Guidelines. Please Re-Post for getting answers on the remaining questions.

Q5.

Answer)

7 + 1.0 - 8.0

7% 4 - 3

(int) 2.3 - 2

(String) 7 – error as, int cannot be converted to String. (String) “7” is valid.

(double) "23" - (double)"23" - error: incompatible types: String cannot be converted to double

(double) 4 - 4.0

"u"+2+"b" - u2b

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