Questions
Harvey Hogan was in his 31st year as Director of Athletics at Wilson College, a coeducational,...

Harvey Hogan was in his 31st year as Director of Athletics at Wilson College, a coeducational, private liberal arts college that offered 16 sports and was a member of the Champions Intercollegiate Athletics Conference (CIAC). Mr. Hogan was proud of the fact that, although his budget was the smallest in the conference (which consisted of 10 schools), he had always operated in the black.

    However, the college faced some serious financial issues in the current school year due to a drop in enrollment during the spring semester. As a result, the Chief Financial Officer (CFO) told all department heads that their individual budgets could NOT go over what had been appropriated at the start of the year.

     Mr. Hogan met with the coaching staff and apprised them of the financial crisis that faced the college. He asked for their help but really did not foresee a problem since the Athletics Department had never gone over budget in his previous 30 years.

     On June 30th, the fiscal year ended and the CFO (Ms. Newman) put an emergency call into Mr. Hogan. She scheduled a meeting with him so he could explain why he was over budget by $12,000.00. She told him that 4 sports had exceeded their budgets—men’s lacrosse, women’s volleyball, men’s tennis, and football.

     When Mr. Hogan returned to his office he immediately called each coach and scheduled meetings with them. According to the women’s volleyball coach, she had failed to check her monthly computer printouts because she was “too busy coaching and recruiting” to spend time on the printout. She said she was sure she stayed within her budget and did not overspend. After some investigating by Mr. Hogan, the coach admitted that she had been asked to serve as a chaperone for the intramural flag football team which travelled to New Orleans for the national tournament. She had transferred some volleyball funds to their account to help them cover their costs. She also paid for their uniforms, but indicated that it was the first time she had ever gone over budget.

     The football coach was also shocked to learn he was over budget by $5000.00. He discovered that the company that washed the team practice and game uniforms failed to send a monthly statement as he had requested. Instead, the owner of the cleaning company waited until the end of the school year to send a bill for $5000.00. Moreover, in previous years several football student athletes who were offered grants-in-aid did not report for practice choosing to enroll at other institutions. The coach assumed this would happen again. However, every scholarship athlete reported for practice which put him over by two grants ($40,000.00). While he was still in compliance with the conference, he was above the institutions limit.

     The men’s tennis coach has always ignored Ms. Newman’s directive to turn in all receipts by June 1st. Instead, he regularly procrastinated until as late as mid-July when he would turn in receipts for the national tournament held in May. He was $2000.00 over budget.

     Men’s lacrosse exceeded its budget because the coach, who had built a nationally ranked team, had decided to take a trip north to play several games over spring break. He had no other excuse except that he felt the tough competition would help his national ranking and bring good publicity to the college and help his recruiting.

     In addition to these problems, another serious one surfaced. The track and field coach wanted a new computer. When he was told that the request would not be approved until the next year, he worked out a deal with a local computer store. The salesperson agreed to let him get a computer and hold the bill until the next year when he was told he could purchase the computer. Unfortunately, the salesperson was fired and the store owner demanded payment immediately.

     The final frustration came when 12 dozen pairs of athletic socks arrived. The bill had no identifiers on it so Mr. Hogan could not tell who ordered them. No one would admit it and it was a mystery as to how the purchase order got through the business office without the approval of the Athletics Director, Mr. Hogan.

     In the next meeting that Ms. Newman had with Mr. Hogan, she was furious. She asked Mr. Hogan “who is in control of the Athletics Department budget—you or your coaches!” What should Mr. Hogan do?

Questions for Discussion

  1. It’s now the middle of July. What can Mr. Hogan do, if anything, about what happened in the last fiscal year? (5 pts.)
  1. Make a list of all of the problems you see in the situation above. (10 pts.)
  1. Describe how Mr. Hogan can remedy those problems to prevent them from happening in the future. (20 pts.)

In: Finance

Shaleen: Pregnancy & Lactation Case Study (10 pts.) Instructions: This case study assignment should be treated...

Shaleen: Pregnancy & Lactation Case Study (10 pts.) Instructions: This case study assignment should be treated as a short paper, including a cover page, a heading, and page numbers. Set up the paper with one-inch margins, double-spacing, with the font set at 12-point Times New Roman. The introduction to the paper should summarize the case you have chosen to discuss. Responses to the case study questions should be written in paragraph form. Each paragraph in the case study should begin with an introductory statement that lets the reader know what topic you will be addressing in the paragraph. For example, if the case study question asks, “What nutrients are deficient in Shaleen’s diet, based on her current diet history?” You might start the discussion in this paragraph by indicating: “Shaleen has X nutritional deficiencies, based on her diet history. Her current diet consists of XXXXX. She is deficient in XXXXX.” The paragraph would continue with the explanation (or rationale) for your response: “According to Rolfe et al. (2012), a 16-year-old requires XXXXX. Because she is pregnant, she also XXXXX and so on. Scenario: Shaleen is a 16-year-old inner-city youth and high school student. She requests a pregnancy test at the Public Health Clinic. The pregnancy test is positive and she informs the clinic that her last menstrual period was 8 weeks ago. Previous History: Shaleen has had two previous pregnancies, one a stillbirth in which she gained 15 pounds and the baby weighed 4 pounds at term. The other ended due to a miscarriage at 9 weeks gestation and occurred 6 months ago. Her first pregnancy was at the age of 13. Social History: Lives at home with her mother and 5 siblings. Her mother provides the only income as a third shift waitress at a local 24-hour restaurant. The family receives $200 per month in food stamps. You speak with Shaleen at the Public Health Clinic after she receives the positive results of her pregnancy test. A brief diet and health history indicates the following information. She is a three-year smoker and is constantly concerned about her weight. Her diet consists mainly of diet cola, pizza, burgers, hot dogs, and convenience pasta dishes like Spaghetti-Os. She does get school lunch for free because of her family income level but rarely eats the fruits and vegetables or drinks the milk. Since Shaleen is the eldest sibling, she prepares meals for her younger siblings and sometimes does not have time herself to eat what has been prepared. Physical Exam: Ht = 5’6” Usual Wt = 108 lbs. Present Wt = 110 lbs. BMI = BP = 118/76 Blood glucose = 100 Shaleen’s pregnancy progresses without any problems until at 30 weeks her physician becomes concerned because her blood pressure has risen to 140/95, her blood glucose is 180, and she has gained 7 lbs. in two weeks. She is showing signs of generalized edema and she has protein and ketones in her urine. Her weight at this time is 118 lbs. Questions:

1) Based on her current diet, identify 5 nutrients she is likely to be deficient in and why they are important during pregnancy.

2) Suggest general changes Shaleen should have made in her diet at the start of her pregnancy. Use the MyPlate Food Guide as your reference.

3) Evaluate her weight gain at 8 weeks and 30 weeks of gestation. What do her current weight gain pattern, blood glucose levels, and BP indicate? How much total weight should Shaleen have tried to gain with this pregnancy? What pattern of weight gain would you recommend for the remainder of the pregnancy?

4) Calculate her approximate caloric and protein needs at 30 weeks.

5) Using the MyPlate system as a basis, outline a diet regimen that Shaleen should follow to achieve the weight gain recommendations from #4 above.

6) As a teenager, Shaleen is probably exposed to the peer pressure of alcohol consumption. What types of concerns should you make Shaleen aware of with alcohol intake during pregnancy? What is the recommendation for alcohol intake during pregnancy for any woman?

7) How could Shaleen best ensure adequate nutrition for her newborn? What arguments would you use in favor of this method when consulting with Shaleen?

8) How would her caloric and nutrient needs change if she decided to breastfeed? What general dietary recommendations should be given to ensure that these nutrient changes are met?

9) If she decides to formula feed, how much should she offer and are there any cautionary points that she should be concerned about with this method of feeding? How does this food choice differ from breast milk?

10) At what point should her infant be introduced to solid foods? Outline a timeline for the introduction of these foods with appropriate suggestions for each new food.

In: Nursing

Item 1 In the case below, the original source material is given along with a sample...

Item 1

In the case below, the original source material is given along with a sample of student work. Determine the type of plagiarism by clicking the appropriate radio button.

Original Source Material

Student Version

Merck, in fact, epitomizes the ideological nature--the pragmatic idealism--of highly visionary companies. Our research showed that a fundamental element in the "ticking clock" of a visionary company is a core ideology--core values and a sense of purpose beyond just making money--that guides and inspires people throughout the organization and remains relatively fixed for long periods of time.

References:
Collins, J. C., & Porras, J. I. (2002). Built to last: Successful habits of visionary companies. New York, NY: Harper Paperbacks.

Research conducted by Collins and Porras (2002) highlights the importance of establishing and committing to an ideology comprised of two parts: (1) core values; (2) a core purpose. In my personal experience it seems easier to define a core ideology than to live it consistently.

References:
Collins, J. C., & Porras, J. I. (2002). Built to last: Successful habits of visionary companies. New York, NY: Harper Paperbacks.

Which of the following is true for the Student Version above?

Word-for-Word plagiarism

Paraphrasing plagiarism

This is not plagiarism

Hints

Item 2

In the case below, the original source material is given along with a sample of student work. Determine the type of plagiarism by clicking the appropriate radio button.

Original Source Material

Student Version

The philosophical position known as constructivism views knowledge as a human construction. The various perspectives within constructivism are based on the premise that knowledge is not part of an objective, external reality that is separate from the individual. Instead, human knowledge, whether the bodies of content in public disciplines (such as mathematics or sociology) or knowledge of the individual learner, is a human construction.

References:
Gredler, M. E. (2001). Learning and instruction: Theory into practice (4th Ed.). Upper Saddle River, NJ: Prentice-Hall.

Does knowledge exist outside of, or separate from, the individual who knows? Constructivists argue that human knowledge, such as what is known in the fields of mathematics or sociology, as well as knowledge about learning itself, is a human construction (Gredler, 2001).



References:
Gredler, M. E. (2001). Learning and instruction: Theory into practice (4th Ed.). Upper Saddle River, NJ: Prentice-Hall.

Which of the following is true for the Student Version above?

Word-for-Word plagiarism

Paraphrasing plagiarism

This is not plagiarism

Hints

Item 3

In the case below, the original source material is given along with a sample of student work. Determine the type of plagiarism by clicking the appropriate radio button.

Original Source Material

Student Version

There is a design methodology called rapid prototyping, which has been used successfully in software engineering. Given similarities between software design and instructional design, we argue that rapid prototyping is a viable method for instructional design, especially for computer-based instruction.

References:
Tripp, S. D., & Bichelmeyer, B. A. (1990). Rapid prototyping: An alternative instructional design strategy. Educational Technology Research and Development, 38(1), 31-44.

Rapid prototyping could be an advantageous methodology for developing innovative computer-based instruction. Software engineers have been successful in designing applications by using rapid prototyping. So it also could be an efficient way to do instructional design.

References:
Tripp, S. D., & Bichelmeyer, B. A. (1990). Rapid prototyping: An alternative instructional design strategy. Educational Technology Research and Development, 38(1), 31-44.

Which of the following is true for the Student Version above?

Word-for-Word plagiarism

Paraphrasing plagiarism

This is not plagiarism

Hints

Item 4

In the case below, the original source material is given along with a sample of student work. Determine the type of plagiarism by clicking the appropriate radio button.

Original Source Material

Student Version

A teacher is one who guides or leads. To guide does not necessarily mean to instruct directly. We often think of teaching as direct instruction (presenting information, asking questions, giving feedback, demonstrating some procedure, evaluating student progress, and so on). But a teacher can guide without instructing directly. A good example is the Montessori system of education. In a Montessori school, most of what a child learns is through interacting with a variety of curriculum materials in a particular context. A Montessori teacher does much less direct instruction than do teachers in traditional schools.

References:
Frick, T. (1991). Restructuring education through technology. Bloomington, IN: Phi Delta Kappa Educational Foundation.

Teachers should be guides or leaders. In the role of a guide, a teacher does less presenting of information, demonstrating and providing feedback. For example, in a Montessori school, most student learning occurs through interaction with a variety of class materials, rather than interaction with a teacher.

Which of the following is true for the Student Version above?

Word-for-Word plagiarism

Paraphrasing plagiarism

This is not plagiarism

Hints

In: Psychology

Crystal is a happy 8‐year‐old who is just finishing Grade three. Like most parents, Crystal’s parents...

Crystal is a happy 8‐year‐old who is just finishing Grade three. Like most parents, Crystal’s parents were worried about how she would react to school and how others would respond to her. They did not have to be worried as Crystal adjust well and she made many friends. She is also succeeding academically, not only fulfilling the curriculum objectives but also surpassing them. For example, Crystal began reading in pre‐primary, an activity that usually begins in Grade one. Part of the reason that Crystal does so well in school is because her parents are quick to praise her scholastic efforts and help her with schoolwork if she has difficulty. Crystal has always been a relatively easy child to take care of. When she was a baby, her mother nursed her on demand and found that she did not demand to be fed often. Even after waking up in the morning, Crystal did not cry hysterically for food and her mom met her needs efficiently. Potty training was not terribly stressful either. Neither Crystal’s mother nor her father felt that they should rush the child into potty training. They believed that the child would eventually learn control and it was the parent’s role to introduce the idea of using the potty to the child and to encourage her, but not force her into using it if she was not ready. Crystal’s parents tried not to embarrass her when she had accidents, instead they reminded her to try and remember to use the potty the next time. This approach worked well for Crystal and she learnt to use the potty when she was about two‐and‐a‐half years old without much hassle. Crystal’s parents took this approach for helping her reach her other milestones. They encouraged her to do things like walk, hold a spoon and feed herself. They tried to make the activities easier for her by practicing the activities with her and showing her how to do something and sometimes buying things that would make it easier for her to learn new skills, such as a curved spoon that allowed her to feed herself without making too much of a mess. Crystal’s parents did not rush her into learning new skills, although sometimes it was difficult not to. When an activity was too difficult for her, they would put it aside and allow her to try again at a later stage. As Crystal got older, her parents tried not to dictate her play activities. Instead they gave her a couple of choices and let her choose what she preferred. Many times her parents did not even need to do this, because often, Crystal would go off on her own and amuse herself. Sometimes she would go and look at pictures in her books, or play with her dolls or her Legos. The only time Crystal’s parents had some trouble with her was when her younger sister was born. Crystal’s younger sister was a demanding baby born via Cesearean section so her mother had been limited psychically in what she could do with Crystal and in the time she could spend with her. Crystal tried to express affection towards the baby but sometimes would hug her too hard. Crystal’s mother was not sure if this was done on purpose or not but she would tell Crystal that she was being too rough and show her how to hold the baby. She thought Crystal was jealous of the baby as she would say things like “ Mommy, you are always holding the baby.” Crystal also started to stutter. Crystal’s mother would reassure her by saying “I know you feel like the baby has all of Mommy’s attention but I held you this much when you were a baby too.” Her mother tried to be understanding of Crystal’s jealousy and did not try to make her feel bad about it. When her mother was feeling better, she was able to spend more time with Crystal and the stuttering eventually went away. Crystal also became gentler with the baby. Using Erikson’s psychosocial stages of development analyse Crystal’s life by answering the following questions with reference to each of the four stages: Q.5.1 Providing examples from the case study, identify and explain what is the crisis experienced by Crystal in Q.5.1.1 Erikson’s first stage of psychosocial development? (4) Q.5.1.2 Erikson’s second stage of psychosocial development? (4) Q.5.1.3 Erikson’s third stage of psychosocial development? (4) Q.5.1.4 Erikson’s fourth stage of psychosocial development? (4) Q.5.2 Based on the case study provided, identify and define the parenting styles and attachment styles employed by Crystal’s parents and detail whether these had favourable or unfavourable outcomes on Crystal’s behaviour. Use examples from the case study.

In: Psychology

1.) SkyChefs, Inc., prepares in-flight meals for a number of major airlines. One of the company’s...

1.) SkyChefs, Inc., prepares in-flight meals for a number of major airlines. One of the company’s products is grilled salmon in dill sauce with baby new potatoes and spring vegetables. During the most recent week, the company prepared 7,000 of these meals using 2,700 direct labor-hours. The company paid its direct labor workers a total of $27,000 for this work, or $10.00 per hour.

According to the standard cost card for this meal, it should require 0.40 direct labor-hours at a cost of $9.30 per hour.

Required:

1. What is the standard labor-hours allowed (SH) to prepare 7,000 meals?

2. What is the standard labor cost allowed (SH × SR) to prepare 7,000 meals?

3. What is the labor spending variance?

4. What is the labor rate variance and the labor efficiency variance?

(For requirements 3 and 4, indicate the effect of each variance by selecting "F" for favorable, "U" for unfavorable, and "None" for no effect (i.e., zero variance). Input all amounts as positive values. Do not round intermediate calculations.)

2.)

The Gourmand Cooking School runs short cooking courses at its small campus. Management has identified two cost drivers it uses in its budgeting and performance reports—the number of courses and the total number of students. For example, the school might run two courses in a month and have a total of 62 students enrolled in those two courses. Data concerning the company’s cost formulas appear below:

Fixed Cost per Month Cost per Course Cost per
Student
Instructor wages $ 2,950
Classroom supplies $ 290
Utilities $ 1,240 $ 55
Campus rent $ 5,200
Insurance $ 2,400
Administrative expenses $ 3,800 $ 40 $ 6

For example, administrative expenses should be $3,800 per month plus $40 per course plus $6 per student. The company’s sales should average $860 per student.

The company planned to run four courses with a total of 62 students; however, it actually ran four courses with a total of only 54 students. The actual operating results for September appear below:

Actual
Revenue $ 50,420
Instructor wages $ 11,080
Classroom supplies $ 17,830
Utilities $ 1,870
Campus rent $ 5,200
Insurance $ 2,540
Administrative expenses $ 3,758

Required:

1. Prepare the company’s planning budget for September.

2. Prepare the company’s flexible budget for September.

3. Calculate the revenue and spending variances for September.

3.)

Dawson Toys, Ltd., produces a toy called the Maze. The company has recently created a standard cost system to help control costs and has established the following standards for the Maze toy:

Direct materials: 7 microns per toy at $0.34 per micron

Direct labor: 1.2 hours per toy at $7.20 per hour

During July, the company produced 4,900 Maze toys. The toy's production data for the month are as follows:

Direct materials: 70,000 microns were purchased at a cost of $0.32 per micron. 27,125 of these microns were still in inventory at the end of the month.

Direct labor: 6,280 direct labor-hours were worked at a cost of $49,612.

Required:

1. Compute the following variances for July: (Indicate the effect of each variance by selecting "F" for favorable, "U" for unfavorable, and "None" for no effect (i.e., zero variance). Input all amounts as positive values. Do not round intermediate calculations. Round final answers to the nearest whole dollar amount.)

a. The materials price and quantity variances.

b. The labor rate and efficiency variances.

4.)

You have just been hired by FAB Corporation, the manufacturer of a revolutionary new garage door opening device. The president has asked that you review the company’s costing system and “do what you can to help us get better control of our manufacturing overhead costs.” You find that the company has never used a flexible budget, and you suggest that preparing such a budget would be an excellent first step in overhead planning and control.

After much effort and analysis, you determined the following cost formulas and gathered the following actual cost data for March:

Cost Formula Actual Cost in March
Utilities $17,000 plus $0.21 per machine-hour $ 22,370
Maintenance $38,900 plus $2.00 per machine-hour $ 66,700
Supplies $0.70 per machine-hour $ 11,700
Indirect labor $94,800 plus $1.90 per machine-hour $ 128,000
Depreciation $68,100 $ 69,800

During March, the company worked 15,000 machine-hours and produced 9,000 units. The company had originally planned to work 17,000 machine-hours during March.

Required:

1. Prepare a flexible budget for March.

2. Prepare a report showing the spending variances for March.

In: Accounting

JAVA- Modify the LinkedList1 class presented in this chapter by adding sort() and reverse() methods. The...

JAVA-

Modify the LinkedList1 class presented in this chapter by adding sort() and reverse() methods. The reverse method reverses the order of the elements in the list, and the sort method rearranges the elements in the list so they are sorted in alphabetical order. The class should use recursion to implement the sort and reverse operations. Extend the graphical interface in the LinkedList1Demo class to support sort and reverse commands, and use it to test the new methods.

LinkedList1:

class LinkedList1
{
  
private class Node
{
String value;
Node next;
  
  
  
Node(String val, Node n)
{
value = val;
next = n;
}
  
  
  
Node(String val)
{
// Call the other (sister) constructor.
this(val, null);
}
}
  
private Node first; // list head
private Node last; // last element in list
  
  
public LinkedList1()
{
first = null;
last = null;
}
  
public boolean isEmpty()
{
return first == null;
}
  
public int size()
{
int count = 0;
Node p = first;
while (p != null)
{
// There is an element at p
count ++;
p = p.next;
}
return count;
}
  
public void add(String e)
{
if (isEmpty())
{
first = new Node(e);
last = first;
}
else
{
// Add to end of existing list
last.next = new Node(e);
last = last.next;
}
}
  
public void add(int index, String e)
{
if (index < 0 || index > size())
{
String message = String.valueOf(index);
throw new IndexOutOfBoundsException(message);
}
  
// Index is at least 0
if (index == 0)
{
// New element goes at beginning
first = new Node(e, first);
if (last == null)
last = first;
return;
}
  
  
Node pred = first;
for (int k = 1; k <= index - 1; k++)
{
pred = pred.next;
}
  
  
pred.next = new Node(e, pred.next);
  
  
if (pred.next.next == null)
last = pred.next;
}
  
public String toString()
{
StringBuilder strBuilder = new StringBuilder();
  
Node p = first;
while (p != null)
{
strBuilder.append(p.value + "\n");
p = p.next;
}
return strBuilder.toString();
}
  
public String remove(int index)
{
if (index < 0 || index >= size())
{
String message = String.valueOf(index);
throw new IndexOutOfBoundsException(message);
}
  
String element; // The element to return
if (index == 0)
{
// Removal of first item in the list
element = first.value;
first = first.next;
if (first == null)
last = null;
}
else
{
  
Node pred = first;
  
  
for (int k = 1; k <= index -1; k++)
pred = pred.next;
  
  
element = pred.next.value;
  
  
pred.next = pred.next.next;
  
  
if (pred.next == null)
last = pred;
}
return element;
}
  
public boolean remove(String element)
{
if (isEmpty())
return false;
  
if (element.equals(first.value))
{
  
first = first.next;
if (first == null)
last = null;
return true;
}
  
  
Node pred = first;
while (pred.next != null &&
!pred.next.value.equals(element))
{
pred = pred.next;
}
  
  
if (pred.next == null)
return false;
  
  
pred.next = pred.next.next;
  
// Check if pred is now last
if (pred.next == null)
last = pred;
  
return true;
}

LinkedList1Demo:

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.util.*;


/**
This class is used to demonstrate
the operations in the LinkedList1 class.
*/


public class LinkedList1Demo extends JFrame
{   
private LinkedList1 ll;
private JTextArea listView;
private JTextField cmdTextField;
private JTextField resultTextField;
  
public LinkedList1Demo()
{
ll = new LinkedList1();
listView = new JTextArea();
cmdTextField = new JTextField();
resultTextField = new JTextField();
  
// Create a panel and label for result field
JPanel resultPanel = new JPanel(new GridLayout(1,2));
resultPanel.add(new JLabel("Command Result"));
resultPanel.add(resultTextField);
resultTextField.setEditable(false);
add(resultPanel, BorderLayout.NORTH);
  
// Put the textArea in the center of the frame
add(listView);
listView.setEditable(false);
listView.setBackground(Color.WHITE);
  
// Create a panel and label for the command text field
JPanel cmdPanel = new JPanel(new GridLayout(1,2));
cmdPanel.add(new JLabel("Command:"));
cmdPanel.add(cmdTextField);
add(cmdPanel, BorderLayout.SOUTH);  
cmdTextField.addActionListener(new CmdTextListener());
  
// Set up the frame
setTitle("Linked List Demo");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
pack();
setVisible(true);
}
  
/**
Private class that responds to the command that
the user types into the command entry text field.
*/
  
private class CmdTextListener
implements ActionListener
{   
public void actionPerformed(ActionEvent evt)
{
String cmdText = cmdTextField.getText();
Scanner sc = new Scanner(cmdText);
String cmd = sc.next();
if (cmd.equals("add"))
{
if (sc.hasNextInt())
{
// add index element
int index = sc.nextInt();
String element = sc.next();
ll.add(index, element);   
}
else
{  
// add element
String element = sc.next();
ll.add(element);   
}
listView.setText(ll.toString());
pack();
return;
}
if (cmd.equals("remove"))
{
if (sc.hasNextInt())
{
// remove index
int index = sc.nextInt();
String res = ll.remove(index);
resultTextField.setText(res);   
}
else
{
// remove element
String element = sc.next();
boolean res = ll.remove(element);
String resText = String.valueOf(res);
resultTextField.setText(resText);
}
listView.setText(ll.toString());
pack();
return;
}
if (cmd.equals("isempty"))
{
String resText = String.valueOf(ll.isEmpty());
resultTextField.setText(resText);
return;
}
if (cmd.equals("size"))
{
String resText = String.valueOf(ll.size());
resultTextField.setText(resText);
return;
}
}
}
  
/**
The main method creates an instance of the
LinkedList1Demo class which causes it to
display its window.
*/
  
public static void main(String [ ] args)
{
new LinkedList1Demo();
}   
}

In: Computer Science

(JAVA) I have posted the same question 2 days ago, but it still has not solved...

(JAVA)

I have posted the same question 2 days ago, but it still has not solved yet.

I have "cannot be resolved or is not a field" error on

node.right; & node.left; under BuildExpressTree.java

//Main.java

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;
import java.util.*;

public class Main extends JFrame{
   private GridLayout glm = new GridLayout(3, 1, 5, 20);
   private JPanel jp1 = new JPanel();
   private JPanel jp2 = new JPanel();
   private JPanel jp3 = new JPanel();
   private GridLayout gl1 = new GridLayout (1, 2);
   private JLabel jl1 = new JLabel("Enter Postfix Expression", JLabel.CENTER);
   private JTextField jtf1 = new JTextField();
   private GridLayout gl2 = new GridLayout(1, 3, 5, 9);
   private JButton jbEvaluate = new JButton("Construct Tree");
   private GridLayout gl3 = new GridLayout(1, 2);
   private JLabel jl2 = new JLabel("Infix Expression", JLabel.CENTER);
   private JTextField jtf2 = new JTextField();
   private String postfixExpression;
   private int result;
  
   public String userInput(){
       return (String)jtf1.getText();
   }
  
   public Main(){
       setTitle("Infix Expression Evaluator");
       setSize(500, 200);
       setLayout(glm);
       jp1.setLayout(gl1);
       jp1.add(jl1);
       jp1.add(jtf1);
       add(jp1);
       jp2.setLayout(gl2);
       jp2.add(new JLabel(""));
       jp2.add(jbEvaluate);
       jbEvaluate.addActionListener(new EnterActionListener());
       jp2.add(new JLabel(""));
       add(jp2);
       jp3.setLayout(gl3);
       jp3.add(jl2);
       jp3.add(jtf2);
       jtf2.setEditable(false);
       jtf2.setBackground(Color.PINK);
       add(jp3);
       setLocationRelativeTo(null);
       setResizable(true);
       setVisible(true);
       setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   }

   class EnterActionListener implements ActionListener{
       public void actionPerformed(ActionEvent ae){
           jtf2.setText("");
           String result = "";
          
           try{
               result = BuildExpressionTree.constructTree(userInput());
               jtf2.setText(result);
               }catch(NumberFormatException nfe){
                   JOptionPane.showMessageDialog(null, "Amount must be numeric value", "Deposit Error", JOptionPane.WARNING_MESSAGE);
           }catch(EmptyStackException ese){
               JOptionPane.showMessageDialog(null, "Provide Expression to Calculate", "No Expression", JOptionPane.WARNING_MESSAGE);
           }
       }
       }
  
   public static void main (String[] args){
       Main main = new Main();
   }
}

//BuildExpressionTree.java

import java.util.*;
import javax.swing.*;
import javax.xml.soap.Node;

public class BuildExpressionTree {
   private static Stack<Node> stack = new Stack<Node>();
   private static Node node;
  
   public static boolean isOperator(String token){
       if(token == "+" || token == "-" || token == "*" || token == "/"){
           return true;
       }
       JOptionPane.showMessageDialog(null, "Invalid token" + token, "Token Error", JOptionPane.WARNING_MESSAGE);
       return false;
   }
  
   public static boolean isInteger(String token){
       try{
           if(Integer.parseInt(token) == 0 ||
           Integer.parseInt(token) == 1 ||
           Integer.parseInt(token) == 2 ||
           Integer.parseInt(token) == 3 ||
           Integer.parseInt(token) == 4 ||
           Integer.parseInt(token) == 5 ||
           Integer.parseInt(token) == 6 ||
           Integer.parseInt(token) == 7 ||
           Integer.parseInt(token) == 8 ||
           Integer.parseInt(token) == 9){
           return true;
           }
       }catch(NumberFormatException nfe){
           JOptionPane.showMessageDialog(null, "Invalid token" + token, "Token Error", JOptionPane.WARNING_MESSAGE);
           return false;
       }
       return true;
   }
  
   public static String[] postfixExpression(String postfixExp){
       String expression = postfixExp;
       String[] expressionArray = expression.split("\\s+");
       String splitExpression = "";
      
       for(int i = 0; i < expressionArray.length; i++){
           splitExpression += expressionArray[i];
       }
       StringTokenizer tokenizedExpression = new StringTokenizer(splitExpression);
       splitExpression = "";
      
       while(tokenizedExpression.hasMoreTokens()){
           String nextToken = tokenizedExpression.nextToken();
           splitExpression += nextToken + " ";
       }String[] tokens = splitExpression.split("\\s+");
       return tokens;
   }
  
   public static String constructTree(String expression) throws RuntimeException{
       stack = new Stack<Node>();
       String result;
       String[] expressionRead = postfixExpression(expression);
       for(int i = 0; i < expressionRead.length; i++){
           String nextToken = expressionRead[i];
           if(isInteger(nextToken)){
               node = (Node) new OperandNode(nextToken);
               stack.push(node);
           }else if(isOperator(nextToken)){
               node = (Node) new OperatorNode(nextToken);
               Node y;
               Node x;
              
               y = (Node) stack.pop();
               x = (Node) stack.pop();
              
               node.right = y;
               node.left = x;

               stack.push(node);
           }else{
               throw new RuntimeException();
           }
       }
       result = stack.peek().toString();
       return result;
   }
}

//Node.java


public abstract class Node {
   protected String data;
   protected Node left;
   protected Node right;
  
   public void setData(String data){
       this.data = data;
   }
  
   public String getData(){
       return data;
   }
}

class OperandNode extends Node{
   public OperandNode(String operand){
       this.data = operand;
       this.left = null;
       this.right = null;
   }
   public String toString(){
       return data + "";
   }
}

class OperatorNode extends Node{
   public OperatorNode(String operator){
       this.data = operator;
       this.left = null;
       this.right = null;
   }
  
   public void setLeft(Node left){
       this.left = left;
   }
   public Node getLeft(){
       return left;
   }
   public void setRight(Node right){
       this.right = right;
   }
   public Node getRight(){
       return right;
   }
   public String toString(){
       return "( " + this.left + " " + data + this.right + " )";
   }
}

In: Computer Science

For the first part of this lab, copy your working ArrayStringList code into the GenericArrayList class.(already...

For the first part of this lab, copy your working ArrayStringList code into the GenericArrayList class.(already in the code) Then, modify the class so that it can store any type someone asks for, instead of only Strings. You shouldn't have to change any of the actual logic in your class to accomplish this, only type declarations (i.e. the types of parameters, return types, etc.)

Note:

In doing so, you may end up needing to write something like this (where T is a generic type):

T[] newData = new T[capacity]; 

...and you will find this causes a compiler error. This is because Java dislikes creating new objects of a generic type. In order to get around this error, you can write the line like this instead:

T[] new Data = (T[]) new Object[capacity] 

This creates an array of regular Objects which are then cast to the generic type. It works and it doesn't anger the Java compiler. How amazing!

Once you're done, screenshot or save your code for checkin later.

For the second part of the lab, modify your GenericArrayList so that it can store any type that is comparable to a Point. Remember the Point and Point3D classes? Both of those implement the Comparable<Point> interface, so they both can compared to a Point. In fact, they are the only classes that can be compared to a Point, so after modifying your GenericArrayList, it should only be able to contain these two classes.

In both parts, test your classes by following the directions in the comments. They will ask you to uncomment some code and look for a specific result.

public class GenericArrayList {

/* YOUR CODE HERE

   * Copy your code from your ArrayStringList class, and place it within

   * this class.

   *

   * Only copy the code you filled out! Don't copy the main method.

   */

   // Place code here

public class ArrayStringList {

private String[] data;

private int size;

private void resizeData(int newSize) {

String[] str = new String[newSize];

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

str[i] = data[i];

}

data=str;

}

public ArrayStringList(int initialCapacity) {

data = new String[initialCapacity];

size = 0;

}

public void add(String str) {

if(size < data.length) {

data[size] = str;

size++;

} else {

resizeData(2 * data.length);

data[size] = str;

size++;

}

}

public void add(int index, String str) {

if(index < data.length && index >= 0) {

data[index] = str;

size++;

}

}

public String get(int index) {

if(index < data.length && index >= 0) {

return data[index];

}

return null;

}

public void remove(int index) {

if(index < data.length && index >= 0) {

for(int i = index; i < data.length; i++) {

if((i + 1) < size) {

data[i] = data[i + 1];

}

}

size--;

}

}

public int size() {

return size;

}

public boolean contains(String str) {

for(int i = 0; i < data.length; i++) {

if(str.equals(data[i])) {

return true;

}

}

return false;

}

public static void main(String[] args) {

/* PART 1:

   * Modify the GenericArrayList above so that it can store *any* class,

   * not just strings.

   * When you've done that, uncomment the block of code below, and see if

   * it compiles. If it does, run it. If there are no errors, you did

   * it right!

   */

GenericArrayList<Point> pointList = new GenericArrayList<Point>(2);

pointList.add(new Point(0, 0));

pointList.add(new Point(2, 2));

pointList.add(new Point(7, 0));

pointList.add(new Point(19.16f, 22.32f));

pointList.remove(0);

Point p = pointList.get(2);

if (p.x != 19.16f && p.y != 22.32f) {

throw new AssertionError("Your GenericArrayList compiled properly "

+ "but is not correctly storing things. Make sure you didn't "

+ "accidentally change any of your ArrayStringList code, aside "

+ "from changing types.");

}

GenericArrayList<Float> floatList = new GenericArrayList<Float>(2);

for (float f = 0.0f; f < 100.0f; f += 4.3f) {

floatList.add(f);

}

float f = floatList.get(19);

System.out.println("Hurray, everything worked!");

  

/* PART 2:

   * Now, modify your GenericArrayList again so that it can only store

   * things that are comparable to a Point.

   *

   * If you don't know how to do this, reference zybooks and your textbook

   * for help.

   *

   * When you are ready to test it, uncomment the code above and run the

   * code below.

   */

/*

GenericArrayList<Point> pointList = new GenericArrayList<Point>(2);

GenericArrayList<Point3D> pointList3D = new GenericArrayList<Point3D>(3);

pointList.add(new Point(0, 0));

pointList.add(new Point(2, 2));

pointList.add(new Point(7, 0));

pointList.add(new Point(19.16f, 22.32f));

pointList3D.add(new Point3D(1.0f, 2.0f, 3.0f));

pointList3D.add(new Point3D(7.3f, 4, 0));

Point p = pointList.get(2);

Point3D p3 = pointList3D.get(0);

// You should get a compilation error on this line!

GenericArrayList<Float> floatList = new GenericArrayList<Float>(2);

*/

}

}

}

In: Computer Science

Please based on my python code. do the following steps: thank you Develop a method build_bst...

Please based on my python code. do the following steps:

thank you

  1. Develop a method build_bst which takes a list of data (example: [6, 2, 4, 22, 34, 9, 6, 67, 42, 55, 70, 120, 99, 200]) and builds a binary search tree full of Node objects appropriately arranged.
  2. Test your build_bst with different sets of inputs similar to the example provided above. Show 3 different examples.
  3. Choose 1 example data.  Develop a function to remove a node from a bst data structure.  This function should consider all the three cases:  case-1: remove a leaf node, case-2: remove a node with one child and case-3: remove a node with two children. Show an example.

Perform tree balancing after node deletion if necessary.You can choose AVL tree or Red Black tree implementation.

Perform the time complexity for this function.Briefly explain?

  1. Write a function which takes two bst and merges the two trees.  The function should return the merged tree.  Show an example.

Perform tree balancing after merge a tree if necessary.You can choose AVL tree or Red Black tree implementation.

Perform the time complexity for this function.

Here is my python code:

from queue import Queue

class Node:

def __init__(self, data):

self.parent = None

self.left = None

self.right = None

if isinstance(data, list):

self.build_tree(data)

return

self.value = data

def build_tree(self, L):

q = Queue()

q.put(self)

self.value = L[0]

for i in range(1, len(L), 2):

node = q.get()

node.left = Node(L[i])

node.left.parent = node

q.put(node.left)

if i+1 == len(L):

return

node.right = Node(L[i+1])

node.right.parent = node

q.put(node.right)

def min(self):

if self.left is None or self.right is None:

if self.left is not None:

return min(self.value, self.left.min())

if self.right is not None:

return min(self.value, self.right.min())

return self.value

return min(self.value, self.left.min(), self.right.min())

def max(self):

if self.left is None or self.right is None:

if self.left is not None:

return max(self.value, self.left.max())

if self.right is not None:

return max(self.value, self.right.max())

return self.value

return max(self.value, self.left.max(), self.right.max())

def preorder(self):

if self.value is None:

return

print(self.value, end=' ')

if self.left is not None:

self.left.preorder()

if self.right is not None:

self.right.preorder()

if __name__ == "__main__":

#L = [6, 2, 4, 22, 34, 9, 6, 67, 42, 55, 70, 120, 99, 200]

L = [int(x) for x in input().split()]

root = Node(L)

root.preorder()

print()

print(f"Minimum node in tree: {root.min()}")

print(f"Maximum node in tree: {root.max()}")

In: Computer Science

Multiple choice: The presence of a black hole in a galaxy core can be inferred from...

Multiple choice: The presence of a black hole in a galaxy core can be inferred from (a) the total mass of the galaxy; (b) the speeds of stars near the core; (c) the color of the galaxy; (d) the distance of the galaxy from the Milky Way Galaxy; or (e) the diminished brightness of starlight in the galaxy core, relative to surrounding areas.

Multiple choice: Which one of the following statements about black holes is false? (a) Inside a black hole, matter is thought to consist primarily of iron, the endpoint of nuclear fusion in massive stars. (b) Photons escaping from the vicinity of (but not inside) a black hole lose energy, yet still, travel at the speed of light. (c) Near the event horizon of a small black hole (mass = a few solar masses), tidal forces stretch objects apart. (d) A black hole that has reached an equilibrium configuration can be described entirely by its mass, electric charge, and amount of spin (“angular momentum”). (e) A black hole has an “event horizon” from which no light can escape, according to classical (i.e., non-quantum) ideas.

Multiple choice: Which one of the following statements about black holes is true? (a) The surface of the singularity of a black hole is known as the event horizon. (b) Being more massive, a supermassive black hole has a greater gravitational pull than a stellar-mass black hole, so if you approach the event horizon of a supermassive black hole, you will be torn apart more easily than if you approach the event horizon of a stellar-mass black hole. (c) If the Sun were to become a black hole of the same mass, Earth would spiral into the black hole and be eaten. (d) The “photon sphere” is a region inside a black hole where photons orbit the center, so they cannot escape. (e) In principle, energy can be extracted from a region outside a rotating black hole.

Multiple choice: Which one of the following statements about the detection (or potential detection) of black holes is false? (a) Black holes cannot be detected because they emit no light and are therefore impossible to directly observe. (b) A binary pair of black holes was recently detected through measurements of the gravitational waves emitted when they merged to form a single black hole. (c) The presence of supermassive black holes in the centers of galaxies has been inferred from the motions of stars and gas near them. (d) Evidence for black holes can be found if material in the surrounding accretion disk goes through the event horizon and fades from view, rather than releasing energy as it hits a hard stellar surface. (e) Candidate black holes are sometimes found in binary systems that suddenly brighten at X-ray wavelengths.

In: Physics