Questions
MAKE node class outside of stack class class Stack{    private:        class node{   ...

MAKE node class outside of stack class

class Stack{
   private:
       class node{
           public:
               node *next;
               int data;
               node(int d,node *n = NULL){
                   data = d;
                   next = n;
               }
       };
       node *start;
      
   public:
       Stack();
       Stack(const Stack& original);
       ~Stack();
      bool isEmpty() const ;
       int top() const;
      int pop() ;
       void push(int);
};

Stack::Stack(){
   start = NULL;
}

Stack::Stack(const Stack& original){
   if (original.isEmpty()) {
       start = NULL;
   } else {
       node* p = original.start; // points to current node on other
       node* tmp = new node(p->data); // make a copy of the first node
       start = tmp;
       node* tail = tmp; // points to last node of this list
       while (p->next != NULL) {
           p = p->next;
           tmp = new node(p->data);
           tail->next = tmp;
           tail = tmp;
       }
   }
}

Stack::~Stack(){
   node * curr = start;
   node *next;
   while(curr!=NULL){
       next = curr->next;
       delete curr;
       curr = next;
   }
}

bool Stack::isEmpty() const{
   if(start==NULL)
       return 1;
   return 0;
}

int Stack::top() const{
   if(isEmpty())
       throw "Stack is Empty";  
   return (start->data);
  
}

void Stack::push(int e){
   node *p = new node(e);
   if(isEmpty()){
       start = p;
   }else{
       p->next = start;
       start = p;
   }
  
}

int Stack::pop() {
   if(isEmpty())
       throw "Stack is Empty";
   else
   {
       node *p = start;
       start = start->next;
       int d = p->data;
       delete p;
       return d;
   }
}

/* A TEST PROGRAM */

#include<iostream>
using namespace std;

class Stack{
   private:
       class node{
           public:
               node *next;
               int data;
               node(int d,node *n = NULL){
                   data = d;
                   next = n;
               }
       };
       node *start;
      
   public:
       Stack();
       Stack(const Stack& original);
       ~Stack();
      bool isEmpty() const ;
       int top() const;
      int pop() ;
       void push(int);
};

Stack::Stack(){
   start = NULL;
}

Stack::Stack(const Stack& original){
   if (original.isEmpty()) {
       start = NULL;
   } else {
       node* p = original.start; // points to current node on other
       node* tmp = new node(p->data); // make a copy of the first node
       start = tmp;
       node* tail = tmp; // points to last node of this list
       while (p->next != NULL) {
           p = p->next;
           tmp = new node(p->data);
           tail->next = tmp;
           tail = tmp;
       }
   }
}

Stack::~Stack(){
   node * curr = start;
   node *next;
   while(curr!=NULL){
       next = curr->next;
       delete curr;
       curr = next;
   }
}

bool Stack::isEmpty() const{
   if(start==NULL)
       return 1;
   return 0;
}

int Stack::top() const{
   if(isEmpty())
       throw "Stack is Empty";  
   return (start->data);
  
}

void Stack::push(int e){
   node *p = new node(e);
   if(isEmpty()){
       start = p;
   }else{
       p->next = start;
       start = p;
   }
  
}

int Stack::pop() {
   if(isEmpty())
       throw "Stack is Empty";
   else
   {
       node *p = start;
       start = start->next;
       int d = p->data;
       delete p;
       return d;
   }
}

In: Computer Science

For the following arguments, determine what statement is the conclusion and what statement/s are the premises....

  • For the following arguments, determine what statement is the conclusion and what statement/s are the premises. You may state it or underline it. Don't forget to look for indicator words as they will signal a conclusion or the premises. The next exercise, find the missing statement based on identification of the form.

1.      God is that than which none greater can be conceived. If God were just an idea we could easily conceive of something greater, namely, a God who actually existed. Therefore, if God is that than which none greater can be conceive, then God must exist. (St. Anselm)

2.      Titanium combines readily with oxygen, nitrogen, and hydrogen, all of which have an adverse effect on its mechanical properties. As a result, titanium must be processed in their absence. (World of Science Encyclopedia)

3.      Artists and poets look at the world and seek relationships and order. But they translate their ideas to canvas, or to marble, or into poetic images. Scientists try to find relationships between different objects and events. To express the order they find, they create hypotheses and theories. Thus, the great scientific theories are easily compared to great art and great literature. (Giancoli, The Ideas of Physics, 3rd Ed.)

4.      Every art and every inquiry, and similarly every action and pursuit, is thought to aim at some good. For this reason, the good has rightly been declared to be that at which all things aim. (Aristotle, Nicomachean Ethics)

5.      Al Gore has a clear vision of where this nation must go with regards to energy policies. Anyone who has such a vision can write his ticket into the 21st century, and should be elected president. Al Gore is the right man to lead this country for the next four years. (Critical Thinking, Moore & Parker)

6.      The fact that there was never a land bridge between Australia and mainland Asia is evidenced by the fact that the animal species in the two areas are very different. Asian placental mammals and Australian marsupial mammals have not been in contact in the last several million years. (Price and Feinman, Images of the Past)

  • Now try to find the missing premise or conclusion by way of the forms, either valid or invalid, that you learned. Write it into the blank and tell us what form it fulfills.

1) All bachelors are unmarried men.

     Ed is a bachelor.

Therefore, _______________________________

2) If you are rich then I am single.

     ________________________________

    You are not rich.

3) All teachers work hard.

    _______________________________

   All teachers pay taxes.

4) Either today is Tuesday or it is Wednesday.

    ___________________________________

Today is Tuesday.

In: Psychology

Math V3.0 Modify the previous version of this program again so it displays a menu allowing...

Math V3.0

Modify the previous version of this program again so it displays a menu allowing the user to select addition, subtraction, multiplication, or division problem. The final selection on the menu should let the user quit the program. After the user has finished the math problem, the program should display the menu again. This process is repeated until the user chooses to quit the program. If a user selected an item not on the menu, display an error message and display the menu again.

Note: Start with your code from the previous chapter! For this assignment, you are extending your previous project by allowing for subtraction, multiplication, and division, as well as addition. This can be a bit tricky (hence this is worth two assignments), so be careful. Here is a basic outline of what your program should look like:

  1. Declare your variables, including the correct answer
  2. Display the menu and prompt the user for their choice
  3. Make sure it is a valid choice
  4. For each possible choice:
    1. Figure out the two operands appropriately
    2. Determine and store the correct answer
    3. Display the problem (formatted nicely!)
  5. Assuming they didn't hit 5 to exit, prompt for the answer
  6. Provide feedback on the user's answer
  7. Repeat the loop as necessary

All generated numbers must be random. For addition and subtraction, the range of numbers must be between 50 and 500, like before. For multiplication, limit the numbers to be in the ranges 1-100 and 1-9. For division, generate the denominator in the range of 1-9. The numerator must be a multiple of the denominator (so there are no remainders for division!), no more than 50 times larger. You might have to think about this!

The output should look like this -- user inputs are in bold blue type:

Math Menu
------------------------------
1. Addition problem
2. Subtraction problem
3. Multiplication problem
4. Division problem
5. Quit this program
------------------------------
Enter your choice (1-5): 4

66 / 6 = 11

Congratulations! That's right.

Math Menu
------------------------------
1. Addition problem
2. Subtraction problem
3. Multiplication problem
4. Division problem
5. Quit this program
------------------------------
Enter your choice (1-5): 2

473 - 216 = 241

Sorry! That's incorrect.

Math Menu
------------------------------
1. Addition problem
2. Subtraction problem
3. Multiplication problem
4. Division problem
5. Quit this program
------------------------------
Enter your choice (1-5): 5
Thank you for using Math.

In: Computer Science

A machine is designed to fill 16-ounce bottles of shampoo. When the machine is working properly,...

A machine is designed to fill 16-ounce bottles of shampoo. When the machine is working properly, the amount poured into the bottles follows a normal distribution with mean 16.05 ounces with a standard deviation of .1 ounces. If four bottles are randomly selected each hour and the number of ounces in each bottle is measured, then 95% of the means calculated should occur in what interval? Hint: the standard deviation rule says that 95% of the observations are within how many standard deviations away from the mean? Round answers to four decimal places

.

In: Math

Independent-Samples t Test A researcher had participants sit in a “waiting area” prior to participating in...

  1. Independent-Samples t Test

A researcher had participants sit in a “waiting area” prior to participating in a study. In the waiting area was an attractive or unattractive woman sitting in one of the chairs. In fact, the same woman was present in the waiting area and manipulated to look either attractive or unattractive (relatively speaking). The woman was a confederate in the study, meaning that, unbeknownst to participants, she was a co-researcher in the study. Participants were asked to sit in the waiting area until called upon. One group waited in the room with the attractive confederate; the other group waited in the room with the unattractive confederate. The distance (in feet) that participants sat from the confederate was considered a measure of attraction. The results are given below. It was hypothesized that if this was actually measuring attraction, then participants should sit closer (in feet) to the attractive versus the unattractive confederate. Test this hypothesis at a .05 level of significance (compute a two-tailed test).

Attractiveness of Confederate

Attractive

Unattractive

1.3

6.8

2.2

5.7

3.5

4.9

0.7

8.5

2.3

9.2

2.1

8.4

4

6.7

6

4.3

2.3

1.3

5.8

6.3

6.8

8.8

5.3

9.2

8.4

5.7

3.5

7.3

0.4

2.6

7.9

2.1

8.2

6.0

1.6

3.4

Based on the table shown in SPSS, state the following values associated with the test statistics (assume equal variance):

Mean Difference: ______

t obtained: ______

Degrees of Freedom: ______

Significance (p-value): ______

Based on the value of the test statistic, what is the decision (highlight one):

Not Significant Significant

Write the statistic in APA format: ________________________

In: Psychology

Temperature Converter Modify the previous version of this program so that it uses a loop to...

Temperature Converter

Modify the previous version of this program so that it uses a loop to display a range of temperature conversions for either Fahrenheit to Celsius or Celsius to Fahrenheit.

Note: You can start with the code from the previous version, then modify it slightly after it prompts the user for the direction to convert. It will then ask the user for a starting temperature and ending temperature. Assuming they entered the lower number first (if not, tell them and end the program), loop through the range provided, incrementing by 1 for each iteration of the loop, and generate the appropriate table.

The output should look like this -- user inputs are in bold blue type:
Temperature Conversion Table
Enter c (or C) to convert Fahrenheit to Celsius
   or f (or F) to convert Celsius to Fahrenheit: F
Enter the starting temperature: 30
Enter the ending temperature: 42

Celsius  Fahrenheit
    30        86.0
    31        87.8
    32        89.6
    33        91.4
    34        93.2
    35        95.0
    36        96.8
    37        98.6
    38       100.4
    39       102.2
    40       104.0
    41       105.8
    42       107.6

Running the program again:
Temperature Conversion Table
Enter c (or C) to convert Fahrenheit to Celsius
   or f (or F) to convert Celsius to Fahrenheit: c
Enter the starting temperature: -4
Enter the ending temperature: 4

Fahrenheit  Celsius
    -4       -20.0
    -3       -19.4
    -2       -18.9
    -1       -18.3
     0       -17.8
     1       -17.2
     2       -16.7
     3       -16.1
     4       -15.6

In: Computer Science

For the best Parmesan cheese for one’s chicken parmigiana recipe, one might try Wegmans, especially if...

For the best Parmesan cheese for one’s chicken parmigiana recipe, one might try Wegmans, especially if one happens to live in the vicinity of Pittsford, New York. Cheese department manager Carol Kent will be happy to recommend the best brand because her job calls for knowing cheese as well as managing some 20 subordinates.

Wegmans Food Markets, a family-owned East Coast chain with over 80 outlets in six states, prides itself on its commitment to customers, and it shows. It consistently ranks near the top of the annual Consumer Reports survey of the best national and regional grocery stores.

Kent and the employees in her department also enjoy the best benefits package in the industry, including fully paid health insurance. And that includes part-timers, who make up about two-thirds of the company’s workforce of more than 37,000. At 15 to 17 percent of sales, for example, Wegmans’ labor costs are well above the 12 percent figure for most supermarkets.

Besides, employee turnover at Wegmans is about 6 percent—a mere fraction of an industry average that hovers around 19 percent (and can approach 100 percent for part-timers). And this is an industry in which total turnover costs have been known to outstrip total annual profits by 40 percent. Wegmans employees tend to be knowledgeable because about 20 percent of them have been with the company for at least years, and many have logged at least a quarter century.

Wegmans usually ranks high on Fortune magazine’s annual list of “100 Best Companies to Work For.” In addition to its healthcare package, Wegmans has been cited for such perks as fitness center discounts, compressed work weeks, telecommuting, and domestic-partner benefits (which extend to same-sex partners).

Finally, under the company’s Employee Scholarship Program, full-time workers can receive up to $2,200 a year for four years and part-timers up to $1,500. Since its inception in 1984, the program has handed out $80 million in scholarships to more than 24,000 employees.

Granted, Wegmans, which has remained in family hands since its founding in 1915, has an advantage in being as generous with its resources as its family of top executives wants to be. It doesn’t have to do everything with quarterly profits in mind, and the firm likes to point out that taking care of its employees is a long-standing priority.

Think It Over

  1. Why does Wegman’s approach to compensation seem to work so well?

  1. In your opinion, why don’t other grocery chains use the same compensation model as Wegman’s?

In: Operations Management

This program needs to be in Java Exercise on Single Dimensional Arrays Declare an array reference...

This program needs to be in Java


Exercise on Single Dimensional Arrays

  1. Declare an array reference variable arrayInt for an array of integers. Create the array of size 100, and assign it to arrayInt. (2 points)
  2. Write a method to populate the array with Random numbers between 1 to 25. Signature of the method is: populateArray( int[] ) which returns nothing. Call this method from main with arrayInt--> populateArray(arrayInt). (2 points)
  3. Write a method to print an array. Signature of the method is: printArray( int[] ) which returns nothing. Print maximum of ten(10) numbers on a line (see sample output below). Call this method from main with arrayInt--> printArray(arrayInt). Hint: Use the modulus operator. Any number n % 10 will return a value 0-9. (3 points)
  4. Write a method that finds the average of the array elements. Signature of the method is: findAverage( int[] ) which returns the averageto the calling program.Call this method from main with arrayInt--> findAverage(arrayInt).  (3 points)

SAMPLE OUTPUT:

1   12 20  11  10  15  17   5  20   8  
23 6 4 20 23 15 15 24 4 19
3 10 15 12 8 5 23 24 2 25
2 19 13 3 7 22 17 8 15 9
22 17 3 5 5 20 24 19 21 13
9 1 16 5 16 8 24 11 7 1
19 16 14 11 23 22 23 25 18 3
16 3 10 3 17 15 3 17 15 17
22 16 16 7 15 7 10 22 10 1
21 20 18 4 11 24 24 2 19 12
The average is: 12.51

In: Computer Science

Using Java, Complete LinkedListSet: package Homework3; public class LinkedListSet <T> extends LinkedListCollection <T> { LinkedListSet() {...

Using Java, Complete LinkedListSet:

package Homework3;
public class LinkedListSet <T> extends LinkedListCollection <T> {
LinkedListSet() {
}
public boolean add(T element) {
// Code here
return true;
}
}

Homework3 class:

public class Homework3 {
public static void main(String[] args) {
ArrayCollection ac1 = new ArrayCollection(); // Calling Default
Constructor
ArrayCollection ac2 = new ArrayCollection(2); // Calling overloaded
constructor
ArraySet as1 = new ArraySet();
ac2.add("Apple");
ac2.add("Orange");
ac2.add("Lemon"); // This can't be added into ac2 as collection is full
System.out.println(ac2.remove("Apple")); // This should return true
System.out.println(ac2);
ac2.enlarge(10);
ac2.add("Watermelon");
System.out.println("Equals: " + ac1.equals(ac2));
as1.add("Avocado");
as1.add("Avocado"); // This will not be added, since the
collection is "set"
}
}

In: Computer Science

Now why is it important from an accounting perspective to classify a lease into operating or...

Now why is it important from an accounting perspective to classify a lease into operating or capital lease? What is the criteria to classify the lease into operating and capital lease ? Do you think the lessee tends to prefer an operating lease or a capital lease? Why?

In: Accounting

Carlsbad Corporation's sales are expected to increase from $5 million in 2016 to $6 million in...

Carlsbad Corporation's sales are expected to increase from $5 million in 2016 to $6 million in 2017, or by 20%. Its assets totaled $5 million at the end of 2016. Carlsbad is at full capacity, so its assets must grow in proportion to projected sales. At the end of 2016, current liabilities are $1 million, consisting of $250,000 of accounts payable, $500,000 of notes payable, and $250,000 of accrued liabilities. Its profit margin is forecasted to be 6%, and the forecasted retention ratio is 40%. Use the AFN equation to forecast Carlsbad's additional funds needed for the coming year. Write out your answer completely. For example, 5 million should be entered as 5,000,000. Round your answer to the nearest cent.

$

Now assume the company's assets totaled $3 million at the end of 2016. Is the company's "capital intensity" the same or different comparing to initial situation?
-Select-Different or The same

In: Finance

Gallatin Carpet Cleaning is a small, family-owned business operating out of Bozeman, Montana. For its services,...

Gallatin Carpet Cleaning is a small, family-owned business operating out of Bozeman, Montana. For its services, the company has always charged a flat fee per hundred square feet of carpet cleaned. The current fee is $23.60 per hundred square feet. However, there is some question about whether the company is actually making any money on jobs for some customers—particularly those located on remote ranches that require considerable travel time. The owner’s daughter, home for the summer from college, has suggested investigating this question using activity-based costing. After some discussion, she designed a simple system consisting of four activity cost pools. The activity cost pools and their activity measures appear below: Activity Cost Pool Activity Measure Activity for the Year Cleaning carpets Square feet cleaned (00s) 7,500 hundred square feet Travel to jobs Miles driven 394,000 miles Job support Number of jobs 1,800 jobs Other (organization-sustaining costs and idle capacity costs) None Not applicable The total cost of operating the company for the year is $363,000 which includes the following costs: Wages $ 138,000 Cleaning supplies 28,000 Cleaning equipment depreciation 15,000 Vehicle expenses 40,000 Office expenses 68,000 President’s compensation 74,000 Total cost $ 363,000 Resource consumption is distributed across the activities as follows: Distribution of Resource Consumption Across Activities Cleaning Carpets Travel to Jobs Job Support Other Total Wages 77 % 11 % 0 % 12 % 100 % Cleaning supplies 100 % 0 % 0 % 0 % 100 % Cleaning equipment depreciation 75 % 0 % 0 % 25 % 100 % Vehicle expenses 0 % 84 % 0 % 16 % 100 % Office expenses 0 % 0 % 56 % 44 % 100 % President’s compensation 0 % 0 % 31 % 69 % 100 %

Required:

1. Prepare the first-stage allocation of costs to the activity cost pools.

2. Compute the activity rates for the activity cost pools.

3. The company recently completed a 800 square foot carpet-cleaning job at the Flying N ranch—a 53-mile round-trip journey from the company’s offices in Bozeman. Compute the cost of this job using the activity-based costing system.

4. The revenue from the Flying N ranch was $188.80 (800 square feet @ $23.60 per hundred square feet). Calculate the customer margin earned on this job.

In: Accounting

LONG-TERM FINANCING NEEDED At year-end 2016, total assets for Arrington Inc. were $1.6 million and accounts...

LONG-TERM FINANCING NEEDED

At year-end 2016, total assets for Arrington Inc. were $1.6 million and accounts payable were $330,000. Sales, which in 2016 were $3 million, are expected to increase by 30% in 2017. Total assets and accounts payable are proportional to sales, and that relationship will be maintained; that is, they will grow at the same rate as sales. Arrington typically uses no current liabilities other than accounts payable. Common stock amounted to $445,000 in 2016, and retained earnings were $335,000. Arrington plans to sell new common stock in the amount of $195,000. The firm's profit margin on sales is 6%; 35% of earnings will be retained.

a. What were Arrington's total liabilities in 2016? Write out your answer completely. For example, 25 million should be entered as 25,000,000. Round your answer to the nearest cent.

b. How much new long-term debt financing will be needed in 2017? Write out your answer completely. For example, 25 million should be entered as 25,000,000. Do not round your intermediate calculations. Round your answer to the nearest cent. (Hint: AFN - New stock = New long-term debt.)

In: Finance

what is C++? what is embedded computer?

what is C++?

what is embedded computer?

In: Computer Science

Do an assessment of the production strategy and supply chain of Samsung. Be sure to address...

Do an assessment of the production strategy and supply chain of Samsung. Be sure to address outsourcing and TQM. Where does Samsung produce product? Apply in detail the country, technological and production factors involved.

In: Operations Management