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 56 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
Wow, this really help


amcvicar

  • Member
  • Posts: 341
Reply 3 on: Yesterday
Great answer, keep it coming :)

 

Did you know?

Approximately 70% of expectant mothers report experiencing some symptoms of morning sickness during the first trimester of pregnancy.

Did you know?

In 1844, Charles Goodyear obtained the first patent for a rubber condom.

Did you know?

It is difficult to obtain enough calcium without consuming milk or other dairy foods.

Did you know?

About 3% of all pregnant women will give birth to twins, which is an increase in rate of nearly 60% since the early 1980s.

Did you know?

Approximately one in four people diagnosed with diabetes will develop foot problems. Of these, about one-third will require lower extremity amputation.

For a complete list of videos, visit our video library