Eclipse IDE

by | Apr 10, 2022 | Computer Science

Assignment Requirements

The program for this assignment will consist of three sections, each headed

by the three-line comment below:

//*********************************************************

//****Assignment 3 Section X

//*********************************************************

(where X stands for the portion of the assignment to follow)

Section 1: 

1. Enter the comment with the section title.

1. Using a while loop structure, create a loop based on a counter variable which will cycle through 10 iterations.

1. With each iteration of the loop, request a grade from the user and add it to a running total.

1. After the loop has ended, print to the console the overall total and the class average.

1. Define any appropriate variables you need.

Section 2: 

1. Enter the comment with the section title.

1. Create a set of two nested for loops.

1. The outer loop will iterate from 5 to 1, decrementing by 1 with each consecutive iteration. Use the letter ‘k’ for its counter variable name.

1. The inner loop will iterate from 0 to 10 by 2. Use the letter ‘i’ for its counter variable. Hint: Use the += operator to increment by 2. 

1. With each iteration of the inner loop, print both loop index values such as

k = 5, i = 0

Section 3:

1. Enter the comment with the section title.

1. Use a while loop to process user entered numbers.

1. Inform the user to enter a positive number to be added to the total or -1 to end.

1. With each iteration of the loop, add the user entered value to a running total.

1. End the loop when the user enters -1 and do not add that value to the running total.

1. Once the loop ends, print the total of the numbers entered, (excluding the sentinel value -1.)

1. Define the appropriate variables needed.

POSSIBLE EXPECTED OUTPUT

Enter grade: 88

Enter grade: 78

Enter grade: 98

Enter grade: 99

Enter grade: 67

Enter grade: 78

Enter grade: 79

Enter grade: 100

Enter grade: 87

Enter grade: 56

Total of all 10 grades is 830

Class average is 83

k = 5, i = 0

k = 5, i = 2

k = 5, i = 4

k = 5, i = 6

k = 5, i = 8

k = 5, i = 10

k = 4, i = 0

k = 4, i = 2

k = 4, i = 4

k = 4, i = 6

k = 4, i = 8

k = 4, i = 10

k = 3, i = 0

k = 3, i = 2

k = 3, i = 4

k = 3, i = 6

k = 3, i = 8

k = 3, i = 10

k = 2, i = 0

k = 2, i = 2

k = 2, i = 4

k = 2, i = 6

k = 2, i = 8

k = 2, i = 10

k = 1, i = 0

k = 1, i = 2

k = 1, i = 4

k = 1, i = 6

k = 1, i = 8

k = 1, i = 10

Enter a positive number to be added to the total or -1 to end. 3

Enter a positive number to be added to the total or -1 to end. 4

Enter a positive number to be added to the total or -1 to end. 5

Enter a positive number to be added to the total or -1 to end. 8

Enter a positive number to be added to the total or -1 to end. -1

The sum of all numbers entered is 20

We help you get better grades, improve your productivity and get more fun out of college!!

Homework Answers Online

Free title page

Free reference page

Free formatting

Unlimited revisions

WhatsApp chat

How it works – it’s easy

i

Place your Order

Submit your requirements through our small easy order form. Be sure to include and attach any relevant materials.

Make a payment

The total price of your order is based on the type of assignment, number of pages, academic level and deadline.

i

Order process

We assign the assignment to the most qualified tutor. When the tutor completes the assignment, it is transferred to one of our professional editors to ensure that the assignment meets all of your requirements.

Once complete, we’ll send your assignment via the email provided on the order form and you’ll be able to download it. 

Achieve academic success with the best online tutors