In: Economics
fix the code with constant expression error exrpession below in visual studio
#include <iostream>
#include <cstdlib>
#include <ctime>
void insertion_sort(int array[], int size, int start);
void heap_sort(int B[], int n);
void build_max_heap(int B[], int n);
void max_heapify(int B[], int i, int n);
void quick_sort(int B[], int p, int r);
int partition(int B[], int p, int r);
int main() {
int m = 10, Nf = 20000, Ns = 1000, delta = 1000,
A[m][Nf];
for (int i = 0; i < m; i++) {
for (int j = 0; j < Nf; j++)
{
A[i][j] = rand()
% 99 + 1;
// std::cout
<< A[i][j] << " ";
}
} std::cout << std::endl;
//----------------------------------------------------------------------------------------------
int ns = 1000, nf = 20000, mnf = m * nf,
randArray[mnf], counter1 = 0;
//create array with random numbers
for (int i = 0; i < m; i++) {
for (int j = 0; j < Nf; j++)
{
randArray[counter1] = rand() % 20000 + 1;
//std::cout
<< randArray[counter1] << " ";
counter1++;
}
}std::cout << std::endl;
//more variables
int copyArray[mnf], multiplier = 1;
clock_t t5, t6;
//----------------------------------------------------------------------------------------------
//calculations for ALG1
for (int n = ns; n <= nf; n = n + delta) {
//local variables
int timeAccu = 0, counter2 = 0,
timeAvg;
for (int i = 0; i < m; i++)
{
//copy randArray
for first n values of row i
for (int j = 0;
j < n; j++) {
copyArray[counter2] = randArray[counter2];
counter2++;
}
counter2 =
counter2 + Nf - (delta * multiplier);
t5 =
clock();
insertion_sort(copyArray, n, counter2 - Nf);
t6 = clock() -
t5;
timeAccu =
timeAccu + (int)t6;
}
multiplier++;
counter2 = 0;
timeAvg = timeAccu / m;
std::cout << "The average
runtime of ALG1 for " << n << " expressions is "
<< (float)timeAvg / 1000 << " ms" <<
std::endl;
std::cout << std::endl;
}
std::cout <<
"-------------------------------------------------------------------------------------------------------"
<< std::endl;
//int multiplier = 1;
clock_t t1, t2;
for (int n = Ns; n <= Nf; n = n + delta) {
int timeAccu = 0/*, counter =
0*/;
for (int i = 0; i < m; i++)
{
int *B = new
int[n];
for (int k = 0;
k < n; k++) {
B[k] = A[i][k];
}
//counter =
counter + Nf - (delta * multiplier);
t1 =
clock();
heap_sort(B, n -
1);
t2 = clock() -
t1;
timeAccu =
timeAccu + (int)t2;
if (i == 9
&& n == 20000){
for (int poo = 0; poo < n; poo++) {
// std::cout << B[poo]
<< " ";
}
}
}
std::cout << "The average
time for ALG2 for " << n << " expressions is " <<
(float)timeAccu / 10000 << " ms" << std::endl;
std::cout << std::endl;
}
std::cout <<
"-------------------------------------------------------------------------------------------------------"
<< std::endl;
//----------------------------------------------------------------------------------------------
for (int i = 0; i < m; i++) {
for (int j = 0; j < Nf; j++)
{
A[i][j] = rand()
% 99 + 1;
// std::cout
<< A[i][j] << " ";
}
} std::cout << std::endl;
//int multiplier = 1;
clock_t t3, t4;
for (int n = Ns; n <= Nf; n = n + delta) {
int timeAccu = 0/*, counter =
0*/;
for (int i = 0; i < m; i++)
{
int *B = new
int[n];
for (int k = 0;
k < n; k++) {
B[k] = A[i][k];
}
//counter =
counter + Nf - (delta * multiplier);
t3 =
clock();
quick_sort(B, 0,
n - 1);
t4 = clock() -
t3;
timeAccu =
timeAccu + (int)t4;
if (i == 9
&& n == 20000){
for (int poo = 0; poo < n; poo++) {
// std::cout << B[poo]
<< " ";
}
}
}
std::cout << "The average
time for ALG3 for " << n << " expressions is " <<
(float)timeAccu / 10000 << " ms" << std::endl;
std::cout << std::endl;
}
}
void insertion_sort(int array[], int size, int start) {
int i, key;
for (int j = start + 1; j < start + size; j++)
{
key = array[j];
i = j - 1;
while (i >= 0 &&
array[i] > key) {
array[i + 1] =
array[i];
i = i - 1;
}
array[i + 1] = key;
}
}
void heap_sort(int B[], int n) {
int temp;
build_max_heap(B, n);
for (int i = n; i >= 1; i--) {
temp = B[0];
B[0] = B[n];
B[n] = temp;
n = n - 1;
max_heapify(B, 0, n);
}
}
void build_max_heap(int B[], int n) {
for (int i = n / 2 - 1; i >= 0; i--) {
max_heapify(B, i, n);
}
}
void max_heapify(int B[], int i, int n) {
int left = i * 2 + 1;
int right = i * 2 + 2;
int largest, temp;
if (left <= n && B[left] > B[i]) {
largest = left;
}
else largest = i;
if (right <= n && B[right] > B[largest])
{
largest = right;
}
if (largest != i) {
temp = B[i];
B[i] = B[largest];
B[largest] = temp;
max_heapify(B, largest, n);
}
}
void quick_sort(int B[], int p, int r) {
int q;
if (p < r) {
q = partition(B, p, r);
quick_sort(B, p, q - 1);
quick_sort(B, q + 1, r);
}
}
int partition(int B[], int p, int r) {
int x = B[r];
int i = p - 1;
int temp1, temp2;
for (int j = p; j <= r - 1; j++) {
if (B[j] <= x) {
i = i + 1;
temp1 =
B[i];
B[i] =
B[j];
B[j] =
temp1;
}
}
temp2 = B[i + 1];
B[i + 1] = B[r];
B[r] = temp2;
return i + 1;
}
In: Computer Science
Samford Corp. does not plan on making any dividend payments on its common stock for the next four years. The first annual dividend payment, which will be made 5 years from today, will be in the amount of $5 per share, and dividends are expected to grow at 10 percent per year thereafter. If you require a 15 percent annual return on Samford stock, what price will you pay for the stock today?
$115.00
$110.00
$64.75
$57.18
None of the Above
In: Finance
You bought 1000 shares of Micro, Inc. at 45. The stock paid a $1.35 annual dividend in the year when you purchased the stock. In subsequent years, the dividend was increased 6 percent a year. The stock price stayed at 45 for the first year and then rose 13 percent a year. If you participated in the firm’s dividend reinvestment plan, calculate the value of your stock investment after 4 years. Calculate your HPR if you sold the stock at the end of 4 years.
In: Finance
Create a ticket pricing scenario in which you have 1000 seats in your stadium, 3 price levels, and you have just held your first game. Following the game you are the box office manager, and management has asked you for the post game metrics. They would like to know what the ATP was for the game and what the drop count percentage for the game was. Present below not just your ATP and drop count percentage, but how you arrived at it.
In: Economics
Use the following information about Rat Race Home Security, Inc. to answer the questions:
Average selling price per unit $334.
Variable cost per unit $187
Units sold 317
Fixed costs $6,748
Interest expense 16,203
Based on the data above, what will be the resulting percentage change in earnings per share of Rat Race Home Security, Inc. if they expect operating profit to change 8.3 percent?
(You should calculate the degree of financial leverage first).
In: Finance
Ellis Company issues 9.0%, five-year bonds dated January 1, 2019, with a $480,000 par value. The bonds pay interest on June 30 and December 31 and are issued at a price of $499,483. The annual market rate is 8% on the issue date.
Required:
1. Compute the total bond interest expense over the bonds' life.
2. Prepare an effective interest amortization table for the bonds’ life.
3. Prepare the journal entries to record the first two interest payments.
In: Accounting
On Jan 2, Lincoln Motors issued 1,000, $1000 bonds to finance a new showroom. The bonds are 5-year, 6% bonds that pay interest on Dec 31 each year. When issued investors required 7% interest and the bonds are due on Dec 31, year 5.
a. Compute the selling price of the bonds
b. Prepare entry to record the sale of the bonds
c. prepare amortization table for bonds
d. prepare journal entry for first annual interest payment
In: Accounting
1. Perform sensitivity analysis on the following project by first finding the NPV for the base case, then for a 10% decline in quantity sold and a 10% increase in quantity sold.
Investment = $270,000 Straight line depreciation
over 3 years
quantity sold per year = 20,000
Price per unit = $20
Operating Cost = $10 per unit (all variable)
Tax rate 25% cost of capital 10%
Project will have a 3-year life
Show Work
In: Finance
CDD Corp., was organized on January 2, 2018. During the first year of operation, CDD issued 60,000 shares of $3 par value common stock at a price of $40 cash per share. On December 31, 2018, CDD reported Net Income of $200,000 and paid $40,000 cash dividends. Use this information to determine the dollar amounts that CDD will report on its year-end Balance Sheet for Paid in Capital Common Stock in Excess to par.
Acct. 220
In: Accounting