+1-415-315-9853

info@mywordsolution.com

## Engineering

 Civil Engineering Chemical Engineering Electrical & Electronics Mechanical Engineering Computer Engineering Engineering Mathematics MATLAB Other Engineering Digital Electronics Biochemical & Biotechnology

problem 1) This problem deals with polynomials - their representation and simple operations on them.

A polynomial would be given as input as described below:

i) number of terms in the polynomial, say n

ii) n pairs of (coefficient, exponent) values in an arbitrary order

For ex, the following polynomial:

p(x) = 10 x15 + 23.8 x3 + 1.6 x - 2.5 may be supplied as:

Number of terms: 4

terms (coeff, exp ) : ( in arbitrary order)
10.0     15
1.6       1
-2.5     0
3.3      3

Given such sparse polynomials, select a linked list based representation for creating the same.

prepare functions for the following:

i) function which returns degree of a polynomial

ii) functions, addpoly and diffpoly, that implement addition and difference of two input sparse polynomials.
prepare a main() and test out your implementation.

problem 2) Companies and people often buy and sells stocks. Often they buy same stock for different prices at different times. Say a person owns 1000 shares a certain stock (like Checkpoint); she may have bought the stock in amounts of 100 shares over 10 different times with 10 different prices.

We will analyze two different methods of accounting -- FIFO and LIFO accounting used for determining the "cost" of a stock. This information is typically find outd when a stock is sold to determined if a profit / loss was made. In our version of FIFO accounting, the price of a commodity is averaged starting with the first purchase of that item. Say we sell 250 shares of a stock, according to this method; the purchase price is determined by averaging the prices on the first 250 shares bought. In our version of LIFO accounting, the price of a commodity is averaged starting with the last purchase of that item. Say we sell 250 shares of a stock, according to this method; the purchase price is determined by averaging the prices on the last 250 shares bought.

In this assignment, use a queue for storing data for Fifo accounting, and stack for Lifo accounting. You must use the array based implementation for your stack based implementation and a linked list for implementing your queue.

Both your stack and queue must have records with the following fields:

The name of the stock (a string or int)

The number of shares of a stock (an int)

The purchase price (can be a decimal)

You can suppose that the first element of the structure is the security bought first, the second was bought second, etc.

Your program must have the user able to enter information about various stocks, the amount of shares, and the price. The user can then enter a query about a certain stock and the cost according to the Lifo and Fifo accounting methods for a certain number of shares.

Press 1 to enter a new stock

Press 2 to find the LIFO and FIFO price for a stock.

If 1 is pressed, the user needs to enter the stock symbol, and the number of shares, and the price.

If 2 is pressed, the user requires to enter the stock symbol being queried and the number of shares in problem.

Computer Engineering, Engineering

• Category:- Computer Engineering
• Reference No.:- M96643

Have any Question?

## Related Questions in Computer Engineering

### 1 each year a baseball team sells boxes of chocolates as a

1) Each year, a baseball team sells boxes of chocolates as a fundraiser to lower the cost of team fees. The price of the chocolates and the number of boxes sold varies each year. The information from five years of sales ...

### Assume we have 20 hosts in a small as there are only four

Assume we have 20 hosts in a small AS. There are only four groups in this AS. Find the number of spanning trees in each of the following approaches: a. source-based tree b. group-shared tree

### Search the web for security education and training programs

Search the Web for security education and training programs in your area. Keep a list and see which category has the most examples. See if you can determine the costs associated with each example. Which do you think woul ...

### Describe how exactly you would perform a collision search

Describe how exactly you would perform a collision search to find a pair x1, x2, such that h(x1) = h(x2) for a given hash function h. What are the memory requirements for this type of search if the hash function has an o ...

### Questions1 explain the principle of Questions: 1. Explain the principle of

Questions: 1. Explain the principle of convention-over-configuration. 2. Why does a template's file name have the .html.erb extension? 3. What must be placed in an application's controller class? 4. What kinds of operati ...

### Investigate the effectiveness of business information

Investigate the effectiveness of business information systems of the given case study. To do this, you are required to submit a complete report which includes an analysis of functionality, resources required, the broad f ...

### Write a java statement to initialize a variable square with

Write a Java statement to initialize a variable square with a rectangle object whose top left corner is (10, 20) and whose sides all have length 40. Then write a statement that replaces square with a rectangle of the sam ...

### Write a deletion method for the avltree class that utilizes

Write a deletion method for the AVLTree class that utilizes lazy deletion. There are several techniques you can use, but a simple one is to simply add a Boolean field to the Node class that signifies whether or not the n ...

### 1 in chapter 8 we learned that a circuit-switched network

1. In Chapter 8, we learned that a circuit-switched network needs end-to-end addressing during the setup and teardown phases. Define end-to-end addressing in a telephone network when two parties communicate. 2. When we h ...

### Write a program lotteryprinter that picks a combination in

Write a program LotteryPrinter that picks a combination in a lottery. In this lottery, players can choose 6 numbers (possibly repeated) between 1 and 49. (In a real lottery, repetitions aren't allowed, but we haven't yet ...

• 13,132 Experts

## Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

### WalMart Identification of theory and critical discussion

Drawing on the prescribed text and/or relevant academic literature, produce a paper which discusses the nature of group

### Section onea in an atwood machine suppose two objects of

SECTION ONE (a) In an Atwood Machine, suppose two objects of unequal mass are hung vertically over a frictionless

### Part 1you work in hr for a company that operates a factory

Part 1: You work in HR for a company that operates a factory manufacturing fiberglass. There are several hundred empl

### Details on advanced accounting paperthis paper is intended

DETAILS ON ADVANCED ACCOUNTING PAPER This paper is intended for students to apply the theoretical knowledge around ac

### Create a provider database and related reports and queries

Create a provider database and related reports and queries to capture contact information for potential PC component pro