Please write your own code please do not copy code from other sites. Thank you. in C++ Create a random sized linked list of randomly generated integers. Insert 25 to 75 random integers in the inclusive range 0 to 100 into the linked list. Display the contents, the sum, the count, and average of the integers. Create a program named LastnameFirstname17.c, that does the following: Define a structure named node that stores a single integer and a pointer to another node. You may use the struct definition in linkedlist.c as a template to get started. Keep in mind that the data in the linkedlist.c example was a string implemented as a char[]. For this assignment, the data is an integer, just a single int. You may want to define a typedef to create alias' for the node structure and node pointer for convenience. Setup your program to generate random numbers. Import the necessary includes and seed the random function. Generate a random integer between 25 and 75, inclusive, this number will be the size of the linked list. The size of the linked list: int size = 25 + rand() % 51; Create a node* variable that will be the head of the linked list. For the next part of the program, you will be defining three custom functions to handle specific linked list related tasks. Declare all function prototypes above main and define all functions below main. The function prototypes will not be given because it will be different depending if you created alias's. As with previous assignments, do NOT create any global variables. All variable declarations are either in main() or in the custom functions. Symbolic constants are okay as those are not variables. Define the following 3 custom functions given their descriptions: Define a void function named insertIntoLinkedList that takes in an integer and a node pointer as parameters. The integer is the data of a new node that will be added to the linked list and the node pointer is the head of the linked list. Create a new node using the integer, then insert that node into the linked list in descending order. Descending order for numbers means largest to smallest. Note: Do not generate the random integer in this function. The integer is provided in the parameter. When this function is called, the integer is passed as an argument. Define a void function named displayLinkedList that takes in a node pointer as a parameter and prints the data in the linked list on a single line, comma separated. Define an int function named sumLinkedList that takes in a node pointer as a parameter, calculates the sum of all the data in the list and returns it. The purpose of this function is to calculate the sum and return it, that's all. There should be no average calculation or prints in this function, that happens in the main() function. The sole purpose of this function is to return the sum of the linked list. Back in the main(), use a loop to build the linked list of integers. Generate an integer between 0 and 100, inclusive, then call the insertIntoLinkedList function using the integer and the head of the linked list. To generate the random data: int randomData = rand() % 101; The amount of integers that need to be inserted is the size that was randomly generated at the beginning of the program. In other words, ensure the loop iterates size many times. After building the linked list, call the sumLinkedList function using the head of the linked list to get the sum of all the data. Use the sum and the size of the list to calculate the floating point average of the data. Be aware of integer division! Output the contents, sum, size, and average of the list. See the Example Output below. Display the average to 2 decimal places. Ensure all outpu
Please write your own code please do not copy code from other sites. Thank you. in C++ Create a random sized linked list of randomly generated integers. Insert 25 to 75 random integers in the inclusive range 0 to 100 into the linked list. Display the contents, the sum, the count, and average of the integers. Create a program named LastnameFirstname17.c, that does the following: Define a structure named node that stores a single integer and a pointer to another node. You may use the struct definition in linkedlist.c as a template to get started. Keep in mind that the data in the linkedlist.c example was a string implemented as a char[]. For this assignment, the data is an integer, just a single int. You may want to define a typedef to create alias' for the node structure and node pointer for convenience. Setup your program to generate random numbers. Import the necessary includes and seed the random function. Generate a random integer between 25 and 75, inclusive, this number will be the size of the linked list. The size of the linked list: int size = 25 + rand() % 51; Create a node* variable that will be the head of the linked list. For the next part of the program, you will be defining three custom functions to handle specific linked list related tasks. Declare all function prototypes above main and define all functions below main. The function prototypes will not be given because it will be different depending if you created alias's. As with previous assignments, do NOT create any global variables. All variable declarations are either in main() or in the custom functions. Symbolic constants are okay as those are not variables. Define the following 3 custom functions given their descriptions: Define a void function named insertIntoLinkedList that takes in an integer and a node pointer as parameters. The integer is the data of a new node that will be added to the linked list and the node pointer is the head of the linked list. Create a new node using the integer, then insert that node into the linked list in descending order. Descending order for numbers means largest to smallest. Note: Do not generate the random integer in this function. The integer is provided in the parameter. When this function is called, the integer is passed as an argument. Define a void function named displayLinkedList that takes in a node pointer as a parameter and prints the data in the linked list on a single line, comma separated. Define an int function named sumLinkedList that takes in a node pointer as a parameter, calculates the sum of all the data in the list and returns it. The purpose of this function is to calculate the sum and return it, that's all. There should be no average calculation or prints in this function, that happens in the main() function. The sole purpose of this function is to return the sum of the linked list. Back in the main(), use a loop to build the linked list of integers. Generate an integer between 0 and 100, inclusive, then call the insertIntoLinkedList function using the integer and the head of the linked list. To generate the random data: int randomData = rand() % 101; The amount of integers that need to be inserted is the size that was randomly generated at the beginning of the program. In other words, ensure the loop iterates size many times. After building the linked list, call the sumLinkedList function using the head of the linked list to get the sum of all the data. Use the sum and the size of the list to calculate the floating point average of the data. Be aware of integer division! Output the contents, sum, size, and average of the list. See the Example Output below. Display the average to 2 decimal places. Ensure all outpu
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
Please write your own code please do not copy code from other sites. Thank you. in C++
- Create a random sized linked list of randomly generated integers.
- Insert 25 to 75 random integers in the inclusive range 0 to 100 into the linked list.
- Display the contents, the sum, the count, and average of the integers.
Create a program named LastnameFirstname17.c, that does the following:
- Define a structure named node that stores a single integer and a pointer to another node.
- You may use the struct definition in linkedlist.c as a template to get started. Keep in mind that the data in the linkedlist.c example was a string implemented as a char[]. For this assignment, the data is an integer, just a single int.
- You may want to define a typedef to create alias' for the node structure and node pointer for convenience.
- Setup your program to generate random numbers. Import the necessary includes and seed the random function.
- Generate a random integer between 25 and 75, inclusive, this number will be the size of the linked list.
- The size of the linked list: int size = 25 + rand() % 51;
- Create a node* variable that will be the head of the linked list.
- For the next part of the program, you will be defining three custom functions to handle specific linked list related tasks. Declare all function prototypes above main and define all functions below main. The function prototypes will not be given because it will be different depending if you created alias's.
- As with previous assignments, do NOT create any global variables. All variable declarations are either in main() or in the custom functions.
- Symbolic constants are okay as those are not variables.
- Define the following 3 custom functions given their descriptions:
- Define a void function named insertIntoLinkedList that takes in an integer and a node pointer as parameters.
- The integer is the data of a new node that will be added to the linked list and the node pointer is the head of the linked list.
- Create a new node using the integer, then insert that node into the linked list in descending order. Descending order for numbers means largest to smallest.
- Note: Do not generate the random integer in this function. The integer is provided in the parameter. When this function is called, the integer is passed as an argument.
- Define a void function named displayLinkedList that takes in a node pointer as a parameter and prints the data in the linked list on a single line, comma separated.
- Define an int function named sumLinkedList that takes in a node pointer as a parameter, calculates the sum of all the data in the list and returns it.
- The purpose of this function is to calculate the sum and return it, that's all.
- There should be no average calculation or prints in this function, that happens in the main() function. The sole purpose of this function is to return the sum of the linked list.
- Define a void function named insertIntoLinkedList that takes in an integer and a node pointer as parameters.
- Back in the main(), use a loop to build the linked list of integers. Generate an integer between 0 and 100, inclusive, then call the insertIntoLinkedList function using the integer and the head of the linked list.
- To generate the random data: int randomData = rand() % 101;
- The amount of integers that need to be inserted is the size that was randomly generated at the beginning of the program. In other words, ensure the loop iterates size many times.
- After building the linked list, call the sumLinkedList function using the head of the linked list to get the sum of all the data.
- Use the sum and the size of the list to calculate the floating point average of the data.
- Be aware of integer division!
- Output the contents, sum, size, and average of the list. See the Example Output below.
- Display the average to 2 decimal places.
- Ensure all output is appropriately labeled.
- Be sure to have a program description at the top and in-line comments.
Please do all the following code in C++ and in your own original code please.
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 4 steps with 4 images
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY