Print the weighted moving average of all the trades

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

Please do that in C++

You are given a series of trades. Each trade has a key, a value, a quantity, and a sequence number. For each trade, print the weighted moving average of all the trades for that particular key.

Round your average to two decimal places. If the sequence number for any trade TT is less than the sequence number for any previous trade, throw out TT. Do not print anything for TT or factor it into your WMA.

M_{x+1} = {(M_x * Q_x)+(v_{x+1} * q_{x+1}) \over Q_{x+1}}M x+1 = Q x+1 (M x *Q x )+(v x+1 *q x+1 )

Where M = weighted moving average, Q = total quantity, q = current quantity, and v = current value.

Input:

The input will be a semicolon delimited string of trades, with each trade being comma delimited. The parameters for each trade will be in order:

Key Value Quantity Sequence number

Where key is a string, value is a rational floating point number, quantity is a positive integer, and sequence number is a positive integer.

Reference no: EM132095118

Questions Cloud

Write a program with class that implements a deque : Write a program with class that implements a deque that stores strings using a doubly-linked list that you code yourself.
Describe the impact of access control methods : Describe the impact of access control methods and models in obtaining evidence of sufficient quality to be accepted by a court.
Define the function payback : Define the function payback, which consumes a charge amount and computes the corresponding pay-back amount.
Have you considered teaching project management : Have you considered teaching project management as a part-time or full-time career? Do you want to know what goes on behind
Print the weighted moving average of all the trades : You are given a series of trades. Each trade has a key, a value, a quantity, and a sequence number.
Navigate a challenging organizational landscape : -When Mulcahy became COO, in what ways did she use EQ and AL to navigate a challenging organizational landscape? Explain your reasoning.
Prepare two income statements showing the byproduct : Prepare two income statements (1) showing the byproduct as a cost reduction during production, and (2) the byproduct as a revenue item when sold
Show that the time efficiency of solving the coinrow problem : Show that the time efficiency of solving the coin-row problem by straightforward application of recurrence (8.3) is exponential.
Why was the proof of fraud so important to the finney : 1. Why was the proof of fraud so important to the Finney's case? 2. How are Indiana judges supposed to consider cases involving contracts containing zipper cla

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

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