Define a function named procedure2() that will be called from main() function, the function will: 1. Use the switch statement and infinite loop to generate the following menu and ask the user to choose one of the options from the menu (show the menu to the user). 1 - Work on Negative values 2 Work on A Pattern 3 4 Print A Message Exit the program Please select your option: 2. If the user selects 1: a. the program will ask the user to enter a negative value, which is an integer N. If the number is negative, the sum of all numbers between -1 and N is displayed on the screen. For example, if the input n = -7, the program shou print the following output: The option 1 result is: -1 -2 -3 -4 -5 -6 -7 = -28 b. If the input number is positive, the program should print out "the input is invalid, please try to input another number" and ask for another number to repeat this process until the input number is a negative number. c. After the exection of this part of the program, the program will display the menu again and wait for the next option. 3. If the user selects option 2: a. the program should ask the user for an integer value M, which is between 2 to 60, and then print the following pattern with many asterisks. The following example is when the input M is 6: It will print 11 lines of asterisks that include 1 to 6 asterisks each row, and then 5 to 1 asteriskes each row. **** Menu ***** ****** ***** **** *** ** b. The program should use for loop to create the pattern. If the input is not in the range from 2 to 60, your program should print out "the input is invalid, please try to input another number" and ask for another number M until the given number is between 2 and 60. c. After the exection of this part of the program, the program will display the menu again and wait for the next option. 4. If the user selects option 3, the program should print your name as the following: Hi, welcome! The program is made by YOUR_NAME_HERE. 5. The program will exit the program when the input is 4. Please notice that this is the ONLY exit condition for the program. 6. Test your program with at least 4 different cases with the selection of 1, 2, 3 and 4 as the menu options, respectively. Please submit the screenshots of all these test cases.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
icon
Concept explainers
Question

C programming only

Define a function named procedure2() that will be called from main() function,
the function will:
1. Use the switch statement and infinite loop to generate the following menu and ask the user to
choose one of the options from the menu (show the menu to the user).
1 - Work on Negative values
2
Work on A Pattern
3
4
Print A Message
Exit the program
Please select your option:
2. If the user selects 1:
a. the program will ask the user to enter a negative value, which is an integer N. If the
number is negative, the sum of all numbers between -1 and N is displayed on the screen.
For example, if the input n = -7, the program shou print the following output:
The option 1 result is:
-1 -2 -3 -4 -5 -6 -7 = -28
b. If the input number is positive, the program should print out "the input is
invalid, please try to input another number" and ask for another
number to repeat this process until the input number is a negative number.
c.
After the exection of this part of the program, the program will display the menu again
and wait for the next option.
3. If the user selects option 2:
a.
the program should ask the user for an integer value M, which is between 2 to 60, and
then print the following pattern with many asterisks. The following example is when the
input M is 6: It will print 11 lines of asterisks that include 1 to 6 asterisks each row, and
then 5 to 1 asteriskes each row.
****
Menu
*****
******
*****
****
***
**
b. The program should use for loop to create the pattern. If the input is not in the range
from 2 to 60, your program should print out "the input is invalid, please
try to input another number" and ask for another number M until the given
number is between 2 and 60.
c. After the exection of this part of the program, the program will display the menu again
and wait for the next option.
4. If the user selects option 3, the program should print your name as the following:
Hi, welcome! The program is made by YOUR_NAME_HERE.
5. The program will exit the program when the input is 4. Please notice that this is the ONLY exit
condition for the program.
6. Test your program with at least 4 different cases with the selection of 1, 2, 3 and 4 as the menu
options, respectively. Please submit the screenshots of all these test cases.
Transcribed Image Text:Define a function named procedure2() that will be called from main() function, the function will: 1. Use the switch statement and infinite loop to generate the following menu and ask the user to choose one of the options from the menu (show the menu to the user). 1 - Work on Negative values 2 Work on A Pattern 3 4 Print A Message Exit the program Please select your option: 2. If the user selects 1: a. the program will ask the user to enter a negative value, which is an integer N. If the number is negative, the sum of all numbers between -1 and N is displayed on the screen. For example, if the input n = -7, the program shou print the following output: The option 1 result is: -1 -2 -3 -4 -5 -6 -7 = -28 b. If the input number is positive, the program should print out "the input is invalid, please try to input another number" and ask for another number to repeat this process until the input number is a negative number. c. After the exection of this part of the program, the program will display the menu again and wait for the next option. 3. If the user selects option 2: a. the program should ask the user for an integer value M, which is between 2 to 60, and then print the following pattern with many asterisks. The following example is when the input M is 6: It will print 11 lines of asterisks that include 1 to 6 asterisks each row, and then 5 to 1 asteriskes each row. **** Menu ***** ****** ***** **** *** ** b. The program should use for loop to create the pattern. If the input is not in the range from 2 to 60, your program should print out "the input is invalid, please try to input another number" and ask for another number M until the given number is between 2 and 60. c. After the exection of this part of the program, the program will display the menu again and wait for the next option. 4. If the user selects option 3, the program should print your name as the following: Hi, welcome! The program is made by YOUR_NAME_HERE. 5. The program will exit the program when the input is 4. Please notice that this is the ONLY exit condition for the program. 6. Test your program with at least 4 different cases with the selection of 1, 2, 3 and 4 as the menu options, respectively. Please submit the screenshots of all these test cases.
Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Operators
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education