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 44 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
Great answer, keep it coming :)


vickyvicksss

  • Member
  • Posts: 351
Reply 3 on: Yesterday
Excellent

 

Did you know?

In most climates, 8 to 10 glasses of water per day is recommended for adults. The best indicator for adequate fluid intake is frequent, clear urination.

Did you know?

If you could remove all of your skin, it would weigh up to 5 pounds.

Did you know?

Oxytocin is recommended only for pregnancies that have a medical reason for inducing labor (such as eclampsia) and is not recommended for elective procedures or for making the birthing process more convenient.

Did you know?

Automated pill dispensing systems have alarms to alert patients when the correct dosing time has arrived. Most systems work with many varieties of medications, so patients who are taking a variety of drugs can still be in control of their dose regimen.

Did you know?

Recent studies have shown that the number of medication errors increases in relation to the number of orders that are verified per pharmacist, per work shift.

For a complete list of videos, visit our video library