Discuss some characteristics unique to the executive/organizational coaching model. Discuss how coaching and consulting differ from each other.
In: Psychology
How do I add an output operator to a class in C++?
The specific part of the task said to:
Define a class to hold accounts. Use the same stream variable! Write getters to access the fields in the accounts when printing. Add an output operator for your class. First, Repeat the print loop using this output operator.Now make the output operator a friend, by adding a friendprototype to your account class definition. Add a line in the output operator that prints the fields “directly”, i.e. without using the getters. The vector push_back method will be passed as temporary object defined as the argument to push_back. Repeat the filling of the vector using emplace_back and again display the contents.
Under my "class AccountClass":
I was supposed to add an "output operator". Based on the instructions above, how do you do this?
Code:
#include
#include
#include
#include
#include
#include
using namespace std;
struct Account
{
string name;
int accno;
};
class Transaction
{
private:
bool isDeposit;
int amount;
//Balance need to be static to maintain the state
across the transactions
static int balance;
public:
void deposit(int amt)
{
amount = amt;
balance += amount;
isDeposit = true;
}
void withdraw(int amt)
{
amount = amt;
balance -= amount;
isDeposit = false;
}
};
class AccountClass
{
private:
string name;
int accno;
vector vHistory;
public:
AccountClass(string nm, int acno) :name(nm),
accno(acno)
{
}
string getName()
{
return name;
}
int getaccno()
{
return accno;
}
void addTransaction(Transaction t)
{
vHistory.push_back(t);
}
};
void readandDisplayUsingStruct(string fileName=
"accounts.txt")
{
ifstream fin;
fin.open(fileName);
if (!fin.is_open())
return;
string line;
vector vAccounts;
//Read each line from the file
while (getline(fin, line))
{
stringstream ss(line);
string name;
int no;
//Split the line into name and id
using string stream
ss >> name;
ss >> no;
Account acc{ name,no };
vAccounts.push_back(acc);
}
cout << "The Read Values are" << endl;
for (Account acc : vAccounts)
{
cout << "Name : " <<
acc.name << "\n";
cout << "No : " <<
acc.accno << "\n";
}
//Clear the vector
vAccounts.clear();
fin.close();
//Again do the same operation using local variables
without Braces Initialisation.
fin.open(fileName);
if (!fin.is_open())
return;
string line1;
vector vAccounts2;
//Read each line from the file
while (getline(fin, line1))
{
stringstream ss(line1);
string name;
int no;
//Split the line into name and id
using string stream
ss >> name;
ss >> no;
Account acc;
//Explicit initialisation
acc.name = name;
acc.accno = no;
vAccounts2.push_back(acc);
}
std::cout << "The Read Values are" << endl;
for (Account acc : vAccounts)
{
std::cout << "Name : "
<< acc.name << "\n";
std::cout << "No : " <<
acc.accno << "\n";
}
fin.close();
}
void readandDisplayUsingClass(string fileName)
{
ifstream fin;
fin.open(fileName);
if (!fin.is_open())
return;
string line;
vector vAccounts;
//Read each line from the file
while (getline(fin, line))
{
stringstream ss(line);
string name;
int no;
//Split the line into name and id
using string stream
ss >> name;
ss >> no;
AccountClass acc(name, no);
vAccounts.push_back(acc);
}
std::cout << "The Read Values are" << endl;
for (AccountClass acc : vAccounts)
{
std::cout << "Name : "
<< acc.getName() << "\n";
std::cout << "No : " <<
acc.getaccno() << "\n";
}
//Clear the vector
vAccounts.clear();
fin.close();
}
int main()
{
ifstream fin;
fin.open("transactions.txt");
if (!fin.is_open())
return 0;
string line;
vector vAccounts;
//Read each line from the file
while (getline(fin, line))
{
stringstream ss(line);
string operation;
if (operation == "Deposit" ||
operation == "Withdraw")
{
int accno;
ss >>
accno;
auto itr =
std::find_if(vAccounts.begin(), vAccounts.end(),
[&](AccountClass anAccount)
{
return anAccount.getaccno()
== accno;
});
if (itr !=
vAccounts.end())
{
Transaction t;
int amount;
ss >> amount;
if (operation == "Deposit")
{
t.deposit(amount);
}
else
{
t.withdraw(amount);
}
itr->addTransaction(t);
}
}
else if (operation ==
"Account")
{
string
accName;
ss >>
accName;
auto itr =
std::find_if(vAccounts.begin(), vAccounts.end(),
[&](AccountClass anAccount)
{
return anAccount.getName() ==
accName;
});
if (itr ==
vAccounts.end())
{
int accno;
ss >> accno;
AccountClass newAccount(accName, accno);
vAccounts.push_back(newAccount);
}
}
}
}
In: Computer Science
A car accelerates from rest to 60 mph in 4.8 seconds. It then continues at constant velocity for 10 seconds. Determine the distance in the first part and in the second part. Also, what is the car's acceleration in the first part? In the 2nd part? What is it's velocity at the end of the first part( which is also maximum velocity)? (show all work)
distance1=
distance 2=
accel1=
accel2=
velocity max=
In: Physics
a.) Find the pressure difference on an airplane
wing where air flows over the upper surface with a speed of 120 m/s
and along the bottom surface with a speed of 90 m/s.
_____ Pa
b.) If the area of the wing is 25 m2,
what is the net upward force exerted on the wing?
____ N
(You may assume the density of air is fixed at 1.29
kg/m3 in this problem. Also, you may neglect the
thickness of the wing-- though could you incorporate this too, if
it was given?)
The answer is NOT a) 3.4x10^4 and b) 8.5 x 10^5. These were both incorrect.
In: Physics
Martin Software has 11.4 percent coupon bonds on the market with 18 years to maturity. The bonds make semiannual payments and currently sell for 108.5 percent of par. |
What is the current yield on the bonds? What is the YTM? |
What is the effective annual yield? |
In: Finance
Fincher Manufacturing (FM) is considering two mutually exclusive
capital investments to
utilize an idle factory owned by the firm. The first alternative
calls for manufacturing tundratorque drill bits required for the
extraction of rare earth metals from the frozen tundra of
Greenland. This proposal would generate after-tax cash inflows of
$12 million per year
beginning in one year (at date 1). Due to the current scarcity of
rare earth metals, the yearly
cash flows for this project are expected to grow by 5 percent per
year in perpetuity from date
1 on. The second alternative calls for producing the
Polycrystalline Diamond Compact bits
frequently used in horizontal drilling operations. Alternative two
will generate constant
yearly after-tax cash flows of $20 million beginning in one year
(at date 1) and remaining
constant in perpetuity. Assuming each project requires an initial
investment of $120 million:
a. Which capital investment project has the greater IRR?
b. Which project has a greater NPV if Fincher’s cost of capital is 10 percent.
c. Determine the range of estimates for Fincher’s cost of
capital for which investing in the
project having the greater IRR maximizes the value of the firm.
In: Finance
Quincy Durant, who had his 75th birthday last month, has been offered a reverse mortgage by the Selleck National Bank. The terms of the reverse mortgage call for Mr. Durant to receive a fixed monthly income payment over his remaining 10-year life expectancy, with the monthly income payment being determined by setting the future value of the monthly payments to be received by Mr. Durant equal to 90 percent of the current $400,000 value of his home. At the end of 10 years Mr. Durant expects to sell his home and repay these monthly payments along with the accrued interest on his monthly borrowings over the previous 10 years. Assuming that that the interest rate on the reverse mortgage is 4.20 percent, compare the monthly amount that Mr. Durant will receive from the reverse mortgage with the monthly payment for a conventional 10-year mortgage loan in the amount of $360,000 with a monthly compounded interest rate of 4.20 percent.?
In: Finance
Provide a description of the try .. catch statement. As part of your description you must describe how this statement can be used to handle errors and exceptions and include an example of try ... catch implemented to handle an error or exception within a Java program.
Please Don't copy from someone else.
In: Computer Science
1. Consider the seven missteps mentioned in How to mess up your agile transformation in seven easy (mis)step. The concepts Handscomb discusses in each of the missteps do have much validity. Can you think of any modern day examples of firms and/or projects that have exhibited these pitfalls? In addition, what would you have done differently?
In: Operations Management
Explain how increased technology has aided sports organizations in minimizing expenses.
In: Finance
Python
I am creating a class in python. Here is my code below:
import csv
import json
population = list()
with open('PopChange.csv', 'r') as p:
reader = csv.reader(p)
next(reader)
for line in reader:
population.append(obj.POP(line))
population.append(obj.POP(line))
class POP:
""" Extract the data """
def __init__(self, line):
self.data = line
# get elements
self.id = self.data[0].strip()
self.geography = self.data[1].strip()
self.targetGeoId = self.data[2].strip()
self.targetGeoId2 = self.data[3].strip()
self.popApr1 = self.data[4].strip()
self.popJul1 = self.data[5].strip()
self.changePop = self.data[6].strip()
The problem is, I get an error saying:
population.append(obj.POP(line))
NameError: name 'obj' is not defined
What is causing this error? Is it a module I need to import or if I do need to assign obj to something, what am I supposed to assign it to?
What I am trying to do is create a program that allows a user to load a csv file and then print the statistics of the column in the csv chosen, such as the count, mean, standard deviation, min, max, and plot a histogram.
In: Computer Science
Choose a recent food recall or restaurant food safety news story. Recent popular stories include the romaine lettuce recall, the chipotle food safety outbreak etc. Describe the cause of the incident and how they were able to trace it to the source. What illness did this lead to ?
approximately 300 words thank you
sources should be cited please
In: Psychology
Based on the course learning objectives listed below, explain the most important concepts you learned from this course and how you think you might apply these concepts in your future career? Course Objectives Outline a communication plan for a public health emergency. Identify factors involved in risk communication. Outline the principles of modern quarantine. Summarize responses to pandemics.
In: Economics
Completely and thoroughly explain how any type of Work Measurement Technique was used to determine the labor cost of their services by any Service Company that provides any type of service to its customers. A service company is any company that does some type of work for a customer, such a lawn maintenance, and although they may also include some products, such as applying fertilizer to the lawn, their primary function is providing the service, such as keeping the lawn, hedges, and flowers in an attractive condition.
In: Operations Management
In: Finance