Lab1 PROGRAMMING TASK 7.3 A program is needed to ask the user to input the price of products they have bought. Calculate and output the total cost they spent. Getting started 1 What are the steps required to find the total? For example, initialising the total to 0 will be the first step. CONTINUED 2 You will need to work out how to continue asking for the price of products until they do not have any more. Have a look at some of the previous algorithms in this chapter that perform similar actions to this. What did they use? How did they limit the number that could be entered? Practice 1 2 3 REPEAT TOTAI TOTAL +0. Create a structure diagram for the problem. Write an algorithm to ask users to repeatedly input the price of products they have bought until there are no more to enter. Amend the algorithm to total the cost of all the products and output this at the end of the algorithm. Challenge 1 2 Amend the algorithm to also count how many items they entered. You can look ahead to the next section or work out how to count them yourself. Now you have the total and the quantity, amend your program to work out the average cost. Price o WHILE Price 40. OUTPUT "Input the price of product they bought" 8 Lab2 1 Difference ifferences betwe ore about arrays PROGRAMMING TASK 7.4 A program needs to ask the user to input the weight of parcels being posted. It needs to count how many parcels are less than 1 kg, how many are between 1 kg and 2kg, and how many are above 2 kg. Getting started 1 2 Recap how to count in an algorithm. What are the different pieces of code you need? For example, initialise the count to start at 0. You will need to use selection to compare the inputs with the weights. Recap the use of selection and the format, including the differences between the operators >, >=, < and <=. Practice owcharts & Tra Pre- 1 Differ P swer T ile Answer != ' Answer inpu 1 Draw a structure diagram for the problem. 2 3 4 Write an algorithm to read in the weights of the parcels until the user has finished. Amend the algorithm to count and output how many parcels are below 1kg. Amend the algorithm to also count and output how many parcels are between 1 and 2kg. 5 Amend the algorithm to also count and output how many parcels are more than 2kg. Challenge The user would like to enter the limits that they are counting themselves when the program starts. For example, counting how many parcels are less than 1.5 kg instead of 1 kg. Amend the program to make this change. START INPUT the weight of panels] AND X +Count=0 Cont2=AN (Count3=0 | [lant3 = [ortze No /OUTPUT County, count: AND Counts/ Yes Fxxx | Cant2= Caft₂+1 x42 3 Count to IF Weight < 1 OUT Put Court Count Count +1 UNTIL finished
Lab1 PROGRAMMING TASK 7.3 A program is needed to ask the user to input the price of products they have bought. Calculate and output the total cost they spent. Getting started 1 What are the steps required to find the total? For example, initialising the total to 0 will be the first step. CONTINUED 2 You will need to work out how to continue asking for the price of products until they do not have any more. Have a look at some of the previous algorithms in this chapter that perform similar actions to this. What did they use? How did they limit the number that could be entered? Practice 1 2 3 REPEAT TOTAI TOTAL +0. Create a structure diagram for the problem. Write an algorithm to ask users to repeatedly input the price of products they have bought until there are no more to enter. Amend the algorithm to total the cost of all the products and output this at the end of the algorithm. Challenge 1 2 Amend the algorithm to also count how many items they entered. You can look ahead to the next section or work out how to count them yourself. Now you have the total and the quantity, amend your program to work out the average cost. Price o WHILE Price 40. OUTPUT "Input the price of product they bought" 8 Lab2 1 Difference ifferences betwe ore about arrays PROGRAMMING TASK 7.4 A program needs to ask the user to input the weight of parcels being posted. It needs to count how many parcels are less than 1 kg, how many are between 1 kg and 2kg, and how many are above 2 kg. Getting started 1 2 Recap how to count in an algorithm. What are the different pieces of code you need? For example, initialise the count to start at 0. You will need to use selection to compare the inputs with the weights. Recap the use of selection and the format, including the differences between the operators >, >=, < and <=. Practice owcharts & Tra Pre- 1 Differ P swer T ile Answer != ' Answer inpu 1 Draw a structure diagram for the problem. 2 3 4 Write an algorithm to read in the weights of the parcels until the user has finished. Amend the algorithm to count and output how many parcels are below 1kg. Amend the algorithm to also count and output how many parcels are between 1 and 2kg. 5 Amend the algorithm to also count and output how many parcels are more than 2kg. Challenge The user would like to enter the limits that they are counting themselves when the program starts. For example, counting how many parcels are less than 1.5 kg instead of 1 kg. Amend the program to make this change. START INPUT the weight of panels] AND X +Count=0 Cont2=AN (Count3=0 | [lant3 = [ortze No /OUTPUT County, count: AND Counts/ Yes Fxxx | Cant2= Caft₂+1 x42 3 Count to IF Weight < 1 OUT Put Court Count Count +1 UNTIL finished
C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter1: Fundamentals Of C++ Programming
Section1.3: Preliminary Three: Software Development
Problem 7E: (Statistics) This is the formula for the standard normal deviate, z, used in statistical...
Related questions
Question
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps
Recommended textbooks for you
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT