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

Author Question: Analyze the following statement:double sum = 0;for (double d = 0; d < 10;) { d += 0.1; sum += sum + d;} (Read 58 times)

burton19126

  • Hero Member
  • *****
  • Posts: 532

Question 1

What is the value in count after the following loop is executed?

int count = 0;
do {
System.out.println("Welcome to Java");
} while (count++ < 9);
System.out.println(count);

◦ 8
◦ 9
◦ 10
◦ 11
◦ 0

Question 2

Analyze the following statement:

double sum = 0;
for (double d = 0; d < 10;) {
d += 0.1;
sum += sum + d;
}

◦ The program runs in an infinite loop because d<10 would always be true.
◦ The program compiles and runs fine.
◦ The program has a compile error because the adjustment is missing in the for loop.
◦ The program has a compile error because the control variable in the for loop cannot be of the double type.


Related Topics

Need homework help now?

Ask unlimited questions for free

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

ecabral0

  • Sr. Member
  • ****
  • Posts: 310
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




burton19126

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


upturnedfurball

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

 

Did you know?

Once thought to have neurofibromatosis, Joseph Merrick (also known as "the elephant man") is now, in retrospect, thought by clinical experts to have had Proteus syndrome. This endocrine disease causes continued and abnormal growth of the bones, muscles, skin, and so on and can become completely debilitating with severe deformities occurring anywhere on the body.

Did you know?

Approximately one in three babies in the United States is now delivered by cesarean section. The number of cesarean sections in the United States has risen 46% since 1996.

Did you know?

Elderly adults are living longer, and causes of death are shifting. At the same time, autopsy rates are at or near their lowest in history.

Did you know?

The cure for trichomoniasis is easy as long as the patient does not drink alcoholic beverages for 24 hours. Just a single dose of medication is needed to rid the body of the disease. However, without proper precautions, an individual may contract the disease repeatedly. In fact, most people develop trichomoniasis again within three months of their last treatment.

Did you know?

In ancient Rome, many of the richer people in the population had lead-induced gout. The reason for this is unclear. Lead poisoning has also been linked to madness.

For a complete list of videos, visit our video library