Program that generates a new list

Assignment Help C/C++ Programming
Reference no: EM13907638

Given a list listA of numbers, write a program that generates a new list listB with the same number of elements as listA, such that each element in the new list is the average of its neighbors and itself in the original list. For example, if listA = [5, 1, 3, 8, 4], listB = [3.0, 3.0, 4.0, 5.0, 6.0], where the values in listB were computed as follows:

(5 + 1)/2 = 3.0
(5 + 1 + 3)/3 = 3.0
(1 + 3 + 8)/3 = 4.0
(3 + 8 + 4)/3 = 5.0
(8 + 4)/2 = 6.0

listA can be hardcoded at the begining of your program, but the solution should work for other lists as well (in particular if we modify the values of the list, the program should work with the new values).

Sample run:

listA = [5, 1, 3, 8, 4]

listB = [3.0, 3.0, 4.0, 5.0, 6.0]

Reference no: EM13907638

Questions Cloud

What are the sales objectives for new sales representative : What are the sales objectives for the new sales representative? What role will the compensation design play in motivating the new sales representative? What kind of sales incentive plan do you recommend? Why
What other dbms constructs came after relational databases? : What other DBMS constructs came after relational databases?
Kenya company standard cost accounting system recorded : Kenya Company's standard cost accounting system recorded this information from its June operations.
Compute the sum of the first : Assume there is a variable , h already associated with a positive integer value. Write the code necessary to compute the sum of the first h perfect squares, starting with 1 .
Program that generates a new list : Given a list listA of numbers, write a program that generates a new list listB with the same number of elements as listA, such that each element in the new list is the average of its neighbors and itself in the original list. For example, if listA..
Write an sql drop statements that will drop the all tables : Write an SQL DROP statements that will drop the all tables. Add these statements to the appropriate location within the script file - Write a SQL CREATE TABLE statement to create the ALLOCATION table. Add the SQL statement to the appropriate locati..
Analysis of flexible budgets and standard costs emphasizes : Analysis of flexible budgets and standard costs emphasizes the importance of a similar unit of measure for meaningful comparisons and evaluations.
Program that loads the keywords and definitions : 1) Develop the part of the program that loads the keywords and definitions from the external file
Folsom custom skis as discussed in the chapter opener : Folsom Custom Skis, as discussed in the chapter opener, uses a costing system with standard costs for direct materials,

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Develop a simple poker game

Develop a simple poker game

  Write a function num_digits(n)

C programing, not C++ write a function num_digits(n) that returns the number of digits in a nonnegative integer n.

  Write a program to implement multiple document interface

Write a program to implement Multiple document interface.

  Multiple choice question on c programming

Create a function to print "88 is a great port number" function name is yourName_PrintFunction no input no return type print "88 is a great port number"

  Create a website that would allow users to enter and submit

Create a Website that would allow users to enter and submit survey

  Many bank atm machines have recently added the ability to

many bank atm machines have recently added the ability to dispense cash with- drawals in multiple bill denominations

  Write in c++ another overloaded operator

Write in C++ another overloaded operator to go in the program that has Treasury. Overload the forward slash /  so that in the main program, you can declare sale to be of type Treasury, and commission to be of type Treasury, and commispctage to be of ..

  Program solves the n-queens problem

you will write a program that solves the N-Queens problem by the backtracking method. The pseudocode for the solution is on the last page. Your program should run in standard Java, either as an application or an applet.

  Write me a function that finds the smallest item in an array

Write me a function that finds the smallest item in an ArrayBag (by reference) and returns true if the arrayBag is not empty and false otherwise.

  Prepare a program for a company named retail-martbullprompt

prepare a program for a company named retail-mart.bullprompt the user to enter an item name one word only a quantity

  Features with the real life scenarios

Explain any three features that must be implemented by the application that will be created by WebSoft Solutions Pvt. Ltd. Support your answer with suitable examples. Relate the features with the real life scenarios.

  Implement random class for generating pseudo-random numbers

Implement a Random class for generating pseudo-random numbers. Implement a Person class. Each object of this class will represent a human being.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd