Question: Hi can someone plesase help me create a C++ program for this question is found by studying the problem specification. The first problem specification you

Hi can someone plesase help me create a C++ program for this  Hi can someone plesase help me create a C++ program for
this question is found by studying the problem specification. The first problem
specification you will examine in this chapter involves an evil scientist named
Dr. N. The problem specification and an illustration of the problem are

question is found by studying the problem specification. The first problem specification you will examine in this chapter involves an evil scientist named Dr. N. The problem specification and an illustration of the problem are shown in Figure 5-1 along with an appropriate algorithm. The algorithm. which is written in pseudocode, requires only the sequence structure Problem specification Dr. N is sitting in a char in his lair, facing a control deck and an electronic screen. At times, visitors come to the door located at the rear of the lar. Before pressing the blue buttoh on the control deck to open the door, Dr. N likes to view the visitor on the screen. He can do so by pressing the orange button on the control deck. Write the instructions that direct Dr. N to view the visitor first, and then open the door and say Welcome". Algorithm: 1. press the orang battow ew thi conernt decke to vew the visitor on the sorets. 2. jines the blue button on, the contrid ilek to epen the door x. say "Weleme" Figure 5-1 A problem that requires the sequence structure only. Now. we will make a slight change to the problem specification shown in Figure 5-1. In this case, Dr. N should open the door only if the visitor knows the secret password. The modified problem specification and algorithm are shown in Figure 5-2. The algorithm contains both the sequence and selection structures. The selection structure's condition, which is enclosed in parentheses in the pseudocode, directs Dr. N to make a decision about the visitor's password. More specifically, he needs to determine whether the visitor's password matches the secret password. As you may remember from Chapter 1 , the condition in a selection structure must be phrased so that it evaluates to an answer of either true or false. In this case, either the visitor's password matches the secret password (true) or it doesn't match the secret password (false). Only if both passwords are the same does Dr. N need to follow the two indented instructions. The selection structure in Figure 52 is referred to as a single-alternative selection structure because it requires one or more actions to be taken only when its condition evaluates to true. Other examples of singlealternative selection structures include "if it's raining, take an umbrella" and "if you are driving your car at night, turn on your car's headlights". Problem specification Dr. N is sitting in a chair in his lair, facing a control deck and an electronic screen. At times, visitors: come to the door located at the rear of the lair. Before pressing the blue button on the control deck to open the door, Dr. N likes to view the visiter on the screen. He can do so by pressing the orange button on the control deck. Write the instructions that direct Dr. N to view the visitor first and then ask the visitor for the password. He should open the door and say "Welcome" only if the visitor knows the secret password. Algorithm: 1. press the orange button on the controt deck to viow the visitor on the sereen 2. ase the visitor for the password 3. if (the visitor"s password matches the secret pasowerd) press the blue button on the contrel dece to open the doer. say welcome* and if: Figure 5-2. A problem that requires the sequence structure and a single atternative selection structure Problem specification Dr. N is sitting in a chair in his lair, facing a control deck and an electronic screen. At times, visitors come to the door located at the rear of the lair. Before pressing the blue button on the control deck to open the door, Dr. N likes to view the visitor on the screen. He can do so by pressing the orange button on the control deck. Write the instructions that direct Dr. N to view the visitor first and then ask the visitor for the password. He should open the door and say "Welcome" only if the visitor knows the secret password. If the visitor does not know the secret password, Drs: N should say "Sorry, you are wrong" and then destroy the visitor by pressing the big red button on the control deck. Algorithm 1. 1. press the orange button on the oontrol deck to view the visitor on the soreen 2. ask the visitor for the password corition determines if pussword is correct 3. if (the visitor's passwerd matches the secret password) - press the blue button on the contrd deck to open the door - say "welcome" Tay "sorry. y are wrong" press the big red button on the control deck to destroy the visitor Algorithm 2 1. Press the orange button on the contro deck to view the visitor on the serece 2. aske the.vicitor for the password 3. If (ehe visitor's password does not matoh the seeret pascworid) [ say 'somy you ars wong" else press the dig red button on the contrel decke to destroy the visiter - press the blice button on the controt deck tappec the door end if "ry "welome? Problem specification Pete's Pizzeria wants a program that displays an employee's weekly gross pav. eiven the numhar of. Figure 54 Problem specification and tve correct algorithrus shown in fowchart form

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!