Questions
Hi, i'm creating a c++ program with a linked list of Employees, i'm running into issues...

Hi, i'm creating a c++ program with a linked list of Employees, i'm running into issues as far as displaying programmers only portion and the average salary of all the employees. Please make any changes or comments !

Employee.h file:

#ifndef EMPLOYEE_H

#define EMPLOYEE_H

#include

using namespace std;

enum Role {programmer, manager, director};

struct Employee

{

std::string firstName;

std::string lastName;

int SSN;

std::string department;

double salary;

Role role;

};

#endif

#ifndef NODE_H

#define NODE_H

Node.h file:

#include "Employee.h"

typedef Employee EMP;

struct Node

{

EMP e;

Node * next;

Node();

Node(EMP);

Node(EMP,Node* next);

};

Node::Node()

{

next=NULL;

}

Node::Node(EMP e_data)

{

e=e_data;

}

Node::Node(EMP e_data, Node* next)

{

e=e_data;

this->next= next;

}

#endif

Main cpp file:

#include <iostream>

#include <cstdlib>

#include <ctime>

#include "Employee.h"

#include "Node.h"

using namespace std;

void setSalary (Employee& emp)

{

emp.salary= 45000+rand() %20000; // generates salary for employee

}

void setRoles(Employee& emp)

{

emp.role = static_cast(rand()%3); // gives employee job title

}

void setSSN (Employee& emp)

{

// int y = x;

emp.SSN =rand()%499999999+400000000; // sets employee SSN

}

void setFirst( Employee& emp, string* name)

{

int y = rand()%5;

emp.firstName = name[y]; //gives random first name

}

void setLast(Employee& emp, string* name)

{

int y = rand()%5;

emp.lastName = name[y]; // gives random last name

}

void setDepartment(Employee& emp, string * dep)

{

int y = rand()%3;

emp.department= dep[y]; //gives employee random department

}

int main()

{

srand(time(NULL)); // random number generator

double avgSalary; // initialize Average Salary

Node* head= NULL; // starting node

Node* prev= NULL; // node next to the last one

Employee e; // object instance

// array of names, roles(job titles), and departments

string roleType [3] = {"programmer", "manager", "director"};

string firstName[5] = {"John", "James", "Joe", "Jessica", "Juno" };

string lastName[5] = {"Smith", "Williams", "Jackson", "Jones", "Johnson" };

string department[5]= {"Accounting", "IT", "Sales" };

// Create linked list of employees

for (int i = 0; i<10; i++)

{

Employee e;

// function calls (roles, salary ...etc)

setFirst(e, firstName);

setLast(e, lastName);

setSSN(e);

setSalary(e);

setRoles(e);

setDepartment(e, department);

// creates nodes for employees

Node*temp = new Node(e);

if (i ==0)

{

head=temp;

prev= temp;

}

else

{

prev->next= temp;

prev = temp; // links the nodes together

}

}

// Display information of all Employees

cout<<"======== Employee Data======="<

prev = head; // starting at the first node

while(prev !=NULL)

{

cout<<(prev->e).firstName<< " ";

cout<<(prev->e).lastName<< " ";

cout<<(prev->e).SSN<< " ";

cout<<(prev->e).salary<< " ";

cout<<(prev->e).department<< " ";

cout

prev= prev->next;

}

cout<<" \n \n";

//

cout<<"======== Programmer Only Data======="<

prev = head; // starts at beginning of linked list

while(prev !=NULL)

{

if (prev->e.role == 0) // checks to see if role is 0 or programmer

cout<<(prev->e).firstName<< " ";

cout<<(prev->e).lastName<< " ";

cout<<(prev->e).SSN<< " ";

cout<<(prev->e).salary<< " ";

cout<<(prev->e).department<< " ";

cout

prev= prev->next; // moves on to next node

// else {

// break;

// }

}

//Computes Average Salary

prev = head; // starts at the first node

while ( prev !=NULL)

{

avgSalary += (prev->e).salary;

prev = prev->next;

}

// Display Average Salary

cout<< "Average Salary: "<< (avgSalary)/5 << "\n";

// Deallocate memory

Node* temp = head;

Node* tail;

while (temp !=NULL)

{

tail=temp->next;

delete temp;

temp = tail;

}

head=NULL;

if (head == NULL )

{

cout<<" List Deleted \n";

}

}

In: Computer Science

2) This question is about providing game logic for the game of craps we developed its...

2) This question is about providing game logic for the game of craps we developed its shell in class. THe cpp of the class is attached to this project. At the end of the game,
you should ask user if wants to play another game, if so, make it happen. Otherwise quit.

Here is the attached cpp file for que2:-

/***
This is an implementation of the famous 'Game of Chance' called 'craps'.
It is a dice game. A player rolls 2 dice. Each die has sixe faces: 1, 2, 3, 4, 5, 6.
Based on the values on the dice we play the game until a player wins or loose.
You add the values of the dice's face.
1) If the sum is 7 or 11 on the first roll, the player wins.
2) If the sum is 2, 3, or 12 on the first roll, the player loses ( or the 'house' wins)
3) If the sum is 4, 5, 6, 8, 9, or 10 on the first roll, then that sum becomes the player's 'point'.
4)To win, player must continue rolling the dice until he/she 'make the point'.
5)If the player rolls a 7 he/she loses.
***/

#include <cstdlib>
#include <ctime>
#include <iostream>
#include <random>

enum class Status { CONTINUE, WON, LOST};

unsigned int rollDice(); // forward declaration of rollDice() function. It rolls 2 dice, displays the sum and return it.
unsigned int rollDiceAdvanced(); // same as above, but used advance c++ Random Number generation.

   // global variable to use in the advanced version of RNG (Random number Generator)
std::default_random_engine engine{ static_cast<unsigned int>(time(0)) };
std::uniform_int_distribution<unsigned int> randomInt{ 1, 6 };

int main()
{
   Status gameStatus; // can be CONTINUE, WON, or LOST
   unsigned int myPoint{ 0 };
   // either use the base rand() seeding
   srand(static_cast<unsigned int>(time(0))); //dandomizes rand() function.

   // but here a sample of using the random number generation:   // just testing:
   for (int i = 0; i < 20; ++i)
   {
       rollDice();
       rollDiceAdvanced();
   }

   unsigned int sumOfDice = rollDiceAdvanced(); // first roll of dice.

   // bellow the game logic: Student going to implement this.

   return 0;
}

// here is the simple version of rollDice(); throws 2 dice, each having faces 1 to 6, and return the sum.
unsigned int rollDice()
{
   unsigned int firstRoll{ 1 + static_cast<unsigned int>(rand()) % 6 }; // could be 0, 1, 2, 3, 4, 5, because 8 % 6 == 2, 7 %6 1, 9%6 == 3, 17%6 == 5, 18%6 ==0
   unsigned int secondRoll{ 1 + static_cast<unsigned int>(rand()) % 6 };
   unsigned int sum{ firstRoll + secondRoll };
   std::cout << "rollDice: " << sum << std::endl;
   return sum;
}


// this is distribution based random number generation in c++
unsigned int rollDiceAdvanced()
{
   unsigned int firstRoll{ randomInt(engine) };
   unsigned int secondRoll{ randomInt(engine) };
   unsigned int sum{ firstRoll + secondRoll };
   std::cout << "rollDiceAdvance: " << sum << std::endl;
   return sum;
}

Thanks for help

In: Computer Science

A winery decided to raise capital through IPO. The company has 1000 shares outstanding, and each...

A winery decided to raise capital through IPO. The company has 1000 shares outstanding, and each was valued at $100. CEO proposed to issue 1000 more shares. The IB set the offering price at $100 a share, the shares opened at $100, and quickly jumped to $130, the closing price on the first day of trading was $110. What was the underpricing? What is the total market value of equity in the winery after the IPO?

10%, 210 000?

30%, 210 000?

30%, 220 000?

10%, 220 000?

In: Finance

Moon (Ltd) manufacture specially treated garden benches. The following information was extracted from the budget for...

Moon (Ltd) manufacture specially treated garden benches. The following information was extracted from the budget for the year ended 29 February 2016:

Estimated sales for the financial year 2 000 units

Selling price per garden bench R450

Variable production cost per garden bench:

- Direct material - R135

- Direct labour -R90

- Overheads -R45

Fixed production overheads R127 500

Selling and administrative expenses:

- Salary of sales manager for the year - R75000

- Sales commission-10% of sales

Required: (round off answers to the nearest rand or whole number)

3.1 Calculate the break-even quantity.

3.2 Determine the break-even value using the marginal income ratio.

3.3 Calculate the margin of safety (in Rand terms).

3.4 Determine the number of sales units required to make a profit of R150 000.

3.5 Suppose Moon (Ltd) wants to make provision for a 10% increase in fixed production costs and an increase in variable overhead costs of R15 per unit. Calculate the new break-even quantity.

In: Accounting

and Medical manufactures lithotripters. Lithotripsy uses shock waves instead of surgery to eliminate kidney stones. Physicians’...

and Medical manufactures lithotripters. Lithotripsy uses shock waves instead of surgery to eliminate kidney stones. Physicians’ Leasing purchased a lithotripter from Rand for $1,920,000 and leased it to Mid-South Urologists Group, Inc., on January 1, 2018. (FV of $1, PV of $1, FVA of $1, PVA of $1, FVAD of $1 and PVAD of $1) (Use appropriate factor(s) from the tables provided.)

Lease Description:
Quarterly lease payments $ 115,119—beginning of each period
Lease term 5 years (20 quarters)
No residual value; no purchase option
Economic life of lithotripter 5 years
Implicit interest rate and lessee's incremental borrowing rate 8%
Fair value of asset $ 1,920,000


Required:
1.
How should this lease be classified by Mid-South Urologists Group and by Physicians' Leasing?
2. Prepare appropriate entries for both Mid-South Urologists Group and Physicians' Leasing from the beginning of the lease through the second rental payment on April 1, 2018. Adjusting entries are recorded at the end of each fiscal year (December 31).
3. Assume Mid-South Urologists Group leased the lithotripter directly from the manufacturer, Rand Medical, which produced the machine at a cost of $1.6 million. Prepare appropriate entries for Rand Medical from the beginning of the lease through the second lease payment on April 1, 2018.

Complete this question by entering your answers in the tabs below.

1. How should this lease be classified by Mid-South Urologists Group and by Physicians' Leasing?

Mid-South Urologists Group

Physicians’ Leasing

2. Prepare appropriate entries for both Mid-South Urologists Group and Physicians' Leasing from the beginning of the lease through the second rental payment on April 1, 2018. Adjusting entries are recorded at the end of each fiscal year (December 31). (If no entry is required for a transaction/event, select "No journal entry required" in the first account field. Enter your answers in whole dollars and not in the millions of dollars. Round your answers to nearest whole dollars.)

Requested: Lessee Journal Entry

* Record Lease Jan 01, 2018

*Record Cash Payment Jan 01, 2018

*Record Cash Payment. April 01, 2018

Requested: Lesor Journal Entry

* Record Lease Jan 01, 2018

* Record cash received.  Jan 01, 2018

* Record cash received. April 01, 2018

3. Requested: Assume Mid-South Urologists Group leased the lithotripter directly from the manufacturer, Rand Medical, which produced the machine at a cost of $1.6 million. Prepare appropriate entries for Rand Medical from the beginning of the lease through the second lease payment on April 1, 2018. (If no entry is required for a transaction/event, select "No journal entry required" in the first account field. Enter your answers in whole dollars and not in the millions of dollars. Round your answers to nearest whole dollars.)

* Record Lease Jan 01, 2018

* Record cash received.  Jan 01, 2018

* Record cash received. April 01, 2018

In: Accounting

you have $100 to spend on food and clothing. the price of food is $4, and...

you have $100 to spend on food and clothing. the price of food is $4, and the price of clothing is $10.

A. graph your budget constraint
B. suppose the government subsidizes clothing such that each unit of clothing is half price, up yo the first five units of clothing. Graph your budget constraint in this circumstance.

In: Economics

Consider the three stocks in the following table. Pt represents price at time t, and Qt...

Consider the three stocks in the following table. Pt represents price at time t, and Qt represents shares outstanding at time t. Stock C splits two for one in the last period.

P0 Q0 P1 Q1 P2 Q2

A 90 100 95 100 95 100

B 50 200 45 200 45 200

C 100 200 110 200 55 400

a. Calculate the rate of return on a price-weighted index of the three stocks for the first period ( t 5 0 to t 5 1).

b. What must happen to the divisor for the price-weighted index in year 2?

c. Calculate the rate of return for the second period ( t 5 1 to t 5 2).

In: Finance

Rand Medical manufactures lithotripters. Lithotripsy uses shock waves instead of surgery to eliminate kidney stones. Physicians’...

Rand Medical manufactures lithotripters. Lithotripsy uses shock waves instead of surgery to eliminate kidney stones. Physicians’ Leasing purchased a lithotripter from Rand for $2,000,000 and leased it to Mid-South Urologists Group, Inc., on January 1, 2016.

Lease Description:
Quarterly lease payments $130,516—beginning of each period
Lease term 5 years (20 quarters)
No residual value; no BPO
Economic life of lithotripter 5 years
Implicit interest rate and lessee’s incremental borrowing rate 12%
Fair value of asset $2,000,000

Collectibility of the lease payments is reasonably assured, and there are no lessor costs yet to be incurred.

Required:

1.  How should this lease be classified by Mid-South Urologists Group and by Physicians’ Leasing?

2.  Prepare appropriate entries for both Mid-South Urologists Group and Physicians’ Leasing from the inception of the lease through the second rental payment on April 1, 2016. Depreciation is recorded at the end of each fiscal year (December 31).

3.  Assume Mid-South Urologists Group leased the lithotripter directly from the manufacturer, Rand Medical, which produced the machine at a cost of $1.7 million. Prepare appropriate entries for Rand Medical from the inception of the lease through the second lease payment on April 1, 2016.

In: Accounting

In 1994 two researchers from the RAND Corporation in Santa Monica, California, studied the market for...

In 1994 two researchers from the RAND Corporation in Santa Monica, California, studied the market for cocaine. They estimated the average price elasticity of demand for the demand for cocaine to be 0.5 in absolute value. At the time, the federal government was increasing its spending on law enforcement to keep cocaine from getting into the country. The goals were to decrease the use of cocaine due to the public health hazards and to lower the rate of drug-related crime.

Is it likely that the government's increasing its spending on law enforcement accomplished its goals? Explain your answer

In: Economics

Formula=IF(RAND()>0.5,T.INV(RAND(),10)-2,T.INV(RAND(),10)+2 observation sample 1 1 1.37700278 2 1.827378045 3 3.479013387 4 1.382604626 5 2.572039451 6 2.38234939...

Formula=IF(RAND()>0.5,T.INV(RAND(),10)-2,T.INV(RAND(),10)+2

observation sample 1
1 1.37700278
2 1.827378045
3 3.479013387
4 1.382604626
5 2.572039451
6 2.38234939
7 0.240414349
8 -1.347432349
9 2.85777933
10 -3.379978992
11 -2.746482213
12 1.886442756
13 -1.947527669
14 1.540754548
15 -0.233174876
16 -1.104079702
17 -1.226712691
18 3.300631732
19 0.940368484
20 -1.845113569
21 -1.250733918
22 -1.392547733
23 2.478557615
24 0.823135564
25 1.630991977
sample mean 0.489827213

Use the excel spreadsheet to simulate 1000 samples of size 25 by copying cells C:3 through C:27 and pasting into rows 3 through 27 in the adjacent columns. For each sample calculate the sample mean. Then in row 28 you obtain a sample of sample means. If you copy and paste these into the column “sample of sample means” (starting with cell c:31) then the histogram counts will be automatically produced. (Using copy special and the “values” and “transpose” options.) Plug these counts into a bar chart to get a histogram. Submit only your histogram. Then create a second histogram by using only observations 1 through 8 for each sample (instead of using all 25 observations). How do the two histograms differ?

In: Statistics and Probability