Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Somebody know how to summarize the error's names? Look at each of the descriptions below and identify the type of programming error . Note that

Somebody know how to summarize the error's names?

Look at each of the descriptions below and identify the type of programming error. Note that more than one of these descriptions may be caused by the same type of programming error.

2 points: You calculate the average of a list of grades with the expression:

average = sum / size; // assume average is double and sum & size are ints

However, average is always a whole number because sum and size are both integers.

What kind of error is this?

2 points: You forget to put an ending double quote in a System.out.println() statement:

System.out.println("Hello there! );

What kind of error is this?

2 points: You write a loop to that counts down to zero but sometimes it runs forever:

int number = input.nextInt();

int sum = 0;

System.out.println("Countdown to zero!");

while (number != 0)

{

System.out.print(number + " ");

sum += number;

number--;

}

System.out.println();

System.out.println("The sum of the numbers is: " + sum);

What will cause the loop to run forever? What kind of error is this?

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Internals A Deep Dive Into How Distributed Data Systems Work

Authors: Alex Petrov

1st Edition

1492040347, 978-1492040347

More Books

Students also viewed these Databases questions

Question

Describe Table Structures in RDMSs.

Answered: 1 week ago