Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Matlab You are working with a stock management system that tracks how many units of some item a store has in stock. As input you

Matlab
image text in transcribed
You are working with a stock management system that tracks how many units of some item a store has in stock. As input you are given a liste of transactions, i.e. a list of numbers (integers): Positive numbers indicate that items are added to the stock, and negative numbers indicate that items are removed from the stock. The number zero indicates that the stock is reset to zero. Before the first transaction, the number of items in stock is zero. Create a function named cumulativeStock which returns the number of items in stock after each transaction given a vector containing the list of transactions. function stock - cumulativeStock(transactions) Consider the following list of transactions: 10, -4, -3, 10,-12, 0, 8 Initially the stork is 0 so after the first transaction there are 10 items in stock. At the second transaction 4 items are removed, so the stock is down to 6 items. Next, 3 items are removed, so wc are down to 3 items in stock. Then 10 items are added and we are up to 13 items, whereafter 12 items are removed and we are down to 1 item. At the next transaction the stock is reset to 0, and finally 8 items are added. The total stock after each transaction is thus: 10, 6, 3, 13, 1, 0, 8

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Access Patterns Database Interactions In Object Oriented Applications

Authors: Clifton Nock

1st Edition

0321555627, 978-0321555625

More Books

Students also viewed these Databases questions