oblem: Calculate movie charges for each customer attending a movie, use a sentinel value, -1, to exit the program. take input for customer age ages 0-6 are FREE ages over 6 to 18 is $12 ages over 18 to 55 is $15 over 55 gets Senior Citizen discount and is $5.00 Output the customer charge, accumulate th
Types of Loop
Loops are the elements of programming in which a part of code is repeated a particular number of times. Loop executes the series of statements many times till the conditional statement becomes false.
Loops
Any task which is repeated more than one time is called a loop. Basically, loops can be divided into three types as while, do-while and for loop. There are so many programming languages like C, C++, JAVA, PYTHON, and many more where looping statements can be used for repetitive execution.
While Loop
Loop is a feature in the programming language. It helps us to execute a set of instructions regularly. The block of code executes until some conditions provided within that Loop are true.
Problem: Calculate movie charges for each customer attending a movie, use a sentinel value, -1, to exit the
- take input for customer age
- ages 0-6 are FREE
- ages over 6 to 18 is $12
- ages over 18 to 55 is $15
- over 55 gets Senior Citizen discount and is $5.00
Output the customer charge, accumulate the charges for each customer within the loop structure, once the loop is exited, display the total earning for that movie showing
- Submit pseudocode
* Be sure to NOT use a compound boolean expression in your Selection Structure, its is not needed if you design your Selection Structure correctly.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 2 images