Questions
Example of how it needs to be done, one at a time instead of asking all...

Example of how it needs to be done, one at a time instead of asking all 3 at once

#include <iostream>
#include <string>
#include <time.h>

using namespace std;

int main(){
int rnum = ((rand()%3-1)+1)+1;
string car1,car2,car3;
cout << "Enter a vehicle you like:";
getline(cin, car1);
cout << "Enter a vehicle you like:";
getline(cin, car2);
cout << "Enter a vehicle you dislike:";
getline(cin,car3);
switch(rnum){
case 1:
cout<< "You will drive "<< car1 << endl;
break;
  
case 2:
cout<< "You will drive "<< car2 << endl;
break;
  
default:
cout<< "You will drive "<< car3 << endl;
}
}

The purpose of the program is to play the game of M.A.S.H. (Mansion, Apartment, Shack, House). This program asks the user multiple questions and then randomly generates answers based on the answers to predict the user’s future. By the time you finish this program, you will have learned how to make a menu based program, use switch statements, validate user input with loops, allow a program to run multiple times until user wants to quit, and mix cin>> and getline() intermittently in a program.
INPUT
1   Names of three people (2 they like & one they don’t like)
1   Three integer numbers between 1 and 100
2   Three locations including city & state (2 they like & one they don’t like)
3   Three job titles (2 they like & one they don’t like)
4   Three companies or restaurants (2 they like & one they don’t like)
5   Three integer numbers between 10000 and 500000
6   Three types of cars (2 they like & one they don’t like

RANDOM NUMBERS
You will be predicting the user’s future by selecting one of their three choices randomly. You will need to create a random number for each “category” – this means there should be in total 7 numbers randomly generated between 1 and 3. So for example, you will generate a random number between 1 and 3 for the names of people.
You will also generate one more random number (this would make 8 total) between 1 and 4 which will indicate if the user will live in a mansion (1), apartment (2), shack (3), or house(4).
OUTPUT
1   The user’s type of house (mansion, apartment, shack, or house)
2   The user’s spouse (based on the three people)
3   The number of children the user will have (based on the integer between 1 and 100)
4   Where the user will live (based on locations)
5   Where the user will work, their job title, and their salary (based on the three companies and the three integer numbers between 10000 and 500000).
6   What the user will drive. (based on cars)
SPECIFICATIONS
•   Indent and comment your code properly.

•   MENU - You will have a main menu that will ask the user to either

1) Play MASH or
2) End the program.

You must have a switch statement to figure out which choice the user selected. The program should run over and over until the user selects to end the program using a do-while loop. Use a Boolean variable to help with this!

•   You MUST validate user input with while loops if the input is a number to ensure the number is in the specified range. You may assume the user will enter in a number (not a character or string), but you can’t assume they enter a number within the specified range.


•   You MUST allow spaces to be included in all string input.

HOW TO PRINT OUT RESULTS
•   For housing you are not asking the user for the data. The acronym MASH stands for the different types of housing. There are four choices (Mansion, Apartment, Shack or House). You will need to generate a number between 1 and 4. If it is a 1, you will print out that the user will live in a mansion. If it is a 2, you will print out that the user will live in an apartment……and so on.

•   For all the other “categories” you have three choices, not four. So you will need to generate a number between 1 and 3. If it is a 1, you print out the first one, 2 the second one, and 3 the third one. For example, for spouse – generate a number between 1 and 3. If it is a 1, then print out the first person that the user said they like. If it is a 2, then print out the second person that the user said they like. If it is a 3, then print out the third person that the user dislikes. Before printing out the spouse, you should say “You will be happily married to “ and then print out the name.

•   For the answers you should say something like:
o   You will live in ….
o   You will be happily married to …
o   You and your spouse will have ….. children.
o   You will live in ….. (name city, state here)
o   You will work at ……. (place) as a ……… (job title) making $ ……… (salary) a year.
o   You will drive a ……

In: Computer Science

Suppose that we have the following supply and demand functions for gumboots in a small, open...

Suppose that we have the following supply and demand functions for gumboots in a small, open economy called Finland:
QS=-30+2p QD =60–p
where QS and QD are measured in 1000’s of pairs of gumboots. The world price of
gumboots equals $25. Which of the following is TRUE?
1) The price of gumboots in Finland is $30 per pair. Finland will neither export nor import.
2) The price of gumboots in Finland is $25 per pair. Finland will import 15,000 pairs of gumboots.
3) The price of gumboots in Finland is $25 per pair. Finland will export 15,000 pairs of gumboots.
4) The price of gumboots in Finland is $25 per pair. Finland will neither export nor import.

Suppose that a small economy called New Zealand has the following supply and demand functions for washing machines:
QS =-1000+3p QD=3000–2p
Suppose the world price equals $400. If New Zealand wished to set a prohibitive tariff, then the per unit tariff would need to be at least
1) $100
2) $200
3) $400
4) $800


Suppose that we have the following inverse supply and inverse demand functions for gumboots in a small country called New Zealand:
p = 3 + 2QS and p = 21 – QD
where QS and QD are measured in 1000’s of pairs of gumboots. The world price of gumboots equals $11. New Zealand has a tariff equal to $6 per pair of gumboots. Which of the following is TRUE?
1) The price of gumboots in New Zealand is $15 per pair. New Zealand will neither export nor import.
2) The price of gumboots in New Zealand is $17 per pair. New Zealand will export 3,000 pairs of gumboots.
3) The price of gumboots in New Zealand is $17 per pair. New Zealand will import 3,000 pairs of gumboots.
4) The price of gumboots in New Zealand is $17 per pair. New Zealand will neither export nor import.

Suppose that we have the following supply and demand functions for a small country:
QS =-8+3p QD=20–p
Suppose the world price equals 3. If the country imposes a quota of 5 units then the terms of trade gain would be
1) 0
2) 5
3) 13.75
4) 15
Explain Step by step

In: Economics

fix the code with constant expression error exrpession below in visual studio #include <iostream> #include <cstdlib>...

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...

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.

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...

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...

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...

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...

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...

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