Questions
Code using JAVA: must include "Main Method" for IDE testing! /** * Definition for a binary...

Code using JAVA:

must include "Main Method" for IDE testing!

/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {}
* };
*/
class Solution {
public:
vector<int> inorderTraversal(TreeNode* root) {
  
}
};

Given the root of a binary tree, return the inorder traversal of its nodes' values.

Example 1:

Input: root = [1,null,2,3]
Output: [1,3,2]

Example 2:

Input: root = []
Output: []

Example 3:

Input: root = [1]
Output: [1]

Example 4:

Input: root = [1,2]
Output: [2,1]

Example 5:

Input: root = [1,null,2]
Output: [1,2]

Constraints:

  • The number of nodes in the tree is in the range [0, 100].
  • -100 <= Node.val <= 100

In: Computer Science

In 300 words for each topic what is the best reflection statements for the following: Understand...

In 300 words for each topic what is the best reflection statements for the following: Understand your Motivation, Diversity at Work, manage your career, Behavioral Organization, TQM and Personal Profiling and Group processes

In: Psychology

This program is in C++ Please kindly make sure that the output exactly matches the test...

This program is in C++

Please kindly make sure that the output exactly matches the test case so I can vote a thumbs up. If it doesn't the program is wrong.

Test Cases and the given code are given after the prompt

Prompt:

Modify the given code to:

1.. Store the data in Binary file and access it   in Random Access mode.  

2.Replace Class with Structure for Employee and Department.

3. Inside each structure, replace all string variables with array of characters. please read the chapter 12(More about characters and strings). Though we do not have homework on this, the knowledge from this chapter will help you do the final exam project.

4. Make Employee and Department editable. That means, the user should be able to edit a given Employee and Department. Youc an allow the user to edit Employee name, age etc and assign him/her to different department. Similarly department name and department head can be changed. However, do not allow the uesr to Employee ID in Employee file and Department ID in department file.

5. Please note that the data will no longer be stored in the array as it was in the given code. Instead, it should be written to the file as soon as you collect the data from the user. If you are editing a record, read it from the file,collect new data from the user, store the record back to the file in the same place it was found inside the file. That means, the menu will not have options to save data to file or read data from file. Also, this should provide the ability for user to create unlimited number of employees and departments unlike in given code where you allowed only limited number of departments and employees.

Test Cases:

////////////////////////////////////

TEST CASE1:

Human Resources Menu
1. Create Department
2. Create Employee
3. Edit Department
4. Edit Employee
5. Display Salary Report
6. -- Quit -- 
Please make a selection : 1
Enter the NEW Department Data:
Dept ID: 1
Dept Name: Sales
Head of Dept Name: Anna

Human Resources Menu
1. Create Department
2. Create Employee
3. Edit Department
4. Edit Employee
5. Display Salary Report
6. -- Quit -- 
Please make a selection : 2
Enter the NEW Employee Data:
Employee ID: 1
Employee Name: John
Employee Salary: $45000
Employee Age: 23
Department ID: 1

Human Resources Menu
1. Create Department
2. Create Employee
3. Edit Department
4. Edit Employee
5. Display Salary Report
6. -- Quit -- 
Please make a selection : 5

Salary Report By Department

Dept         : Sales
Total Salary : $45000

Human Resources Menu
1. Create Department
2. Create Employee
3. Edit Department
4. Edit Employee
5. Display Salary Report
6. -- Quit -- 
Please make a selection : 2
Enter the NEW Employee Data:
Employee ID: 2
Employee Name: Susan
Employee Salary: $50000
Employee Age: 30
Department ID: 1

Human Resources Menu
1. Create Department
2. Create Employee
3. Edit Department
4. Edit Employee
5. Display Salary Report
6. -- Quit -- 
Please make a selection : 5

Salary Report By Department

Dept         : Sales
Total Salary : $95000

Human Resources Menu
1. Create Department
2. Create Employee
3. Edit Department
4. Edit Employee
5. Display Salary Report
6. -- Quit -- 
Please make a selection : 1
Enter the NEW Department Data:
Dept ID: 2
Dept Name: Marketing
Head of Dept Name: Marcus

Human Resources Menu
1. Create Department
2. Create Employee
3. Edit Department
4. Edit Employee
5. Display Salary Report
6. -- Quit -- 
Please make a selection : 2
Enter the NEW Employee Data:
Employee ID: 3
Employee Name: Adam
Employee Salary: $60000
Employee Age: 30
Department ID: 2

Human Resources Menu
1. Create Department
2. Create Employee
3. Edit Department
4. Edit Employee
5. Display Salary Report
6. -- Quit -- 
Please make a selection : 5

Salary Report By Department

Dept         : Sales
Total Salary : $95000

Dept         : Marketing
Total Salary : $60000

Human Resources Menu
1. Create Department
2. Create Employee
3. Edit Department
4. Edit Employee
5. Display Salary Report
6. -- Quit -- 
Please make a selection : 3
Which record to EDIT:
Please choose one of the following... 1 to 2 : 2

Display Department Details:
Dept ID     : 2
Dept Name   : Marketing
Dept Head   : Marcus

EDIT the Department Data:
Dept Name: Global Marketing
Head of Dept Name: Butler

Human Resources Menu
1. Create Department
2. Create Employee
3. Edit Department
4. Edit Employee
5. Display Salary Report
6. -- Quit -- 
Please make a selection : 5

Salary Report By Department

Dept         : Sales
Total Salary : $95000

Dept         : Global Marketing
Total Salary : $60000

Human Resources Menu
1. Create Department
2. Create Employee
3. Edit Department
4. Edit Employee
5. Display Salary Report
6. -- Quit -- 
Please make a selection : 4
Which record to EDIT:
Please choose one of the following... 1 to 3 : 3

Display Employee Details:
ID     : 3
Name   : Adam
Salary : $60000
Age    : 30
Dept   : 2

Edit the Employee Data:
Employee Name: Adam
Employee Salary: $75000
Employee Age: 31
Department ID: 1

Human Resources Menu
1. Create Department
2. Create Employee
3. Edit Department
4. Edit Employee
5. Display Salary Report
6. -- Quit -- 
Please make a selection : 5

Salary Report By Department

Dept         : Sales
Total Salary : $170000

Dept         : Global Marketing
Total Salary : $0

Human Resources Menu
1. Create Department
2. Create Employee
3. Edit Department
4. Edit Employee
5. Display Salary Report
6. -- Quit -- 
Please make a selection : 9
Please enter a valid choice (1 - 6): 6

Thank you, goodbye.

TEST CASE2:

Human Resources Menu
1. Create Department
2. Create Employee
3. Edit Department
4. Edit Employee
5. Display Salary Report
6. -- Quit -- 
Please make a selection : 1
Enter the NEW Department Data:
Dept ID: 1
Dept Name: HumanResources
Head of Dept Name: Maria

Human Resources Menu
1. Create Department
2. Create Employee
3. Edit Department
4. Edit Employee
5. Display Salary Report
6. -- Quit -- 
Please make a selection : 1
Enter the NEW Department Data:
Dept ID: 1
Please enter a unique Deptartment ID: 2
Dept Name: Marketing
Head of Dept Name: Samy

Human Resources Menu
1. Create Department
2. Create Employee
3. Edit Department
4. Edit Employee
5. Display Salary Report
6. -- Quit -- 
Please make a selection : 2
Enter the NEW Employee Data:
Employee ID: 1
Employee Name: John
Employee Salary: $45000
Employee Age: 35
Department ID: 9
Please enter an existing Deptartment ID: 1

Human Resources Menu
1. Create Department
2. Create Employee
3. Edit Department
4. Edit Employee
5. Display Salary Report
6. -- Quit -- 
Please make a selection : 2
Enter the NEW Employee Data:
Employee ID: 1
Please enter a unique Employee ID: 2
Employee Name: Susan
Employee Salary: $70000
Employee Age: 25
Department ID: 2

Human Resources Menu
1. Create Department
2. Create Employee
3. Edit Department
4. Edit Employee
5. Display Salary Report
6. -- Quit -- 
Please make a selection : 5

Salary Report By Department

Dept         : HumanResources
Total Salary : $45000

Dept         : Marketing
Total Salary : $70000

Human Resources Menu
1. Create Department
2. Create Employee
3. Edit Department
4. Edit Employee
5. Display Salary Report
6. -- Quit -- 
Please make a selection : 9
Please enter a valid choice (1 - 6): 6

Thank you, goodbye.

/////////////////////////////////////

The Given Code:

#include <iostream>

#include <string>

#include <fstream>

#include <sstream>

using namespace std;

class Depts

{ private:

int DeptID;

string DeptName;

string DeptHName;

public:

Depts() {}

Depts(int inId, string name, string headName)

{ DeptID = inId;

DeptHName = headName;

DeptName = name;

}

string getDeptHname() const

{ return DeptHName;

}

int getDeptHID() const

{ return DeptID;

}

string getDeptName() const

{ return DeptName;

}

void setDeptHName(string DeptHName)

{ this->DeptHName = DeptHName;

}

void setDeptID(int DeptID)

{ this->DeptID = DeptID;

}

void setDeptname(string DeptName)

{ this->DeptName = DeptName;

}

};

class Employee

{ private:

int empID;

string empName;

double empSalary;

double empAge;

int empDeptID;

public:

Employee() {}

Employee(int id, string name, double salary, double age, int dId)

{ empID = id;

empName = name;

empSalary = salary;

empAge = age;

empDeptID = dId;

}

string getEmploeename() const

{ return empName;

}

int getEmpDeptID() const

{ return empDeptID;

}

int getEmpID() const

{ return empID;

}

double getEmpAge() const

{ return empAge;

}

double getEmpSalary() const

{ return empSalary;

}

void setEmpName(string empName)

{ this->empName = empName;

}

void setEmpDeptID(int empDeptID)

{ this->empDeptID = empDeptID;

}

void setEmpID(int empID)

{ this->empID = empID;

}

void setEmpAge(double empAge)

{ this->empAge = empAge;

}

void setEmpSalary(double empSalary)

{ this->empSalary = empSalary;

}

};

int main()

{ Employee employees[5];

Depts departments[3];

int noOfDepartment = 0;

int noOfEmployees = 0;

int choice;

while (choice != 6)

{ cout << "1. Create Department"

"\n2. Create Employee"

"\n3. Write Out Data File"

"\n4. Read In Data File"

"\n5. Display Salary Report"

"\n6. -- Quit -- \n"

"Please make a selection : ";

cin >> choice;

if (choice == 1)

{ if (noOfDepartment == 3)

{ cout << "The array is full, you can not add any more Depts." << endl;

continue;

}

int dId;

string dName;

string dHeadName;

cout << "Please Enter Department Details:" << endl;

cout << "Department ID : ";

cin >> dId;

bool validId = true;

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

{ if (departments[i].getDeptHID() == dId)

{ cout << "Value must be unique!" << endl;

validId = false;

}

}

if (!validId)

{ continue;

}

cout << "Department Name : ";

cin >> dName;

cout << "Head of Department : ";

cin >> dHeadName;

Depts d(dId, dName, dHeadName);

departments[noOfDepartment] = d;

noOfDepartment++;

}

else if (choice == 2)

{ if (noOfEmployees == 5)

{ cout << "The array is full, you can not add any more Employees." << endl;

continue;

}

int eId;

string eName;

double eSalary;

double eAge;

int eDepartmentid;

cout << "Please Enter Employee Details:" << endl;

cout << "Employee ID : ";

cin >> eId;

bool validId = true;

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

{ if (employees[i].getEmpID() == eId)

{ cout << "Value must be unique!" << endl;

validId = false;

}

}

if (!validId)

{ continue;

}

cout << "Employee Name :";

cin >> eName;

cout << "Salary: $";

cin >> eSalary;

cout << "Age : ";

cin >> eAge;

cout << "Department ID : ";

cin >> eDepartmentid;

bool foundId = false;

while (!foundId)

{ for (int i = 0; i < noOfDepartment; i++)

{ if (departments[i].getDeptHID() == eDepartmentid)

{ foundId = true;

break;

}

}

if (!foundId)

{ cout << "Please enter a valid department ID: ";

cin >> eDepartmentid;

}

}

Employee e(eId, eName, eSalary, eAge, eDepartmentid);

employees[noOfEmployees] = e;

noOfEmployees++;

}

else if (choice == 3)

{ ofstream myfile1("departments.txt");

ofstream myfile2("employees.txt");

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

{ myfile1 << departments[i].getDeptHID() << " " << departments[i].getDeptName() << " " << departments[i].getDeptHname() << endl;

}

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

{ myfile2 << employees[i].getEmpID() << " " << employees[i].getEmploeename() << " " << employees[i].getEmpSalary() << " " << employees[i].getEmpAge() << " " << employees[i].getEmpDeptID() << endl;

}

myfile1.close();

myfile2.close();

}

else if (choice == 4)

{ ifstream infile;

string line;

int dId;

string dName;

string dHeadName;

noOfDepartment = 0;

infile.open("departments.txt");

ifstream infile2;

int eId;

string eName;

double eSalary;

double eAge;

int eDepartmentid;

noOfEmployees = 0;

infile2.open("employees.txt");

}

else if (choice == 5)

{ string name = "";

double salary = 0;

cout<<"\n";

cout<<"Salary Report By Department\n";

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

{ salary = 0;

name = departments[i].getDeptName();

for (int j = 0; j < noOfEmployees; j++)

{ if (departments[i].getDeptHID() == employees[j].getEmpDeptID())

{ salary += employees[j].getEmpSalary();

}

}

cout << "\nDept : " << name << endl;

cout << "Total Salary : $" << salary <<endl;

}

}

else {

cout<<"Thank you, goodbye.";

return 0;

}

}

}

Thank you so much, I will leave a positive rate

In: Computer Science

The Gettysburg Address President Abraham Lincoln November 19, 1863 "Fourscore and seven years ago our fathers...

The Gettysburg Address

President Abraham Lincoln

November 19, 1863

"Fourscore and seven years ago our fathers brought forth on this continent a new nation, conceived in liberty and dedicated to the proposition that all men are created equal.

Now we are engaged in a great civil war, testing whether that nation, or any nation so conceived and so dedicated, can long endure. We are met on a great battlefield of that war. We have come to dedicate a portion of that field as a final resting-place for those who here gave their lives that that nation might live. It is altogether fitting and proper that we should do this. But, in a larger sense, we cannot dedicate — we cannot consecrate — we cannot hallow — this ground. The brave men, living and dead, who struggled here have consecrated it, far above our poor power to add or detract. The world will little note, nor long remember what we say here, but it can never forget what they did here. It is for us the living, rather, to be dedicated here to the unfinished work which they who fought here have thus far so nobly advanced. It is rather for us to be here dedicated to the great task remaining before us — that from these honored dead we take increased devotion to that cause for which they gave the last full measure of devotion — that we here highly resolve that these dead shall not have died in vain — that this nation shall have a new birth of freedom and that government of the people, by the people, for the people, shall not perish from the earth."

Based on the document Gettysburg Address, what actions did enslaved people take during the Civil War and how were they treated by the Union army? How did the Emancipation Proclamation and the Gettysburg Address, change the purpose of the Civil War?

In: Operations Management

In your opinion, what are companies that use sales promotion (offline and online) effectively? Based on...

In your opinion, what are companies that use sales promotion (offline and online) effectively? Based on what we learned in Chapter 13, tell us the name of the company and its sale promotion strategies.

In: Operations Management

Coloured objects, red ones, blue ones, whatever. For this purpose, one assumes that light is waveforms...

Coloured objects, red ones, blue ones, whatever. For this purpose, one assumes that light is waveforms as opposed to particles of energy. Traditional theories state that a green object appears green because it reflects green light and absorbs other frequencies: red, likewise. What property does the substance have to cause it to reflect certain wavelengths and to absorb others? Is this related to luminescence and fluorescence?

In: Chemistry

Chi-square tests are nonparametric tests that examine nominal categories as opposed to numerical values. Consider a...

Chi-square tests are nonparametric tests that examine nominal categories as opposed to numerical values. Consider a situation in which you may want to transform numerical scores into categories. Provide a specific example of a situation in which categories are more informative than the actual values.

Suppose we had conducted an ANOVA, with individuals grouped by political affiliation (Republican, Democrat, and Other), and we were interested in how satisfied they were with the current administration. Satisfaction was measured on a scale of 1-10, so it was measured on a continuous scale. Explain what changes would be required so that you could analyze the hypothesis using a chi-square test. For instance, rather than looking at test scores as a range from 0 to 100, you could change the variable to low, medium, or high. What advantages and disadvantages do you see in using this approach? Which is the better option for this hypothesis, the parametric approach or nonparametric approach? Why?"

In: Math

Code using JAVA: must include "Main Method" for IDE testing! /** * Definition for a binary...

Code using JAVA:

must include "Main Method" for IDE testing!

/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {}
* };
*/
class Solution {
public:
vector<int> preorderTraversal(TreeNode* root) {
  
}
};

Given the root of a binary tree, return the preorder traversal of its nodes' values.

Example 1:

Input: root = [1,null,2,3]
Output: [1,2,3]

Example 2:

Input: root = []
Output: []

Example 3:

Input: root = [1]
Output: [1]

Example 4:

Input: root = [1,2]
Output: [1,2]

Example 5:

Input: root = [1,null,2]
Output: [1,2]

Constraints:

  • The number of nodes in the tree is in the range [0, 100].
  • -100 <= Node.val <= 100

In: Computer Science

   Consulting: INITIAL INTERVIEW You are a CEO (Michelle Royal) of Goodwill Industries of Boston, which...

  

Consulting: INITIAL INTERVIEW

You are a CEO (Michelle Royal) of Goodwill Industries of Boston, which serves twelve locations in the greater Boston area.  Overall, the stores are doing very well but you know they can be more successful and productive.  For example, you have experienced positive retail revenue growth over the past three years; however, the growth was still lower than the average and your donor volume is down. On the other hand, your sales per square foot outperformed the national average.

Consequently, you called Headquarters (HQ) and investigated the possibility of having a consultant come to Boston to review your situation and give recommendations for improvement.  You were talking to the CEO in Chicago and she explained that she found the consulting to be a very helpful exercise.  The contact at HQ asked you a few questions and said that Jane/Joe Reynolds, an inhouse retail consultant, would be giving you a call.

You have been in your position for one year.  You did not have any previous retail experience before taking the Goodwill position.  You have pretty much continued the work of your predecessor and have tried to remain very independent and creative.  For example, you and your staff like to create your own signage as opposed to using the standard Goodwill prototypes. Your expertise is finance and you have been able to implement and maintain excellent financial reports.

You suspect that improvement can be made through increased efficiency and production.

Some areas that you think might need attention:  merchandise layout, pricing, sorting and processing, transportation.  Furthermore, your new Retail Manager thinks one of your store managers might be ineffective. Your style has been rather formal.  You tend to work one-on-one with your key managers and supervisors.

Though you want help (you really want to surpass all Goodwill averages), you are concerned about having a consultant come and "snoop around."  You realize that this is the only way, however, so you decide to talk to the consultant and see what he suggests in terms of coming to Boston.  You are very concerned about how he/she is going to go about the project.  You would like to keep things very quiet, not involve too many people, and not stir things up.  After all, it seems to you that things are going generally well.

Background info: The mission of Goodwill is to provide work for underprivileged and to do that through retail stores. The underprivileged are trained for a period of time by working in the stores and then sent out into the broader marketplace. Consequently, the Goodwill Stores (collecting old stuff and selling it), is only a means for the real mission.

Goodwill HQ has a team of internal consultants, each with different areas of expertise, who are available to travel to the different locations when they need help. The individual Goodwill locations are independent and are “loosely” tied to HQ, more as nonprofit associations, not industry. Consequently, the CEOs of the various Goodwill locations want assistance but also want to remain independent—the classic “push-pull” that consultants encounter.

Assignment:

You are the Goodwill HQ Consultant that Michelle calls. Since she is in Boston and you are in D.C., you decide to conduct the conversations (which you two have formally scheduled) through visual WEBX so you can see one another faces.

Brainstorm and jot down how you would go about the interview. Following the information in your consulting packet on how to conduct the exploratory phase of formulating an intervention, what questions would you ask? How would you explain your role and the parameters of the consulting arrangement? How would you gain Michelle’s trust? What kind of resistance do you think she will demonstrate? How will you handle that resistance?

Then, actually write out an entire conversation, making it up as you go, demonstrating the skills sets that you know you have to demonstrate. Have Michelle challenge you and deal with her resistance and getting through all phases of the exploratory phase. End the session by summarizing next steps.

You:

Michelle:

You:

Michelle:

Etc.

In: Operations Management

This is the last discussion. 1) Where do you see technology leading us in terms of...

This is the last discussion.

1) Where do you see technology leading us in terms of the future?

2) Identify a device (anything that has a CPU) that we use every day that is not protected and subject to being hacked?

3) What do you recommend to protect the device?

Please answer this question ASAP. I need it very badly.

In: Computer Science

Explain how would Nike manage their inventory and whether an adaptation of the Economic order quantity...

Explain how would Nike manage their inventory and whether an adaptation of the Economic order quantity model would be useful for them.

In: Operations Management

Sales personnel for Skillings Distributors submit weekly reports listing the customer contacts made during the week....

Sales personnel for Skillings Distributors submit weekly reports listing the customer contacts made during the week. A sample of 65 weekly reports showed a sample mean of 17.5 customer contacts per week. The sample standard deviation was 5.4. Provide 90% and 95% confidence intervals for the population mean number of weekly customer contacts for the sales personnel.

90% confidence interval, to 2 decimals:

( ,  )

95% confidence interval, to 2 decimals:

( , )

In: Math

Jenny had discovered some new friends on the Internet—friends who shared her interest in programming. One...

Jenny had discovered some new friends on the Internet—friends who shared her interest in programming. One of these new friends sent her a link to a new warez (illegally copied software) site.

She downloaded a kit called Blendo from the warez site. Blendo is a tool that helps novice hackers create attack programs that combine a mass e-mailer with a worm, a macro virus, and a network scanner. She clicked her way through the configuration options, clicked a button labeled “custom scripts,” and pasted in a script that one of her new friends had e-mailed to her. This script was built to exploit a brand-new vulnerability (announced only a few hours before).

Although she didn’t know it, the anonymous high-schooler had created new malware that was soon to bring large segments of the Internet to a standstill.

She exported the attack script, attached it to an e-mail, and sent it to an anonymous remailer service to be forwarded to as many e-mail accounts as possible. She had naively set up a mailback option to an anonymous e-mail account so she could track the progress of her creation. Thirty minutes later, she checked that anonymous e-mail account and saw that she had more than 800,000 new messages; the only reason there were not even more messages was that her mailbox was full.

Required:

Evaluate the ethical issues as described in the scenario.

(1000 to 1200 words)

In: Computer Science

In 1943 Abraham Maslow proposed that individuals have five basic needs, arranged in a hierarchy from...

In 1943 Abraham Maslow proposed that individuals have five basic needs, arranged in a hierarchy from lowest to highest they are physiological, safety, love, esteem, and self-actualization. David McClelland focused on a needs-based theory which proposed that individuals have three basic needs: the need for achievement, the need for affiliation, and the need for power. The needs described in both these theories are often used by managers during the motivation and goal-setting process with employees.

  1. Why do you believe it is important to understand the needs of your employees? How will this benefit the organization?
  2. As a manager what are the basic needs that could be fulfilled by the organization if the Maslow theory is used? What are the needs that fall in line with the McClelland theory?
  3. How can the needs listed be turned into motivation to help the employee succeed?

In: Operations Management

Develop a Code of Ethics for Correction Officers. After each Code point, explain why you include...

Develop a Code of Ethics for Correction Officers. After each Code point, explain why you include that particular point of the Code of Ethics.

In: Psychology