(or not be selected to run). In other words, remaining code should be wrapped in (a) branch structure(s) to run or not run according to user inputs. Sample Runs: Test your program as you go for all of the possible outcomes described above! Don't wait until the end to test! There are lots of possible paths/outcomes. Sample Run 1: Enter your full name: Hannah Hillberg Please enter up to the first four letters of your first name: bot bot bot I can't follow instructions We cannot trust that you are not a robot. Good bye. Sample Run N: Please enter your first and last name: Hannah Hillberg Please enter up to the first four letters of your first name: hann You are being directed to Operator 1... Hello, I'm Operator 1! Please enter your card number: 4567741236985462 Thank you for setting up your Visa card. Please enter a PIN: 4568 Please re-enter PIN: 4568 PIN saved. Your account is activated. Thank you! Submission Submit your entire Lab6 Blue] project in a single zipped up folder to Canvas before the deadline.
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.
Algorithm:
- Prompt the user to enter their full name.
Prompt the user to enter up to the first four letters of their first name. - Convert the user's first name input to lowercase and extract the first name from the full name, also converting it to lowercase.
- If the length of the first name input is more than 4 characters or if it does not match the first four letters of the actual first name, display a message saying, "We cannot trust that you are not a robot. Goodbye."
- If the input is valid, proceed to the following steps:
- Display a message, "You are being directed to Operator 1..."
- Prompt the user to enter their card number.
- Display a message, "Thank you for setting up your Visa card."
- Prompt the user to enter a PIN and confirm the PIN.
- If the two entered PINs match, display, "PIN saved. Your account is activated. Thank you!" Otherwise, display, "PINs do not match. Your account activation failed. Goodbye."
Step by step
Solved in 4 steps with 4 images