Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Program 1 : List Menu operation Create a menu to allow the user to add, insert, remove, find the maximum, the minimum, and sort the
Program: List Menu operation Create a menu to allow the user to add, insert, remove, find the maximum, the minimum, and sort the list in descending order larger to smaller value Declare your list as list of string.
studentFullNameMike navarro","Miguel saba","Maria Rami"
You may use any of build in functions. Here is an sample output:
Add an item to the list
Remove an item from the list
Insert an item to the list
Find maximum
Find Minimum
Sort the list in descending order
Quit the program
Please enter your option:
Where do you want to insert the item? Enter the index number
Please enter the value for the item you want to insert: "Tina Mari"
Your original List : Mike navarro","Miguel saba","Maria Rami"
After inserting an item into index :
Mike navarro","Tina Mari", "Miguel saba","Maria Rami"
Once the user enters an option, your program should execute the code for that option and displays the list before and after the operations. Make sure to use a while loop so the program runs until user enters the quit option.
Program BurstList:
Write a program to determine the length of bursts of zeros in a list of N numbers stored in a List. The program should record the length of the bursts of zeros in another List. The program should then print the lengths of the bursts.
Using this second List with the lengths of the bursts, it should also compute and print the following: the average length of the bursts, the minimum burst length, the maximum burst length, and the total number of zeros the sum of the burst lengths
Your program should:
Prompt the user for the size of the list N Then it should prompt the user to enter N numbers and store them into an list called burstList. Note, you should specify the maximum size of N allowed based on how large you declare your List
Given N and list, your program should compute the lengths of the bursts of zeros and store them in an list called BurstLengths. After computing and storing the burst lengths you should terminate your BurstLengths list with a sentinel Use a for loop in this step.
Given the BurstLengths List with a sentinel use a while loop to print the list of burst lengths. Format this nicely in a table with headings.
Given the BurstLengths List with a sentinel compute and then print the following information:
a Average burst length
b Minimum burst length
c Maximum burst length
d Total number of zeros
Example data and results:
N entered by the user and stored in N:
List of numbers entered by the user and stored in list:
List of bursts computed by your program and stored in BurstList:
Average burst length computed by your program:
Minimum burst length computed by your program:
Maximum burst length computed by your program:
Total number of zeros computed by your program:
Results:
Burst Length
Average burst length:
Minimum burst length:
Maximum burst length:
Total number of zeros:
Hints:
Check the boundaries beginning and end of the lists Test your program with a list of numbers that ends with a and another that doesnt end with a and make sure your program works properly. Similarly, test it with lists that start with a and those that dont
Use a flag variable such as burstopen to keep track of whether you are in the middle of a burst or not. When you encounter a burst the first in a burst you can set the burstopen variable to When you encounter the end of a burst, you can set the burstopen variable to
Develop your program in parts. You can develop and test the code for the different steps separately.
Note that you can create your own BurstList to test if the code for steps and work
before completing step In the end, you should have one program that contains all steps.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started