Purdue University Create a Loop Based on A Counter Variable Computer Science Task

Description

Using the language in which you have chosen to focus: C#, Java, web development languages (PHP and JavaScript), please complete the following assessment: Assessment Requirements The program for this assessment will consist of three sections, each headed by the three-line comment below: //********************************************************* //****Assessment IT213M2 Section X //********************************************************* (where X stands for the portion of the assessment to follow) Section 1: Enter the comment with the section title.Using a while loop structure, create a loop based on a counter variable which will cycle through 10 iterations.With each iteration of the loop, request a grade from the user and add it to a running total.After the loop has ended, print to the console the overall total and the class average.Define any appropriate variables you need. Section 2: Enter the comment with the section title.Create a set of two nested for loops.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.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.With each iteration of the inner loop, print both loop index values such as

k = 5, i = 0 Section 3: Enter the comment with the section title.Use a while loop to process user entered numbers.Inform the user to enter a positive number to be added to the total or -1 to end.With each iteration of the loop, add the user entered value to a running total.End the loop when the user enters -1 and do not add that value to the running total.Once the loop ends, print the total of the numbers entered, (excluding the sentinel value -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 Directions for Submitting Your Assessment The source code file is the file in your project that contains the code you wrote. You will only need to submit the source code file for your program and not the entire project folder or any additional project files. Below are listed the file extensions for the source code file for each language: .cs file for C# .java file for Java .php and.js files for Web Development Naming Your Project and Source Code File:

1 attachmentsSlide 1 of 1attachment_1attachment_1

Unformatted Attachment Preview

Using the language in which you have chosen to focus: C#, Java, web development languages
(PHP and JavaScript), please complete the following assessment:
Assessment Requirements
The program for this assessment will consist of three sections, each headed by the three-line
comment below:
//*********************************************************
//****Assessment IT213M2 Section X
//*********************************************************
(where X stands for the portion of the assessment to follow)
Section 1:
1. Enter the comment with the section title.
2. Using a while loop structure, create a loop based on a counter variable which will cycle
through 10 iterations.
3. With each iteration of the loop, request a grade from the user and add it to a running total.
4. After the loop has ended, print to the console the overall total and the class average.
5. Define any appropriate variables you need.
Section 2:
1. Enter the comment with the section title.
2. Create a set of two nested for loops.
3. 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.
4. 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.
5. 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.
2. Use a while loop to process user entered numbers.
3. Inform the user to enter a positive number to be added to the total or -1 to end.
4. With each iteration of the loop, add the user entered value to a running total.
5. End the loop when the user enters -1 and do not add that value to the running total.
6. Once the loop ends, print the total of the numbers entered, (excluding the sentinel value -1.)
7. 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
Directions for Submitting Your Assessment
The source code file is the file in your project that contains the code you wrote. You will only
need to submit the source code file for your program and not the entire project folder or any
additional project files. Below are listed the file extensions for the source code file for each
language:
.cs file for C#
.java file for Java
.php and.js files for Web Development
Naming Your Project and Source Code File:

Purchase answer to see full
attachment

Tags:
software development

LOOP

counter variable

User generated content is uploaded by users for the purposes of learning and should be used following Studypool’s honor code & terms of service.

Looking for this assignment?

do my essay homework

Reviews, comments, and love from our customers and community

Article Writing

Great service so far. Keep doing what you do, I am really impressed by the work done.

Alexender

Researcher

PowerPoint Presentation

I am speechless…WoW! Thank you so much! Definitely, the writer is talented person. She provided me with an essay a day early before the due date!

Stacy V.

Part-time student

Dissertation & Thesis

This was a very well-written paper. Great work fast. I was in pretty desperate need for help to finish this paper before the due date, which was in nine hours.

M.H.H. Tony

Student

Annotated Bibliography

I love working with this company. You always go above and beyond and exceed my expectations every time. Kate did a WONDERFUL job. I would highly recommend her.

Francisca N.

Student

Book Report / Review

I received my order wayyyyyyy sooner than I expected. Couldn’t ask for more. Very good at communicating & fast at replying. And change & corrections she put in the effort to go back and change it!

Mary J.

Student

Essay (Any Type)

On time, perfect paper. All concerns & matters I had Tom was able to answer them! I will definitely provide him with more orders!

Prof. Kate (Ph.D)

Student

Case Study

Awesome! Great papers, and early! Thank you so much once again! Definitely recommend to trust James with your assignments! He won’t disappoint!

Kaylin Green

Student

Proofreading & Editing

Thank you Dr. Rebecca for editing my essays! She completed my task literally in 3 hours. For sure will work with her again, she is great and follows all instructions

Rebecca L.

Researcher

Critical Thinking / Review

Extremely thorough summary, understanding and examples found for social science readings, with edits made as needed and on time. It’s like having a tutoring service available (:

Arnold W.

Customer

Coursework

Perfect!I only paid about $80, which i think was a good price considering what my paper entailed. My paper was done early and it was well written!

Joshua W.

Student

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>