Questions
C++ Text file contains numbers 92 87 65 49 92 100 100 100 82 75 64...

C++

Text file contains numbers 92 87 65 49 92 100 100 100 82 75 64 55 100 98 -99

Modify your program from Exercise 1 so that it reads the information from the gradfile.txt file, reading until the end of file is encountered. You will need to first retrieve this file from the Lab 7 folder and place it in the same folder as your C++ source code. Run the program

#include <iostream>
using namespace std;


typedef int GradeType[100]; // declares a new data type:
float findAverage (const GradeType, int); // finds average of all grades
int findHighest (const GradeType, int); // finds highest of all grades
int findLowest (const GradeType, int); // finds lowest of all grades

int main()
{
GradeType grades; // the array holding the grades.
int numberOfGrades; // the number of grades read.
int pos; // index to the array.
float avgOfGrades; // contains the average of the grades.
int highestGrade; // contains the highest grade.
int lowestGrade; // contains the lowest grade.
// Read in the values into the array
pos = 0;
cout << "Please input a grade from 1 to 100, (or -99 to stop)" << endl;
cin >> grades[pos];

while (grades[pos] != -99)
{
pos++;
cin >> grades[pos];
}
numberOfGrades = pos--;
// call to the function to find average
avgOfGrades = findAverage(grades, numberOfGrades);
cout << endl << "The average of all the grades is " << avgOfGrades << endl;
  
highestGrade = findHighest(grades, numberOfGrades);
cout << endl << "The highest grade is " << highestGrade << endl;
  
lowestGrade = findLowest(grades, numberOfGrades);
cout << "The lowest grade is " << lowestGrade << endl;

return 0;
}
float findAverage (const GradeType array, int size)
{
float sum = 0; // holds the sum of all the numbers
for (int pos = 0; pos < size; pos++)
sum = sum + array[pos];
return (sum / size); //returns the average
}
int findHighest (const GradeType array, int size)
{
int highest = array[0];
for (int pos = 0; pos < size; pos++)
{
if ( highest < array[pos])
{
highest = array[pos];
}
}
return highest;
}
int findLowest (const GradeType array, int size)
{
int lowest = array[0];
for (int pos = 0; pos < size; pos++)
{
if ( lowest > array[pos])
{
lowest = array[pos];
}
}
return lowest;
}

In: Computer Science

1 Linear Algebra in Numpy (1) Create a random 100-by-100 matrix M, using numpy method "np.random.randn(100,...

1 Linear Algebra in Numpy
(1) Create a random 100-by-100 matrix M, using numpy method "np.random.randn(100, 100)", where
each element is drawn from a random normal distribution.
(2) Calculate the mean and variance of all the elements in M;
(3) Use "for loop" to calculate the mean and variance of each row of M.
(4) Use matrix operation instead of "for loop" to calculate the mean of each row of M, hint: create a vector
of ones using np.ones(100, 1)?
(5) Calculate the inverse matrix M−1
(6) Verify that M−1M = MM−1 = I. Are the off-diagnoal elements exactly 0, why?

In: Computer Science

Consider again Worked-Out Problem 14.2. The daily demand for pizza is

Consider again Worked-Out Problem 14.2. The daily demand for pizza is

          Qd=32,900−600P,Qd=32,900−600P,

where P is the price of a pizza. The daily costs for a pizza company include $845 in avoidable fixed costs and variable costs equal to

          VC=5Q+Q2/80,VC=5Q+Q2/80,

where Q is the number of pizzas produced each day. Marginal cost when producing Q pizzas is

          MC=5+Q/40.MC=5+Q/40.

Recall that the price is $11.50, and the total quantity demanded is 26,000 pizzas per day. In a long-run equilibrium, each active firm produces 260 pizzas per day, its efficient scale. That means there are 100 active firms in the initial long-run equilibrium. Suppose that starting at the initial long-run equilibrium with a price of $11.50 and 100 active firms, the government requires firms to pay a tax of $11.50 per pizza.

a. Complete the table below.

Instructions: Round quantities to the nearest whole number and prices to 2 decimal places.


No tax

With a tax = $11.50

  Short-run equilibrium price

11.50


  Short-run equilibrium quantity

26,000


  Consumer surplus

562,000


  Producer surplus

84,500


  Aggregate surplus

647,400


  Government revenue


  Deadweight loss



b. In the long run, the equilibrium price will be $ and the quantity will be .   

c. Relative to the short-run equilibrium, deadweight loss:


decreases.

stays the same.

cannot be determined.

increases.

In: Economics

Consider again Worked-Out Problem 14.2. The daily demand for pizza is           Qd=32,900−600P,Qd=32,900−600P, where P is...

Consider again Worked-Out Problem 14.2. The daily demand for pizza is

          Qd=32,900−600P,Qd=32,900−600P,

where P is the price of a pizza. The daily costs for a pizza company include $845 in avoidable fixed costs and variable costs equal to

          VC=5Q+Q2/80,VC=5Q+Q2/80,

where Q is the number of pizzas produced each day. Marginal cost when producing Q pizzas is

          MC=5+Q/40.MC=5+Q/40.

Recall that the price is $11.50, and the total quantity demanded is 26,000 pizzas per day. In a long-run equilibrium, each active firm produces 260 pizzas per day, its efficient scale. That means there are 100 active firms in the initial long-run equilibrium. Suppose that starting at the initial long-run equilibrium with a price of $11.50 and 100 active firms, the government requires firms to pay a tax of $11.50 per pizza.

a. Complete the table below.

Instructions: Round quantities to the nearest whole number and prices to 2 decimal places.

No tax

With a tax = $11.50

  Short-run equilibrium price

11.50

  Short-run equilibrium quantity

26,000

  Consumer surplus

562,000

  Producer surplus

84,500

  Aggregate surplus

647,400

  Government revenue

  Deadweight loss


b. In the long run, the equilibrium price will be $ and the quantity will be .   

c. Relative to the short-run equilibrium, deadweight loss:

cannot be determined.
decreases.
stays the same.
increases.

In: Economics

Forward prices of a generic asset The purpose of these problem is to guide you and...

Forward prices of a generic asset The purpose of these problem is to guide you and introduce you the “no-arbitrage” condition required to compute forward prices. For the following problems, assume the following information: There is an asset A. The price of the asset today, denoted by ?0, is ?0 = $100. The CCIR (yearly)(continuously compounded interest rate) is 6%.

Problem 3: No storage cost, and a convenience yield. Assume that asset A has no storage cost and there is a convenience yield. Every 9 months, the holder of the asset receives $13 dollars (you can call that a dividend). Suppose that someone is willing to enter a forward contract of Asset A for delivery in one year from now at ?0,1 = $115

a. We don't know a priori if there is a mispricing. Compute an arbitrage portfolio to exploit the potential mispricing. Hint: start by borrowing today $100

b. Now suppose that someone is willing to enter a forward contract of Asset A for delivery in one year from now at ?0,1 = $80 . Compute an arbitrage portfolio to exploit the potential mispricing. Hint: start by short-selling the asset

c. What would be the forward price that makes the profit in a) and b) zero?

d. Now try to find the general pricing formula. Suppose that the rate is ?, the spot price is ?0 and someone is willing to enter a forward at a forward price of ?0,? for delivery at time t=T. Replicate your portfolio/strategy in a) using this new information. What is the no-arbitrage forward price? Assume that a dividend $? is paid at ?1,?2,?3, … ,?? < T

In: Finance

A symphony orchestra is preparing to stage a short concert series. The first program in the...

A symphony orchestra is preparing to stage a short concert series. The first program in the series consists of music by Berlioz and Tchaikovsky, while the second program comprises music by Bartok and Stravinsky. The potential audience for the series can be thought of as divided into four,equal-sized groups. Members of the first group, whose tastes tend to the romantic, would be willing to pay up to $40 for a ticket to the first concert and up to $20 for a ticket to the second concert.Members of the second group, whose tastes tend more to the neo-classical, have the opposite preference: they would pay up to $20 for a ticket to the first concert and up to $40 for a ticket to the second concert. Members of the third group, confirmed Tchaikovsky lovers, would pay as much as$45 for a ticket to the first concert, but only $5 for a ticket to the second concert. Finally, members of the fourth group, who pride themselves on their sophisticated taste, would pay as much as $45 for a ticket to the second concert, but only $5 for a ticket to the first concert. This information is summarized in Table 2

While answering these questions, please clearly state your assumptions (if any) and your justification for those assumptions.

  1. What is the best price to charge for each concert if you are not offering a single ticket for the concert series?
  2. What is the best price to charge for the concert series if you are not offering tickets for each concert separately?
  3. Now suppose you offer a single ticket for the concert series in addition to offering tickets for each concert separately. What prices will you charge for the series and each concert?
  4. Now consider the case titled "Multiproduct Pricing"? What is the best price to sell each product individually? Can the company do better by bundling?
PATRON TYPE BERLIOZ/TCHAIKOVSKY BARTOK/STRAVINSKY
ROMANTIC 40 20
NEO-CLASSICAL 20 40
TCHAIKOVSKY 45 5
SOPHISTICATE 5 45

In: Economics

In 1999, Karl Christe synthesized and characterized a salt that contained the N5+ cation, in which...

In 1999, Karl Christe synthesized and characterized a salt that contained the N5+ cation, in which the five N atoms are connected in a long chain. This cation is the first all-nitrogen species to be isolated in more than 100 years. Draw all the possible Lewis structures for this ion. Calculate the formal charges on all atoms for each resonance structure and determine which is the most important.

In: Chemistry

The Sanding Department of Quik Furniture Company has the following production and manufacturing cost data for...

The Sanding Department of Quik Furniture Company has the following production and manufacturing cost data for March 2020, the first month of operation.

Production: 7,000 units finished and transferred out; 3,000 units started that are 100% complete as to materials and 20% complete as to conversion costs.

Manufacturing costs: Materials $33,000; labor $21,000; overhead $36,000.

Prepare a production cost report.

In: Accounting

. Without using R find the median and the first quartile of the following data taken...

. Without using R find the median and the first quartile of the following data taken from a random sample of systolic blood pressures of patients measured in mmHg. What is the interquartile range?

88, 88, 92, 96, 96, 100, 102,102,104,104,105,105,105,107,107,108,110,110,110,111,111, 112,113,114, 114,115,115,116,116,117,117,117, 118,119,120,121,121, 121,121,121,121,122,122,123,123, 123, 123,123,124,124,124,124,125,125,125,126,126,126,126, 124, 125,125,125,126,126,126,126,131,133,134,135,136,136,136,138,138,139,139,141,142,142, 143,144,146,147,155,156.

Create a histogram of these data. What is the mode of the data?

In: Statistics and Probability

The Sanding Department of Quik Furniture Company has the following production and manufacturing cost data for...

The Sanding Department of Quik Furniture Company has the following production and manufacturing cost data for March 2020, the first month of operation.

Production: 6,760 units finished and transferred out; 3,000 units started that are 100% complete as to materials and 20% complete as to conversion costs.

Manufacturing costs: Materials $37,088; labor $20,800; overhead $40,656.

Prepare a production cost report.

In: Accounting