Question
Complete Chapter 6, Programming Activity 2: Using for Loops. Make sure you study the Programming Activity 6-2 Guidance document. Programming Activity 6-2 Guidance ================================= For
Complete Chapter 6, Programming Activity 2: Using "for" Loops. Make sure you study the Programming Activity 6-2 Guidance document. Programming Activity 6-2 Guidance ================================= For this activity, you are totaling item prices. You must get each item, get its price, and add that price to the total. When you have the final total, you output it in the format specified. Purpose of "for" loop --------------------- You must understand the purpose of the "for" loop in this assignment. The "for" loop is to iterate through the items and update a total. The "for" loop should not be the only thing in the function. It needs appropriate local variables declared BEFORE it begins. That means BEFORE the "for" statement line. You output the total AFTER the "for" loop finishes. That means AFTER its closing brace. That is why local variables, like the total, must be declared BEFORE the "for" loop is entered. If you declared the total variable inside the "for" loop, then it could not be referenced after it. Pseudocode for this assignment ------------------------------ You can find the following in this weeks outline: Calculate a total (using a for loop) (pseudocode) total = 0 // There is no need for a priming read. for (int i = 1; i
this is the output examples
Example Programming Activity 6-2 outputStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started