Questions
Goff Corporation acquired stock of Spiegel, Inc., on March 1, 2016, at a cost of $500,000....

Goff Corporation acquired stock of Spiegel, Inc., on March 1, 2016, at a cost of $500,000. The stock had a fair value of $550,000 at December 31, 2016, $610,000 at December 31, 2017, and $590,000 at December 31, 2018. Goff sold the stock for $640,000 on July 1, 2019. Spiegel did not pay any dividends during the time Goff held the stock.

When Goff acquired the stock, it classified the investment as available-for-sale. However, Goff transitioned to the new accounting rules for minority-passive equity investments at the beginning of 2018.

Ignore income taxes.

Assume the amount credited to OCI each year was subsequently closed to AOCI during the closing process.

Required:

Prepare the journal entry to record the acquisition of the Spiegel stock at March 1, 2016.

Prepare the journal entry to record the fair value adjustment at December 31, 2016.

Prepare the journal entry to record the fair value adjustment at December 31, 2017.

Prepare the journal entry to record the transition to the new accounting for minority-passive investments at January 1, 2018.

Prepare the journal entry to record the fair value adjustment at December 31, 2018.

Prepare the journal entry to record the sale of the investment at July 1, 2019.

(For all requirements, if no entry is required for a transaction/event, select "No journal entry required" in the first account field.)

In: Accounting

Some recent financial statements for Smolira Golf, Inc., follow. SMOLIRA GOLF, INC. Balance Sheets as of...

Some recent financial statements for Smolira Golf, Inc., follow.

SMOLIRA GOLF, INC.
Balance Sheets as of December 31, 2015 and 2016
2015 2016 2015 2016
Assets Liabilities and Owners’ Equity
Current assets Current liabilities
Cash $ 3,211 $ 3,307 Accounts payable $ 2,153 $ 2,600
Accounts receivable 4,767 5,781 Notes payable 1,750 2,116
Inventory 12,478 13,782 Other 90 107
Total $ 20,456 $ 22,870 Total $ 3,993 $ 4,823
Long-term debt $ 13,400 $ 16,160
Owners’ equity
Common stock and paid-in surplus $ 38,000 $ 38,000
Fixed assets Accumulated retained earnings 15,654 39,112
Net plant and equipment $ 50,591 $ 75,225 Total $ 53,654 $ 77,112
Total assets $ 71,047 $ 98,095 Total liabilities and owners’ equity $ 71,047 $ 98,095

  

SMOLIRA GOLF, INC.
2016 Income Statement
Sales $ 187,370
Cost of goods sold 126,203
Depreciation 5,333
EBIT $ 55,834
Interest paid 1,430
Taxable income $ 54,404
Taxes 19,041
Net income $ 35,363
Dividends $ 11,905
Retained earnings 23,458

Construct the DuPont identity for Smolira Golf. (Do not round intermediate calculations and round your answers to 2 decimal places, e.g., 32.16. Enter the profit margin and return on equity as a percent.)

Profit margin %
Total asset turnover times
Equity multiplier times
Return on equity %

In: Finance

On June 15, 2016, Sanderson Construction entered into a long-term construction contract to build a baseball...

On June 15, 2016, Sanderson Construction entered into a long-term construction contract to build a baseball stadium in Washington, D.C., for $400 million. The expected completion date is April 1, 2018, just in time for the 2018 baseball season. Costs incurred and estimated costs to complete at year-end for the life of the contract are as follows ($ in millions):

2016 2017 2018
  Costs incurred during the year $ 90 $ 60 $ 80
  Estimated costs to complete as of December 31 150 50
Required:
1.

Compute the revenue and gross profit will Sanderson report in its 2016, 2017, and 2018 income statements related to this contract assuming Sanderson recognizes revenue over time according to percentage of completion. (Enter your answers in million. Use percentages as calculated and rounded in the table below to arrive at your final answer. Losses and expenses should be indicated with a minus sign.)

      

      

      

2.

Compute the amount of revenue and gross profit or loss to be recognized in 2016, 2017, and 2018 using the completed contract method. (Enter your answers in millions.)

      

3.

Suppose the estimated costs to complete at the end of 2017 are $150 million instead of $50 million. Compute the amount of revenue and gross profit or loss to be recognized in 2017 using the percentage of completion method. (Do not round intermediate calculations. Enter your answer in millions. Round your answers to 1 decimal place.)

      

      

      

In: Accounting

On October 29, 2016, Lobo Co. began operations by purchasing razors for resale. Lobo uses the...

On October 29, 2016, Lobo Co. began operations by purchasing razors for resale. Lobo uses the perpetual inventory method. The razors have a 90-day warranty that requires the company to replace any nonworking razor. When a razor is returned, the company discards it and mails a new one from Merchandise Inventory to the customer. The company's cost per new razor is $14 and its retail selling price is $70 in both 2016 and 2017. The manufacturer has advised the company to expect warranty costs to equal 8% of dollar sales. The following transactions and events occurred.

2016

Nov. 11 Sold 80 razors for $5,600 cash.
30 Recognized warranty expense related to November sales with an adjusting entry.
Dec. 9 Replaced 16 razors that were returned under the warranty.
16 Sold 240 razors for $16,800 cash.
29 Replaced 32 razors that were returned under the warranty.
31 Recognized warranty expense related to December sales with an adjusting entry.


2017

Jan. 5 Sold 160 razors for $11,200 cash.
17 Replaced 37 razors that were returned under the warranty.
31 Recognized warranty expense related to January sales with an adjusting entry.

1.1 Prepare journal entries to record above transactions and adjustments for 2016.
  



1.2 Prepare journal entries to record above transactions and adjustments for 2017.
  

In: Accounting

Selected comparative financial statements of Korbin Company follow: KORBIN COMPANY Comparative Income Statements For Years Ended...

Selected comparative financial statements of Korbin Company follow:

KORBIN COMPANY Comparative Income Statements For Years Ended December 31, 2017, 2016, and 2015

2017 2016 2015 Sales $ 392,189 $ 300,449 $ 208,500 Cost of goods sold 236,098 189,884 133,440 Gross profit 156,091 110,565 75,060 Selling expenses 55,691 41,462 27,522 Administrative expenses 35,297 26,440 17,306 Total expenses 90,988 67,902 44,828 Income before taxes 65,103 42,663 30,232 Income taxes 12,109 8,746 6,137 Net income $ 52,994 $ 33,917 $ 24,095 KORBIN COMPANY Comparative Balance Sheets December 31, 2017, 2016, and 2015 2017 2016 2015 Assets Current assets $ 53,162 $ 41,593 $ 55,599 Long-term investments 0 900 3,460 Plant assets, net 100,263 106,488 64,372 Total assets $ 153,425 $ 148,981 $ 123,431 Liabilities and Equity Current liabilities $ 22,400 $ 22,198 $ 21,600 Common stock 71,000 71,000 53,000 Other paid-in capital 8,875 8,875 5,889 Retained earnings 51,150 46,908 42,942 Total liabilities and equity $ 153,425 $ 148,981 $ 123,431

2. Complete the below table to calculate income statement data in common-size percents.

3. Complete the below table to calculate the balance sheet data in trend percents with 2015 as the base year.

In: Accounting

On October 29, 2016, Lobo Co. began operations by purchasing razors for resale. Lobo uses the...

On October 29, 2016, Lobo Co. began operations by purchasing razors for resale. Lobo uses the perpetual inventory method. The razors have a 90-day warranty that requires the company to replace any nonworking razor. When a razor is returned, the company discards it and mails a new one from Merchandise Inventory to the customer. The company's cost per new razor is $13 and its retail selling price is $80 in both 2016 and 2017. The manufacturer has advised the company to expect warranty costs to equal 6% of dollar sales. The following transactions and events occurred. 2016 Nov. 11 Sold 80 razors for $6,400 cash. 30 Recognized warranty expense related to November sales with an adjusting entry. Dec. 9 Replaced 16 razors that were returned under the warranty. 16 Sold 240 razors for $19,200 cash. 29 Replaced 32 razors that were returned under the warranty. 31 Recognized warranty expense related to December sales with an adjusting entry. 2017 Jan. 5 Sold 160 razors for $12,800 cash. 17 Replaced 37 razors that were returned under the warranty. 31 Recognized warranty expense related to January sales with an adjusting entry. 1.1 Prepare journal entries to record above transactions and adjustments for 2016. 1.2 Prepare journal entries to record above transactions and adjustments for 2017.

In: Accounting

Adden Company signs a lease agreement dated January 1, 2016, that provides for it to lease...

Adden Company signs a lease agreement dated January 1, 2016, that provides for it to lease heavy equipment from Scott Rental Company beginning January 1, 2016. The lease terms, provisions, and related events are as follows: 1. The lease term is 4 years. The lease is noncancelable and requires annual rental payments of $20,000 to be paid in advance at the beginning of each year. 2. The cost, and also fair value, of the heavy equipment to Scott at the inception of the lease is $68,036.62. The equipment has an estimated life of 4 years and has a zero estimated residual value at the end of this time. 3. Adden agrees to pay all executory costs. 4. The lease contains no renewal or bargain purchase option. 5. Scott’s interest rate implicit in the lease is 12%. Adden is aware of this rate, which is equal to its borrowing rate. 6. Adden uses the straight-line method to record depreciation on similar equipment. 7. Executory costs paid at the end of the year by Adden are: 2016 2017 Insurance, $1,500 Insurance, $1,300 Property taxes, $6,000 Property taxes, $5,500 Required: 1. Next Level Examine and evaluate each capitalization criteria and determine what type of lease this is for Adden. 2. Prepare a table summarizing the lease payments and interest expense for Adden. 3. Prepare journal entries for Adden for the years 2016 and 2017.

In: Accounting

Assume sales for Peach Street Industries are expected to increase by 7.00% from 2015 to 2016....

Assume sales for Peach Street Industries are expected to increase by 7.00% from 2015 to 2016. Peach Street is operating at full capacity currently and expected assets-to-sales and spontaneous liabilities-to-sales to remain the same. Additionally, the firm is looking to maintain their 2015 net profit margin and dividend payout ratios for 2016. The firm’s tax rate is 36.00% and selected income statement and balance sheet information for 2015 is provided below:

Entry Value Entry Value
Current Assets $800.00 Sales $2,500.00
Net Fixed Assets (NFA) $700.00 Operating Costs $2,030.00
Total Assets $1,500.00 Depreciation $90.00
Accounts Payable and Accruals $30.00 Interest Expense $69.00
Notes Payable $180.00 Dividends Paid $93.30
Long term debt $510.00
Total Equity $780.00

what is the firm's payout ratio?

what is the firm's net income for 2015?

How much in additional funds (external capital) will Peach Street Industries need in 2016 to support their projected growth in sales? (i.e., calculate the firm’s additional funds needed --AFN)

The firm is projecting sales growth of 10% from 2015 to 2016. If the firm did not have access to or did not want to use external capital sources to grow sales, what is the maximum rate of sales growth (self-sustaining growth rate) could the firm could achieve under these conditions?

In: Finance

The Pyramid Company has used the LIFO method of accounting for inventory during its first two...

The Pyramid Company has used the LIFO method of accounting for inventory during its first two years of operation, 2016 and 2017. At the beginning of 2018, Pyramid decided to change to the average cost method for both tax and financial reporting purposes. The following table presents information concerning the change for 2016–2018. The income tax rate for all years is 40%.

Income before Income Tax
Average Cost Method LIFO Method Difference Income
Tax Effect
Difference
after Tax
2016 $ 89,400 $ 59,600 $ 29,800 $ 11,920 $ 17,880
2017 44,500 35,600 8,900 3,560 5,340
Total $ 133,900 $ 95,200 $ 38,700 $ 15,480 $ 23,220
2018 $ 50,800 $ 45,900 $ 4,900 $ 1,960 $ 2,940

Pyramid issued 49,000 $1 par, common shares for $225,000 when the business began, and there have been no changes in paid-in capital since then. Dividends were not paid the first year, but $12,000 cash dividends were paid in both 2017 and 2018.

Required:
1. Prepare the journal entry to record the change in accounting principle.
2. Prepare the 2018–2017 comparative income statements beginning with income before income taxes.
3. Prepare the 2018–2017 comparative statements of shareholders’ equity. (Hint: The 2016 statements reported retained earnings of $35,760. This is $59,600 – [$59,600 × 40%]).

In: Accounting

Assign a new alphabet whenever it sees a new number in those expressions ( Use increment...

Assign a new alphabet whenever it sees a new number in those expressions ( Use increment operator(++) so, lets say if x = "a", then x++ would be "b" and so on for as many numbers are there in expressions)

Assignment:Consider the input file “p4in.txt”has the following contents (in java language)
(Assuming that all expressions are correct): so using the valueStack ,uses ArrayStack and operatorStack

Specifications:

1) You must implement ArrayStack.java and modify Positfix.java so that valueStack uses ArrayStack and operatorStack uses LinkedStack.

2) Do this program step by step.

3) It may be easier to use String to split the expression to obtain the array of values.

4) Build your symbol table using single-letter variable name that starts from ‘a’.

Here is the inputfile (p4in.txt)
2 + 3
(2+ 3) * 4
2 * 3 / (4 -5)
2 / 3 + (4 -5)
2 / 3 + c -d
2 ^ 3 ^ 4
(2 ^ 3) ^ 4
2 * (3 / 4 + 5)
(2 + 3) / (4 -5)
2 / (3 -4) * 5
2 - (3 / (4 - 5) * 6 + 0) ^ 1
(2 - 3 * 4) / (5 * 6 ^ 0) * 1 + 8


I need to produce the output file named “p4out.txt” similar to the following:

Here is the output sample p4out.txt
Symbol Table
Variable     Value
a              2
b              3
c              4
d              5
e              6
f              0
g              1
h              8

Input                           Infix    Postfix   Result
2 + 3                           a+b       ab+       5
(2+ 3) * 4                      (a+b)*c   ab+c*    20
2 * 3 / (4 -5)                 all value Omitted downhere
2 / 3 + (4 -5)
2 / 3 + c -d
2 ^ 3 ^ 4
(2 ^ 3) ^ 4
2 * (3 / 4 + 5)
(2 + 3) / (4 -5)
2 / (3 -4) * 5
2 - (3 / (4 - 5) * 6 + 0) ^ 1
(2 - 3 * 4) / (5 * 6 ^ 0) * 1 + 8

Required programs:

ArrayStack.java:

import java.util.Arrays;
import java.util.EmptyStackException;
/**
    A class of stacks whose entries are stored in an array.
    @author Frank M. Carrano
    @author Timothy M. Henry
    @version 4.0
*/
public final class ArrayStack<T> implements StackInterface<T>
{
        private T[] stack;    // Array of stack entries
        private int topIndex; // Index of top entry
   private boolean initialized = false;
        private static final int DEFAULT_CAPACITY = 50;
        private static final int MAX_CAPACITY = 10000;
        
        public ArrayStack()
        {
      this(DEFAULT_CAPACITY);
        } // end default constructor
        
        public ArrayStack(int initialCapacity)
        {
      checkCapacity(initialCapacity);
      
      // The cast is safe because the new array contains null entries
      @SuppressWarnings("unchecked")
      T[] tempStack = (T[])new Object[initialCapacity];
      stack = tempStack;
                topIndex = -1;
      initialized = true;
        } // end constructor

        public void push(T newEntry)
        {
                checkInitialization();
                ensureCapacity();
                stack[topIndex + 1] = newEntry;
                topIndex++;
        } // end push

        public T peek()
        {
                checkInitialization();
                if (isEmpty())
                        throw new EmptyStackException();
                else
         return stack[topIndex];
        } // end peek

        public T pop()
        {
                checkInitialization();
                if (isEmpty())
                        throw new EmptyStackException();
                else
                {
                        T top = stack[topIndex];
                        stack[topIndex] = null;
                        topIndex--; 
         return top;
                } // end if
   } // end pop

   public boolean isEmpty()
        {
                return topIndex < 0;
        } // end isEmpty
        
        public void clear()
        {
                checkInitialization();
      
      // Remove references to the objects in the stack,
      // but do not deallocate the array
                while (topIndex > -1)
      {
                        stack[topIndex] = null;
         topIndex--;
      } // end while
      //        Assertion: topIndex is -1       
        } // end clear
   
   // Throws an exception if this object is not initialized.
   private void checkInitialization()
   {
      if (!initialized)
         throw new SecurityException ("ArrayStack object is not initialized properly.");
   } // end checkInitialization
   
   // Throws an exception if the client requests a capacity that is too large.
   private void checkCapacity(int capacity)
   {
      if (capacity > MAX_CAPACITY)
         throw new IllegalStateException("Attempt to create a stack " +
                                         "whose capacity exceeds " +
                                         "allowed maximum.");
   } // end checkCapacity
    
   // Doubles the size of the array stack if it is full
   // Precondition: checkInitialization has been called.
        private void ensureCapacity()
        {
           if (topIndex >= stack.length - 1) // If array is full, double its size
      {
         int newLength = 2 * stack.length;
         checkCapacity(newLength);
         stack = Arrays.copyOf(stack, newLength);
      } // end if
        } // end ensureCapacity
} // end ArrayStack

LinkedStack.java:

import java.util.EmptyStackException;
/**
   A class of stacks whose entries are stored in a chain of nodes.
   
   @author Frank M. Carrano
   @author Timothy M. Henry
   @version 4.0
*/
public final class LinkedStack<T> implements StackInterface<T>
{
        private Node topNode; // References the first node in the chain
        
        public LinkedStack()
        {
                topNode = null;
        } // end default constructor
        
        public void push(T newEntry)
        {
      topNode = new Node(newEntry, topNode);
//              Node newNode = new Node(newEntry, topNode);
//              topNode = newNode;
        } // end push

        public T peek()
        {
                if (isEmpty())
                        throw new EmptyStackException();
                else
         return topNode.getData();
        } // end peek

        public T pop()
        {
           T top = peek();  // Might throw EmptyStackException
           assert (topNode != null);
      topNode = topNode.getNextNode(); 

           return top;
        } // end pop

/*
// Question 1, Chapter 6: Does not call peek 
        public T pop()
        {
      if (isEmpty())
         throw new EmptyStackException();
      else
                {
         assert (topNode != null);
                        top = topNode.getData();
                        topNode = topNode.getNextNode();
                } // end if
                
                return top;
        } // end pop
*/              

        public boolean isEmpty()
        {
                return topNode == null;
        } // end isEmpty
        
        public void clear()
        {
                topNode = null;  // Causes deallocation of nodes in the chain
        } // end clear

        private class Node
        {
      private T    data; // Entry in stack
      private Node next; // Link to next node

      private Node(T dataPortion)
      {
         this(dataPortion, null);
      } // end constructor

      private Node(T dataPortion, Node linkPortion)
      {
         data = dataPortion;
         next = linkPortion;    
      } // end constructor

      private T getData()
      {
         return data;
      } // end getData

      private void setData(T newData)
      {
         data = newData;
      } // end setData

      private Node getNextNode()
      {
         return next;
      } // end getNextNode

      private void setNextNode(Node nextNode)
      {
         next = nextNode;
      } // end setNextNode
        } // end Node
} // end LinkedStack

Postfix.java:

/**
   A class that represents a postfix expression.
   Based on pseudocode in Segments 5.16 and 5.18.

   @author Frank M. Carrano
   @author Timothy M. Henry
   @version 4.0
*/
public class Postfix
{
   /** Creates a postfix expression that represents a given infix expression.
       Segment 5.16.
       @param infix  A string that is a valid infix expression.
       @return  A string that is the postfix expression equivalent to infix. */
   public static String convertToPostfix(String infix)
   {
      StackInterface<Character> operatorStack = new LinkedStack<Character>();
      StringBuilder postfix = new StringBuilder();
      int characterCount = infix.length();
      char topOperator;

      for (int index = 0; index < characterCount; index++)
      {
         boolean done = false;
         char nextCharacter = infix.charAt(index);

         if (isVariable(nextCharacter))
            postfix = postfix.append(nextCharacter);
         else
         {
            switch (nextCharacter)
            {
               case '^':
                  operatorStack.push(nextCharacter);
                  break;

               case '+': case '-': case '*': case '/':
                  while (!done && !operatorStack.isEmpty())
                  {
                     topOperator = operatorStack.peek();

                     if (getPrecedence(nextCharacter) <= getPrecedence(topOperator))
                     {
                        postfix = postfix.append(topOperator);
                        operatorStack.pop();
                     }
                     else
                        done = true;
                  } // end while

                  operatorStack.push(nextCharacter);
                  break;

               case '(':
                  operatorStack.push(nextCharacter);
               break;

               case ')': // Stack is not empty if infix expression is valid
                  topOperator = operatorStack.pop();
                  while (topOperator != '(')
                  {
                     postfix = postfix.append(topOperator);
                     topOperator = operatorStack.pop();
                  } // end while
                  break;

               default: break; // Ignore unexpected characters
            } // end switch
         } // end if
      } // end for

      while (!operatorStack.isEmpty())
      {
         topOperator = operatorStack.pop();
         postfix = postfix.append(topOperator);
      } // end while

      return postfix.toString();
   } // end convertToPostfix

   // Indicates the precedence of a given operator.
   // Precondition: operator is a character that is (, ), +, -, *, /, or ^.
   // Returns an integer that indicates the precedence of operator:
   //         0 if ( or ), 1 if + or -, 2 if * or /, 3 if ^,
   //         -1 if anything else. */
   private static int getPrecedence(char operator)
   {
      switch (operator)
      {
         case '(': case ')': return 0;
         case '+': case '-': return 1;
         case '*': case '/': return 2;
         case '^':           return 3;
      } // end switch

      return -1;
   } // end getPrecedence

   private static boolean isVariable(char character)
   {
      return Character.isLetter(character);
   } // end isVariable

   /** Evaluates a postfix expression.
       Segment 5.18
       @param postfix  a string that is a valid postfix expression.
       @return  the value of the postfix expression. */
   public static double evaluatePostfix(String postfix)
   {
      StackInterface<Double> valueStack = new LinkedStack<Double>();
      int characterCount = postfix.length();

      for (int index = 0; index < characterCount; index++)
      {
         char nextCharacter = postfix.charAt(index);

         switch(nextCharacter)
         {
            case 'a': case 'b': case 'c': case 'd': case 'e':
               valueStack.push(valueOf(nextCharacter));
               break;

            case '+': case '-': case '*': case '/': case '^':
               Double operandTwo = valueStack.pop();
               Double operandOne = valueStack.pop();
               Double result = compute(operandOne, operandTwo, nextCharacter);
               valueStack.push(result);
               break;

            default: break; // Ignore unexpected characters
         } // end switch
      } // end for

      return (valueStack.peek()).doubleValue();
   } // end evaluatePostfix

   private static double valueOf(char variable)
   {
      switch (variable)
      {
         case 'a': return 2.5;
         case 'b': return 3.0;
         case 'c': return 4.0;
         case 'd': return 12.0;
         case 'e': return 16.5;
      } // end switch

      return 0; // Unexpected character
   } // end valueOf

   private static Double compute(Double operandOne, Double operandTwo, char operator)
   {
      double result;

      switch (operator)
      {
         case '+':
            result = operandOne.doubleValue() + operandTwo.doubleValue();
            break;

         case '-':
            result = operandOne.doubleValue() - operandTwo.doubleValue();
            break;

         case '*':
            result = operandOne.doubleValue() * operandTwo.doubleValue();
             break;

         case '/':
            result = operandOne.doubleValue() / operandTwo.doubleValue();
            break;

         case '^':
            result = Math.pow(operandOne.doubleValue(), operandTwo.doubleValue());
            break;

         default:    // Unexpected character
            result = 0;
            break;
      } // end switch

      return result;
   } // end compute
} // end Postfix

StackInterface.java:

/**
   An interface for the ADT stack.
   @author Frank M. Carrano
   @author Timothy M. Henry
   @version 4.0
*/
public interface StackInterface<T>
{
   /** Adds a new entry to the top of this stack.
       @param newEntry  An object to be added to the stack. */
   public void push(T newEntry);
  
   /** Removes and returns this stack's top entry.
       @return  The object at the top of the stack. 
       @throws  EmptyStackException if the stack is empty before the operation. */
   public T pop();
  
   /** Retrieves this stack's top entry.
       @return  The object at the top of the stack.
       @throws  EmptyStackException if the stack is empty. */
   public T peek();
  
   /** Detects whether this stack is empty.
       @return  True if the stack is empty. */
   public boolean isEmpty();
  
   /** Removes all entries from this stack. */
   public void clear();
} // end StackInterface

Driver.java:

/**
   A driver that demonstrates the class Postfix.
   
   @author Frank M. Carrano
   @author Timothy M. Henry
   @version 4.1
*/
public class Driver
{
        public static void main(String[] args) 
        {
                System.out.println("Testing postfix expressions with\n" +
                                   "a = 2, b = 3, c = 4, d = 5, e = 6\n\n");

                testPostfix("a+b");
                testPostfix("(a + b) * c");
                testPostfix("a * b / (c - d)");
                testPostfix("a / b + (c - d)");
                testPostfix("a / b + c - d");
                testPostfix("a^b^c");
                testPostfix("(a^b)^c");
                testPostfix("a*(b/c+d)");

                System.out.println("Testing Question 6, Chapter 5:\n");
                testPostfix("(a+b)/(c-d)");         // Question 6a, Chapter 5
                testPostfix("a/(b-c)*d");           // Question 6b
                testPostfix("a-(b/(c-d)*e+f)^g");   // Question 6c
                testPostfix("(a-b*c)/(d*e^f*g+h)"); // Question 6d

                System.out.println("Testing Question 7, Chapter 5:\n");
                System.out.println("Q7a: ae+bd-/ : "   + Postfix.evaluatePostfix("ae+bd-/") + "\n");
                System.out.println("Q7b: abc*d*- : "   + Postfix.evaluatePostfix("abc*d*-") + "\n");
                System.out.println("Q7c: abc-/d* : "   + Postfix.evaluatePostfix("abc-/d*") + "\n");
                System.out.println("Q7d: ebca^*+d- : " + Postfix.evaluatePostfix("ebca^*+d-") + "\n");
                System.out.println("\n\nDone.");
        }  // end main
        
        public static void testPostfix(String infixExpression)
        {
                System.out.println("Infix:   " + infixExpression);
                String postfixExpression =  Postfix.convertToPostfix(infixExpression);
                System.out.println("Postfix: " + postfixExpression);
                System.out.println("\n");
        } // end testPostfix 
}  // end Driver

/*
 Testing postfix expressions with
 a = 2, b = 3, c = 4, d = 5, e = 6
 
 
 Infix:   a+b
 Postfix: ab+
 
 
 Infix:   (a + b) * c
 Postfix: ab+c*
 
 
 Infix:   a * b / (c - d)
 Postfix: ab*cd-/
 
 
 Infix:   a / b + (c - d)
 Postfix: ab/cd-+
 
 
 Infix:   a / b + c - d
 Postfix: ab/c+d-
 
 
 Infix:   a^b^c
 Postfix: abc^^
 
 
 Infix:   (a^b)^c
 Postfix: ab^c^
 
 
 Infix:   a*(b/c+d)
 Postfix: abc/d+*
 
 
 Testing Question 6, Chapter 5:
 
 Infix:   (a+b)/(c-d)
 Postfix: ab+cd-/
 
 
 Infix:   a/(b-c)*d
 Postfix: abc-/d*
 
 
 Infix:   a-(b/(c-d)*e+f)^g
 Postfix: abcd-/e*f+g^-
 
 
 Infix:   (a-b*c)/(d*e^f*g+h)
 Postfix: abc*-def^*g*h+/
 
 
 Testing Question 7, Chapter 5:
 
 Q7a: ae+bd-/ : -4.0
 
 Q7b: abc*d*- : -58.0
 
 Q7c: abc-/d* : -10.0
 
 Q7d: ebca^*+d- : 49.0
 
 
 
 Done.
 */

In: Computer Science