Question
Complete Chapter 6, Programming Activity 1: Using while Loops. Make sure you study the Programming Activity 6-1 Guidance document Programming Activity 6-1 Guidance ================================= For
Complete Chapter 6, Programming Activity 1: Using "while" Loops. Make sure you study the Programming Activity 6-1 Guidance document
Programming Activity 6-1 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. Pseudocode for this assignment ------------------------------ You can find the following in this weeks outline: Processing user input (using a while loop) (pseudocode): initialize variables read first item // Priming read while (item != sentinel value) { process item read next item // Update read } output results More specifically for 6-1 ------------------------- initialize variables A key local variable is a reference to an item of type Item. Another useful variable is a double to store the price of an item. Another useful variable is a constant for the DIVIDER sentinel value. Finally, you will need a double to hold the running total of the items. Do a priming read to get the next (first) item and its price. Your while loop condition should check that the current item's price is not equal to the DIVIDER sentinel value. Here is an outline for your while loop body: Update the total with the current item's price. Make the call to animate. Get the next item and its price. After the end of the while loop: Output the results. Programming Activity 6-1 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. Pseudocode for this assignment ------------------------------ You can find the following in this weeks outline: Processing user input (using a while loop) (pseudocode): initialize variables read first item // Priming read while (item != sentinel value) { process item read next item // Update read } output results More specifically for 6-1 ------------------------- initialize variables A key local variable is a reference to an item of type Item. Another useful variable is a double to store the price of an item. Another useful variable is a constant for the DIVIDER sentinel value. Finally, you will need a double to hold the running total of the items. Do a priming read to get the next (first) item and its price. Your while loop condition should check that the current item's price is not equal to the DIVIDER sentinel value. Here is an outline for your while loop body: Update the total with the current item's price. Make the call to animate. Get the next item and its price. After the end of the while loop: Output the results.
Need the file in Java
Step 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