Question: Unit 3 Assignment: Using Repetition Structures Outcomes addressed in this activity: Unit Outcomes: Describe the differences in the types of repetition structures available to you
Unit Assignment: Using Repetition Structures
Outcomes addressed in this activity:
Unit Outcomes:
Describe the differences in the types of repetition structures available to you as a programmer.
Associate the appropriate repetition structure in a particular programming scenario.
Analyze whether to use a pretest or posttest loop in a particular programming scenario.
Course Outcome:
IN: Create fundamental programs using concepts such as decision statements and iteration.
Purpose
The purpose of this assignment is to provide the student an opportunity to demonstrate knowledge of the iteration structures such as the for loop and while loop.
Assignment Instructions
For this assignment, you will complete a program to demonstrate the skills presented in this lesson using C# Please keep in mind that with all the assignments in this course, any given scenarios are hypothetical and intended solely to demonstrate specific skills.
Assignment Requirements
The program for this assignment will consist of three sections, each headed
by the threeline comment below:
Assignment Section X
where X stands for the portion of the assignment to follow
Section :
Enter the comment with the section title.
Using a while loop structure, create a loop based on a counter variable which will cycle through 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 :
Enter the comment with the section title.
Create a set of two nested for loops.
The outer loop will iterate from to decrementing by with each consecutive iteration. Use the letter k for its counter variable name.
The inner loop will iterate from to by Use the letter i for its counter variable. Hint: Use the operator to increment by
With each iteration of the inner loop, print both loop index values such as
k i
Section :
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 to end.
With each iteration of the loop, add the user entered value to a running total.
End the loop when the user enters 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
Define the appropriate variables needed.
POSSIBLE EXPECTED OUTPUT
Enter grade:
Enter grade:
Enter grade:
Enter grade:
Enter grade:
Enter grade:
Enter grade:
Enter grade:
Enter grade:
Enter grade:
Total of all grades is
Class average is
k i
k i
k i
k i
k i
k i
k i
k i
k i
k i
k i
k i
k i
k i
k i
k i
k i
k i
k i
k i
k i
k i
k i
k i
k i
k i
k i
k i
k i
k i
Enter a positive number to be added to the total or to end.
Enter a positive number to be added to the total or to end.
Enter a positive number to be added to the total or to end.
Enter a positive number to be added to the total or to end.
Enter a positive number to be added to the total or to end.
The sum of all numbers entered is
Directions for Submitting Your Assignment
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.
Naming Your Project and Source Code File:
While you can change your file name later, it will be simpler with less chance of confusion if you name your new project and code file with the following naming convention when you create it The code files should be saved as INYourLastNameUnitX. The source code file and the project name can be the same.
Submit your completed assignment to the Unit Assignment Dropbox.
Review the rubric before beginning this activity.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
