Write class PostfixEva1uator that evaluates a postfix expression such as 6 2 + 5 * 8 4 / -
The program should read a postfix expression consisting of single digits and operators into a StringBuilder, The program should read the expression and evaluate it (assume it's valid). The algorithm to evaluate a postfix expression is shown below. Use +, -, *, /, and ^. ^ is the exponent.
Append a right parenthesis ') ' to the end of the postfix expression. When the right-parenthesis character is encountered, no further processing is necessary.
Until the right parenthesis is encountered, read the expression from left to right.
if the current character is a digit, do the following:
Push its integer value onto the stack
else, if the current character is an operator:
Pop the two top elements of the stack into variables x and y.
Calculate y operator x.
Push the result of the calculation onto the stack.
End until when the right parenthesis is encountered in the expression,
Pop the top value of the stack. This is the result of the postfix expression .
[Note: (based on the sample expression at the beginning of this exercise), if the operator is '/', the top of the stack is 4 and the next element in the stack is 40, then pop 4 into x, pop 40 into y, evaluate 40 / 4 and push the result, 10, back on the stack. This note also applies to other operators.] The arithmetic operations allowed in an expression are: + (addition), - (subtraction), '' (multiplication),/ (division), A (exponentiation) and x (remainder).
You willy want to use the following methods:
a) Method evaluatePostfixExpression, which evaluates the postfix expression. It is called from main. (20)
b) Method calculate, which evaluates the expression opl operator op2. Called from evaluatePostfixExpression. (20)
c) Method printStack which prints out the stack after each push or pop. Called from evaluatePostfixExpression (multiple times) (20)
This example can all be done in a single class.
The main program simply request the postfix expression. Remember to leave a space between each digit and/or operator. (10)
Sample input/output
Please enter a postfix expression:
6 2 + 5 * 8 4 / -
The original postfix expression is:
6 2 + 5 * 8 4 / -
6
6
2
6
8
8
5
8
40
40
8
40
8
4
40
8
40
40
2
40
38
The value of the expression is: 38
Another Example:
Please enter a postfix expression:
4 5 + 3 / 4 ^ 2 -
The original postfix expression is:
4 5 + 3 / 4 ^ 2 -
4
4
5
4
9
9
3
9
3
3
4
3
81
81
2
81
79
The value of the expression
In: Computer Science
|
IN JAVA PLZ follow all directions SHOW OUPUT! Write class PostfixEvaluator that evaluates a postfix expression such as 6 2 + 5 * 8 4 / - The program should read a postfix expression consisting of single digits and operators into a StringBuilder, The program should read the expression and evaluate it (assume it's valid). The algorithm to evaluate a postfix expression is shown below. Use +, -, *, /, and ^. ^ is the exponent. Append a right parenthesis ') ' to the end of the postfix expression. When the right-parenthesis character is encountered, no further processing is necessary. Until the right parenthesis is encountered, read the expression from left to right. if the current character is a digit, do the following: Push its integer value onto the stack else, if the current character is an operator: Pop the two top elements of the stack into variables x and y. Calculate y operator x. Push the result of the calculation onto the stack. End until when the right parenthesis is encountered in the expression, Pop the top value of the stack. This is the result of the postfix expression . [Note: (based on the sample expression at the beginning of this exercise), if the operator is '/', the top of the stack is 4 and the next element in the stack is 40, then pop 4 into x, pop 40 into y, evaluate 40 / 4 and push the result, 10, back on the stack. This note also applies to other operators.] The arithmetic operations allowed in an expression are: + (addition), - (subtraction), '' (multiplication),/ (division), A (exponentiation) and x (remainder). You willy want to use the following methods: a) Method evaluatePostfixExpression, which evaluates the postfix expression. It is called from main. (20) b) Method calculate, which evaluates the expression opl operator op2. Called from evaluatePostfixExpression. (20) c) Method printStack which prints out the stack after each push or pop. Called from evaluatePostfixExpression (multiple times) (20) This example can all be done in a single class. The main program simply request the postfix expression. Remember to leave a space between each digit and/or operator. (10) Sample input/output Please enter a postfix expression: 6 2 + 5 * 8 4 / - The original postfix expression is: 6 2 + 5 * 8 4 / - 6 6 2 6 8 8 5 8 40 40 8 40 8 4 40 8 40 40 2 40 38 The value of the expression is: 38 Another Example: Please enter a postfix expression: 4 5 + 3 / 4 ^ 2 - The original postfix expression is: 4 5 + 3 / 4 ^ 2 - 4 4 5 4 9 9 3 9 3 3 4 3 81 81 2 81 79 The value of the expression |
In: Computer Science
The Cherry & White Bike Company is a small closely-held company with two owners. Its two owners, Charlotte and George, have decided to expand the business. You are CWB’s accountant. Your responsibilities include maintaining all accounting records and preparing annual financial statements.
CWB wants to take out a loan to expand its business in the coming year. The banks and lending institutions require a set of financial statements prepared under U.S. GAAP to evaluate CWB’s credit worthiness.
You must prepare a complete set of financial statements including the notes to the financial statements for the quarter ending March 31, 2018. You need to choose CWB’s accounting policies and methods for areas including inventory cost flow, revenue recognition, and depreciation. You will need to consider the proper classification of assets and liabilities as current and non-current on the balance sheet.
To obtain a loan with the lowest interest rate available, CWB needs to show high profitability, and strong liquidity and solvency. You realize the common financial statement analysis ratios for profitability, solvency and liquidity will depend on the accounting methods you choose. So, you carefully analyze the accounting choices in light of common financial statement ratios.
The owners also have expressed to you that they need to know their inventory and cost of goods sold to manage purchases and pricing. So, you are highly considering using a perpetual inventory system.
You are presented with a trial balance as of the end of 2017 and must add the transactions and activities that occurred in the first quarter of 2018 as listed below. You can add accounts to the trial balance, as needed. In the first quarter of 2018 Cherry & White Bikes had the following transactions
January 1: The owners hire Nina Marton to manage the store, paying her a salary of $2,800 a month. Lisa is paid on the 1st of every month, starting on February 1 (which would represent her January pay). They have one other employee who they pay $1,900 a month, also on the 1st of the following month. Employees work 40 hours a week.
January 14: Paid utilities for 4th quarter of 2017, $775.
February 1: Installed new light fixtures and display cases in the leased store. CWB paid $1,600 for the fixtures, $120 for shipping to the store, and $500 to an electrician to install. CWB paid 6% sales tax on the fixtures and shipping in addition to the cost of the fixtures and equipment. It did not pay a sales tax to the electrician. CWB anticipates being in the store for at least 5 years. CWB cannot take the light fixtures with them if they relocate as they will revert to the lessor.
CWB can take the display cases if they move. The display cases cost $3,400. CWB also incurred 6% sales tax on the display cases on addition to their cost.
Both the display cases and light-fixtures have a seven-year useful life.
March 1: CWB invests in a $4,000 3-month treasury bill paying interest of 3.0%.
March 24: A customer puts down a deposit of $700 on a high-end racing bike that sells for $2,900. CWB ordered the bike from the manufacturer. The manufacturer promises CWB will have the bike at the store on April 3.
Here is other information on other activity and recurring transactions that occurred during the period.
CWB offers bike tune-ups for $80 each. CWB’s employee is an expert tune-ups, taking about one hour per bike for a tune-up. Below is the number of tune-ups performed in each month. All customers pay in cash. (For recording the transactions, you can assume all tune-ups are done the last day of the month).
|
Month |
Number of Tune-Ups |
|
January |
18 |
|
February |
36 |
|
March |
30 |
CWB has the following purchases and sales of bikes during the quarter+:
|
Date |
Transaction |
Quantity |
Cost per Bike |
|
Beginning Inventory |
25 |
$110 |
|
|
January 31 |
Sale |
15 |
|
|
February 4 |
Purchase |
20 |
$115 |
|
February 10 |
Sale |
13 |
|
|
February 21 |
Sale |
15 |
|
|
March 2 |
Purchase |
28 |
$120 |
|
March 15 |
Sale |
20 |
+All purchasers of standard bikes are given the option of buying a bike for $400, or a bike with two years of tune-ups for $500. Four of the bikes sold on February 21st were sold with the tune-up option.
**All purchases were made using cash except the March 2nd purchase for which CWB obtained two-months credit from the bike supplier.
CWB took out a five-year loan for $15,000 with an interest rate of 12% on January 1, 2017. The loan matures on January 1, 2022.
CWB rents its premises for $1,000 per month, with rent due on the 15st of the prior month.
CWB has a business insurance policy, which it purchased for $3,300 on July 1, 2017. The policy runs until June 30, 2018.
CWB owns various tools and equipment which it pools for purpose of calculating depreciation. In the past it has used straight-line depreciation over a twelve-year period with no scrap or salvage value for these assets. However, with technology changing rapidly, CWB questions whether it will have to replace the equipment earlier.
On April 7 received its utilities bill for the first quarter of 2018 - $800.
The tax rate is 20%.
Cherry & White Bike Company
Post-Closing Trial Balance
12/31/2017
|
Account Title |
Debit |
Credit |
|
Cash |
$33,311 |
|
|
Store supplies |
460 |
|
|
Prepaid rent |
1,000 |
|
|
Prepaid insurance |
1,650 |
|
|
Inventory |
2,750 |
|
|
Equipment |
14,500 |
|
|
Accumulated depreciation - equipment |
$4,350 |
|
|
Accounts payable |
8,724 |
|
|
Utilities payable |
775 |
|
|
Salaries payable |
1,900 |
|
|
Interest payable |
1,800 |
|
|
Loans payable |
15,000 |
|
|
Capital stock |
20,000 |
|
|
Retained Earnings |
1,122 |
|
|
Totals |
$53,671 |
$53,671 |
NEED Journal Entries, Income Statement, Statement of retained earnings, and Balance Sheet
In: Accounting
Cherry & White Bike Company
The Cherry & White Bike Company is a small closely-held company with two owners. Its two owners, Charlotte and George, have decided to expand the business. You are CWB’s accountant. Your responsibilities include maintaining all accounting records and preparing annual financial statements.
CWB wants to take out a loan to expand its business in the coming year. The banks and lending institutions require a set of financial statements prepared under U.S. GAAP to evaluate CWB’s credit worthiness.
You must prepare a complete set of financial statements including the notes to the financial statements for the quarter ending March 31, 2018. You need to choose CWB’s accounting policies and methods for areas including inventory cost flow, revenue recognition, and depreciation. You will need to consider the proper classification of assets and liabilities as current and non-current on the balance sheet.
To obtain a loan with the lowest interest rate available, CWB needs to show high profitability, and strong liquidity and solvency. You realize the common financial statement analysis ratios for profitability, solvency and liquidity will depend on the accounting methods you choose. So, you carefully analyze the accounting choices in light of common financial statement ratios.
The owners also have expressed to you that they need to know their inventory and cost of goods sold to manage purchases and pricing. So, you are highly considering using a perpetual inventory system.
You are presented with a trial balance as of the end of 2017 and must add the transactions and activities that occurred in the first quarter of 2018 as listed below. You can add accounts to the trial balance, as needed. In the first quarter of 2018 Cherry & White Bikes had the following transactions
January 1: The owners hire Nina Marton to manage the store, paying her a salary of $2,800 a month. Lisa is paid on the 1st of every month, starting on February 1 (which would represent her January pay). They have one other employee who they pay $1,900 a month, also on the 1st of the following month. Employees work 40 hours a week.
January 14: Paid utilities for 4th quarter of 2017, $775.
February 1: Installed new light fixtures and display cases in the leased store. CWB paid $1,600 for the fixtures, $120 for shipping to the store, and $500 to an electrician to install. CWB paid 6% sales tax on the fixtures and shipping in addition to the cost of the fixtures and equipment. It did not pay a sales tax to the electrician. CWB anticipates being in the store for at least 5 years. CWB cannot take the light fixtures with them if they relocate as they will revert to the lessor.
CWB can take the display cases if they move. The display cases cost $3,400. CWB also incurred 6% sales tax on the display cases on addition to their cost.
Both the display cases and light-fixtures have a seven-year useful life.
March 1: CWB invests in a $4,000 3-month treasury bill paying interest of 3.0%.
March 24: A customer puts down a deposit of $700 on a high-end racing bike that sells for $2,900. CWB ordered the bike from the manufacturer. The manufacturer promises CWB will have the bike at the store on April 3.
Here is other information on other activity and recurring transactions that occurred during the period.
CWB offers bike tune-ups for $80 each. CWB’s employee is an expert tune-ups, taking about one hour per bike for a tune-up. Below is the number of tune-ups performed in each month. All customers pay in cash. (For recording the transactions, you can assume all tune-ups are done the last day of the month).
|
Month |
Number of Tune-Ups |
|
January |
18 |
|
February |
36 |
|
March |
30 |
CWB has the following purchases and sales of bikes during the quarter+:
|
Date |
Transaction |
Quantity |
Cost per Bike |
|
Beginning Inventory |
25 |
$110 |
|
|
January 31 |
Sale |
15 |
|
|
February 4 |
Purchase |
20 |
$115 |
|
February 10 |
Sale |
13 |
|
|
February 21 |
Sale |
15 |
|
|
March 2 |
Purchase |
28 |
$120 |
|
March 15 |
Sale |
20 |
+All purchasers of standard bikes are given the option of buying a bike for $400, or a bike with two years of tune-ups for $500. Four of the bikes sold on February 21st were sold with the tune-up option.
**All purchases were made using cash except the March 2nd purchase for which CWB obtained two-months credit from the bike supplier.
CWB took out a five-year loan for $15,000 with an interest rate of 12% on January 1, 2017. The loan matures on January 1, 2022.
CWB rents its premises for $1,000 per month, with rent due on the 15st of the prior month.
CWB has a business insurance policy, which it purchased for $3,300 on July 1, 2017. The policy runs until June 30, 2018.
CWB owns various tools and equipment which it pools for purpose of calculating depreciation. In the past it has used straight-line depreciation over a twelve-year period with no scrap or salvage value for these assets. However, with technology changing rapidly, CWB questions whether it will have to replace the equipment earlier.
On April 7 received its utilities bill for the first quarter of 2018 - $800.
The tax rate is 20%.
Cherry & White Bike Company
Post-Closing Trial Balance
12/31/2017
|
Account Title |
Debit |
Credit |
|
Cash |
$33,311 |
|
|
Store supplies |
460 |
|
|
Prepaid rent |
1,000 |
|
|
Prepaid insurance |
1,650 |
|
|
Inventory |
2,750 |
|
|
Equipment |
14,500 |
|
|
Accumulated depreciation - equipment |
$4,350 |
|
|
Accounts payable |
8,724 |
|
|
Utilities payable |
775 |
|
|
Salaries payable |
1,900 |
|
|
Interest payable |
1,800 |
|
|
Loans payable |
15,000 |
|
|
Capital stock |
20,000 |
|
|
Retained Earnings |
1,122 |
|
|
Totals |
$53,671 |
$53,671 |
HOW WOULD YOU RECORD THESE ENTRYS????
In: Accounting
A construction project has indirect costs totaling $40,000 per week. Major activities of the project, their expected time, and crashing costs per week are:
|
Crashing costs ($000) |
|||||
|
Activity |
Expected time (week) |
Predecessor |
First week |
Second week |
Third week |
|
A |
5 |
- |
18 |
22 |
- |
|
B |
4 |
- |
12 |
24 |
26 |
|
C |
3 |
- |
10 |
15 |
25 |
|
D |
8 |
A |
24 |
25 |
25 |
|
E |
12 |
B |
- |
- |
- |
|
F |
12 |
C |
8 |
13 |
- |
|
G |
6 |
B |
3 |
10 |
12 |
|
H |
7 |
D |
30 |
30 |
35 |
|
I |
4 |
H |
15 |
20 |
- |
|
J |
5 |
E |
40 |
40 |
40 |
|
K |
9 |
G |
2 |
7 |
10 |
|
L |
9 |
F |
5 |
12 |
- |
|
M |
8 |
L |
14 |
15 |
- |
|
N |
1 |
K,M |
26 |
- |
- |
|
P |
11 |
I,J |
30 |
33 |
36 |
What would be your recommended lowest cost duration for this project? Show your work. For each step specify what activity is crashed and show why.
In: Operations Management
| Assessment 1 Part 3: Computing Payroll Earnings | ||||||||||||
| Scenario: | ||||||||||||
| G. Smith of Central Manufacturing Company is paid at the rate of $30 an hour for an eight hour day, with time and and a half for overtime and double time for Sundays and holidays. Regular employment is on the basis of 40 hours a week, five days a week. At the end of the week, the labor time record shows the following: | ||||||||||||
| Job or Indirect Labor | Su | M | Tu | W | Th | F | Sa | Total | ||||
| 007 | 6 | 3 | 2 | 7 | 7 | 25 | ||||||
| 009 | 2 | 5 | 6 | 3 | 6 | 22 | ||||||
| Machine Repair | 5 | 8 | 13 | |||||||||
| Total | 5 | 8 | 8 | 8 | 10 | 13 | 8 | 60 | ||||
| Using the data above and the ledger below, compute Smith's total earnings for the week and a prepare the journal entry to distribute Smith's total earnings. | ||||||||||||
| Hours | x | Rate | = | Total | Account Debited | |||||||
| Factory Overhead | ||||||||||||
| Expense | ||||||||||||
| Regular | Time and | Double | Regular | Time and | Double | Gross | Work In | Overtime | M & R | |||
| a half | Time | a half | Time | Earnings | Process | Premium | ||||||
| Sunday indirect | 5 | |||||||||||
| Monday direct | 8 | |||||||||||
| Tuesday direct | 8 | |||||||||||
| Wednesday direct | 8 | |||||||||||
| Thursday direct | 8 | 2 | ||||||||||
| Friday direct | 8 | 5 | ||||||||||
| Saturday indirect | 8 | |||||||||||
| Totals | 40 | 15 | 5 | |||||||||
In: Accounting
| Assessment 1 Part 3: Computing Payroll Earnings | ||||||||||||
| Scenario: | ||||||||||||
| G. Smith of Central Manufacturing Company is paid at the rate of $30 an hour for an eight hour day, with time and and a half for overtime and double time for Sundays and holidays. Regular employment is on the basis of 40 hours a week, five days a week. At the end of the week, the labor time record shows the following: | ||||||||||||
| Job or Indirect Labor | Su | M | Tu | W | Th | F | Sa | Total | ||||
| 007 | 6 | 3 | 2 | 7 | 7 | 25 | ||||||
| 009 | 2 | 5 | 6 | 3 | 6 | 22 | ||||||
| Machine Repair | 5 | 8 | 13 | |||||||||
| Total | 5 | 8 | 8 | 8 | 10 | 13 | 8 | 60 | ||||
| Using the data above and the ledger below, compute Smith's total earnings for the week and a prepare the journal entry to distribute Smith's total earnings. | ||||||||||||
| Hours | x | Rate | = | Total | Account Debited | |||||||
| Factory Overhead | ||||||||||||
| Expense | ||||||||||||
| Regular | Time and | Double | Regular | Time and | Double | Gross | Work In | Overtime | M & R | |||
| a half | Time | a half | Time | Earnings | Process | Premium | ||||||
| Sunday indirect | 5 | |||||||||||
| Monday direct | 8 | |||||||||||
| Tuesday direct | 8 | |||||||||||
| Wednesday direct | 8 | |||||||||||
| Thursday direct | 8 | 2 | ||||||||||
| Friday direct | 8 | 5 | ||||||||||
| Saturday indirect | 8 | |||||||||||
| Totals | 40 | 15 | 5 | |||||||||
In: Accounting
Compute a one-way ANOVA on the following data.
113 120 132 122 121 127 130 118 117 125 129 125 110 125 130 121
Determine the F test. Compare it with the critical F value and decide whether to reject the null hypothesis. Use a 1% level of significance.
In: Statistics and Probability
1. It is quite interesting that most of us are likely to be able to read and comprehend words, even if the alphabets of these words are scrambled (two of them) given the fact that the first and last alphabets remain the same. For example,
“I dn'ot gvie a dman for a man taht can olny sepll a wrod one way.” (Mrak Taiwn)
“We aer all moratls, Hamrbee is an immoratl, and tehre is no question abuot it.” (Kevin Unknown)
2. Write a method named scramble that returns a String and takes a String as an argument.
A. The argument is actually a word (of length 6 or more).
B. It then constructs a scrambled version of that word, randomly flipping two characters other than the first and last one.
3. Then write the main method in which you would read the word from the user, send it to scramble, and print the scrambled word.
A. You can use a loop to read multiple words if you like but it is not necessary.
B. If the length of the entered word is less than 6, you should keep prompting the user to enter a valid word.
4. After writing all the comments, generate a Javadoc and submit it with the java file.
Hint: First generate two random integers in range of the length of the string. Then use substring method to access characters at those locations. Rest is left to your imagination.
In: Computer Science
assume that the following table represents the daily supply of labor at a shirt factory in Haiti – and that labor’s marginal revenue product (MRP) is a constant amount of one hundred ten dollars ($110) per day over the relevant range of hiring considerations.
QLabor W = ACF TCF MCF = ∆TCF/∆QLabor
--------------------------------------------------------------------------------------------------------------
30 $40/day $1,200
--------------------------------------------------------- $ 800/10 = $ 80
40 $50/day $2,000
--------------------------------------------------------- $1,000/10 = $100
50 $60/day $3,000
--------------------------------------------------------- $1,200/10 =
60 $70/day $4,200
--------------------------------------------------------- $
70 $80/day $
Based upon the information above, which of the following statements is correct?
a. This appears to be a competitive labor market (-one that resembles perfect
competition-).
b. The firm will maximize profit off the use of labor by hiring 50 workers.
c. A wage rate of $110 per day will maximize this firm’s profit.
d. These workers will be paid an amount greater than the value of their marginal
output (MRP).
In: Economics