This topic contains a solution. Click here to go to the answer

Author Question: Analyze the following code:Code 1:int number = 45;boolean even;if (number % 2 == 0) even = true;else ... (Read 164 times)

crazycityslicker

  • Hero Member
  • *****
  • Posts: 537

Question 1

The following code displays ________.

double temperature = 50;

if (temperature >= 100)
System.out.println("too hot");
else if (temperature <= 40)
System.out.println("too cold");
else
System.out.println("just right");

◦ just right
◦ too hot
◦ too hot too cold just right
◦ too cold

Question 2

Analyze the following code:

Code 1:

int number = 45;
boolean even;

if (number % 2 == 0)
even = true;
else
even = false;

Code 2:

boolean even = (number % 2 == 0);

◦ Both Code 1 and Code 2 are correct, but Code 2 is better.
◦ Code 1 has compile errors.
◦ Code 2 has compile errors.
◦ Both Code 1 and Code 2 have compile errors.


Related Topics

Need homework help now?

Ask unlimited questions for free

Ask a Question
Marked as best answer by crazycityslicker on May 6, 2020

zhanghao

  • Sr. Member
  • ****
  • Posts: 316
Lorsum iprem. Lorsus sur ipci. Lorsem sur iprem. Lorsum sur ipdi, lorsem sur ipci. Lorsum sur iprium, valum sur ipci et, vala sur ipci. Lorsem sur ipci, lorsa sur iprem. Valus sur ipdi. Lorsus sur iprium nunc, valem sur iprium. Valem sur ipdi. Lorsa sur iprium. Lorsum sur iprium. Valem sur ipdi. Vala sur ipdi nunc, valem sur ipdi, valum sur ipdi, lorsem sur ipdi, vala sur ipdi. Valem sur iprem nunc, lorsa sur iprium. Valum sur ipdi et, lorsus sur ipci. Valem sur iprem. Valem sur ipci. Lorsa sur iprium. Lorsem sur ipci, valus sur iprem. Lorsem sur iprem nunc, valus sur iprium.
Answer Preview
Only 25% of students answer this correctly




crazycityslicker

  • Member
  • Posts: 537
Reply 2 on: May 6, 2020
Gracias!


samiel-sayed

  • Member
  • Posts: 337
Reply 3 on: Yesterday
Thanks for the timely response, appreciate it

 

Did you know?

About 60% of newborn infants in the United States are jaundiced; that is, they look yellow. Kernicterus is a form of brain damage caused by excessive jaundice. When babies begin to be affected by excessive jaundice and begin to have brain damage, they become excessively lethargic.

Did you know?

Intradermal injections are somewhat difficult to correctly administer because the skin layers are so thin that it is easy to accidentally punch through to the deeper subcutaneous layer.

Did you know?

Tobacco depletes the body of vitamins A, C, and E, which can result in any of the following: dry hair, dry skin, dry eyes, poor growth, night blindness, abscesses, insomnia, fatigue, reproductive system problems, sinusitis, pneumonia, frequent respiratory problems, skin disorders, weight loss, rickets, osteomalacia, nervousness, muscle spasms, leg cramps, extremity numbness, bone malformations, decayed teeth, difficulty in walking, irritability, restlessness, profuse sweating, increased uric acid (gout), joint damage, damaged red blood cells, destruction of nerves, infertility, miscarriage, and many types of cancer.

Did you know?

Hip fractures are the most serious consequences of osteoporosis. The incidence of hip fractures increases with each decade among patients in their 60s to patients in their 90s for both women and men of all populations. Men and women older than 80 years of age show the highest incidence of hip fractures.

Did you know?

The oldest recorded age was 122. Madame Jeanne Calment was born in France in 1875 and died in 1997. She was a vegetarian and loved olive oil, port wine, and chocolate.

For a complete list of videos, visit our video library