Use Python 3.8:
Problem Description
Many recipes tend to be rather small, producing the fewest number of servings that are really possible with the included ingredients. Sometimes one will want to be able to scale those recipes upwards for serving larger groups.
This program's task is to determine how much of each ingredient in a recipe will be required for a target party size. The first inputs to the program will be the recipe itself.
Here is an example recipe that comes from the story "Chitty Chitty Bang Bang", written by Ian Fleming, who is much better known for introducing the world to James Bond:
This is a recipe scaler for serving large crowds! Enter one ingredient per line, with a numeric value first. Indicate the end of input with an empty line. 4 tbsp cocoa 1/4 pound butter 2 tsp corn syrup 1 can evaporated milk 1 tsp water Here is the recipe that has been recorded 4 tbsp cocoa 1/4 pound butter 2 tsp corn syrup 1 can evaporated milk 1 tsp water How many does this recipe serve? 16 How many people must be served? 25 Multiplying the recipe by 2 8 tbsp cocoa 2/4 pound butter 4 tsp corn syrup 2 can evaporated milk 2 tsp water Serves 32
NOTE: The recipe rounds upwards, since it is usually not practical to obtain fractional cans or fractional eggs, etc.
Your program must obtain a complete recipe (not necessarily this one), echo it with good formatting, and then scale it up as shown above.
Program Hints:
Attractive user-friendly output is rather straightforward, with the help of Python's string formatting features. User-friendly input is a little trickier, but the split function from Unit 2 can be very helpful:
First hint:
The name of an ingredient might be more than one word. This will place all of the extra words into a single string variable 'item':
quant, unit, item = line.split(' ',2) # pull off at most 2 words from the front
Second hint:
Sometimes the measure will be fractional. We can recognize that if the number contains a slash.
if '/' in quant:
numer, denom = quant.split('/') # get the parts of the fraction
The rest is left up to the student -- since this is a string operation and this fraction represents a number.
Second Part:
No doubt the output seems to be a little strange to ask for 2/4 pounds of butter. One might think it would be better to ask for 1/2.
Modify the program so that all fractions are reduced to their lowest terms. There is a function in the Python math module named gcd that can help with this. (You can email course personnel if you need help accessing the math features.)
Also, express all improper fractions (where the numerator exceeds the denominator) as mixed fractions. Scaling this recipe by a factor of 10 would ask for 2 1/2 pounds of butter.
And of course, the resulting output should still be easy to read.
Other Guidelines:
Clarity of code is still important here -- and clear code is less likely to have bugs.
In particular, there should be very good and clear decisions in the code.
And there will be a penalty for usage of break or continue statements.
Planning out the design of the solution before diving into code will help!
The simplest solutions would use a list, but without any
indexing on that list
(or use of range() to get those indexes). Let Python
help you fill and traverse the recipe.
Storing the entire recipe in a single list before splitting things up often produces much simpler programs than trying to store everything into multiple separate lists!
IMPORTANT NOTE: As above, the recipe is provided as input to the program -- it is not part of the program itself. The program may not assume it knows what the ingredients are, or how many there are, or which ingredients have fractions and which ones do not. It must work for any number of valid input lines.
TASKS:
Recipe Data Structure: Effectively uses list (either parallel lists or lists of structures)
Input Recipe: Clearly reads input until blank line encountered
Serving Inputs: Correctly inputs two values: how many recipe serves, and how many will be served
Computing the Scale: math.ciel; if/else to round up; or anything else equivalent
Parsing the ingredients: Correctly parses ingredients (using given 'tricks') May be done at any point in the program
Scaling the recipe: Multiplies whole numbers and numerators by chosen scaling factor
Reduced fraction: Reduces using gcd; denominator 1 reported as whole numbers
Output presentation: Uses string formatting to present output recipe
Compilation: Program runs fully without change (with valid inputs of 3+ words separated with single spaces)
Correctness: Program behaves as expected (accounting for known errors above)
Program can handle "1 egg" as an ingredient (with only once space)
Only Python 3.8 will be allowed.
In: Computer Science
A 45.4 kg, 3.8 m uniform ladder leans against a frictionless wall. A 99.1 kg person is standing on the ladder down 1.04 m from the top of the ladder. The ladder makes an angle of 50 degrees with the horizontal. What is the minimum coefficient of static friction between the ladder and the ground so that the ladder does not slip?
In: Physics
Sovle with python 3.8 please.
1, Write a function called same_without_ends that has two string parameters. It should return True if those strings are equal WITHOUT considering the characters on the ends (the beginning character and the last character). It should return False otherwise. For example, "last" and "bask" would be considered equal without considering the characters on the ends. Don't worry about the case where the strings have fewer than three characters. Your function MUST be called same_without_ends. You can write code in the main part of your program to test your function, but when you submit, your code must ONLY have the function definition!
2, Write a function called replace_es_with_threes that has a single string parameter. It should return a version of the string where all instances of the letter e have been replaced by the digit 3.
Your function MUST still be called replace_es_with_threes. You can write code in the main part of your program to test your function, but when you submit, your code must ONLY have the function definition!
In: Computer Science
A race car starts from rest, accelerates at a constant rate of 3.8 m/s^2 for 23s, and then brakes (decelerates) at a constant rate of 5.6 m/s^2 (magnitude) until it comes to a stop. (a) Find the total distance traveled by the car before coming to rest. (b) Draw a graph of the velocity vs. time, and indicate numerical values of any “special points”on the graph.
In: Physics
A Corporation has recently acquired a small manufacturing operation in British Columbia that produces one of its more popular items. This plant will provide these units for resale in retail hardware stores in British Columbia and Alberta. Because the budget prepared by the plant was incomplete, Jordan Leigh, Waterways’ CFO, was sent to B.C. to oversee the plant’s budgeting process for the second quarter of 2017. Jordan asked the various managers to collect the following information for preparing the second-quarter budget. Sales Unit sales for February 2017 99,000 Unit sales for March 2017 111,000 Expected unit sales for April 2017 119,000 Expected unit sales for May 2017 124,000 Expected unit sales for June 2017 129,000 Expected unit sales for July 2017 144,000 Expected unit sales for August 2017 169,000 Average unit selling price $12 Based on the experience from the home plant, Jordan has suggested that the B.C. plant keep 10% of the next month’s unit sales in ending inventory. The plant has contracts with some of the major home hardware giants, so all sales are on account; 50% of the accounts receivable is collected in the month of sale, and the balance is collected in the month after sale. This was the same collection pattern from the previous year. The new plant has no bad debts. Direct Materials The combined quantity of direct materials (consisting of metal, plastic and rubber) used in each unit is 1.10 kg. Metal, plastic, and rubber together amount to $1.50 per kg. Inventory of combined direct material on March 31 consisted of 13,145 kg. This plant likes to keep 10% of the materials needed for the next month in its ending inventory. Fifty percent of the payables is paid in the month of purchase, and 50% is paid in the month after purchase. Accounts Payable on March 31 will total $124,800. Direct Labour Labour requires 15 minutes per unit for completion and is paid at an average rate of $12 per hour. Manufacturing Overhead Indirect materials $0.50 per labour hour Indirect labour $0.50 per labour hour Utilities $0.60 per labour hour Maintenance $0.30 per labour hour Salaries $44,800 per month Depreciation $14,400 per month Property taxes $2,200 per month Insurance $1,050 per month Janitorial $2,400 per month Selling and Administrative Variable selling and administrative cost per unit is $1.40. Advertising $12,000 a month Depreciation $2,600 a month Insurance $1,200 a month Other fixed costs $3,500 a month Salaries $60,000 a month Other Information The Cash balance on March 31 will be $115,000, but Waterways has decided it would like to maintain a cash balance of at least $500,000 beginning on April 30. The company has an open line of credit with its bank. The terms of the agreement require borrowing to be in $1,000 increments at 2% interest. Borrowing is considered to be on the first day of the month and repayments are on the last day of the month. Assume interest is paid at the end of the quarter. In May, $880,000 of new equipment to update operations will be purchased. Three months’ insurance is prepaid on the first day of the first month of the quarter. For the second quarter of 2017, prepare a schedule for expected cash collections from customers. (Round answers to 0 decimal places, e.g. 5,275.) April May June Total Collections from March $ $ $ $ April April May May June Total cash collections A Corporation has recently acquired a small manufacturing operation in British Columbia that produces one of its more popular items. This plant will provide these units for resale in retail hardware stores in British Columbia and Alberta. Because the budget prepared by the plant was incomplete, Jordan Leigh, Waterways’ CFO, was sent to B.C. to oversee the plant’s budgeting process for the second quarter of 2017. Jordan asked the various managers to collect the following information for preparing the second-quarter budget. Sales Unit sales for February 2017 99,000 Unit sales for March 2017 111,000 Expected unit sales for April 2017 119,000 Expected unit sales for May 2017 124,000 Expected unit sales for June 2017 129,000 Expected unit sales for July 2017 144,000 Expected unit sales for August 2017 169,000 Average unit selling price $12 Based on the experience from the home plant, Jordan has suggested that the B.C. plant keep 10% of the next month’s unit sales in ending inventory. The plant has contracts with some of the major home hardware giants, so all sales are on account; 50% of the accounts receivable is collected in the month of sale, and the balance is collected in the month after sale. This was the same collection pattern from the previous year. The new plant has no bad debts. Direct Materials The combined quantity of direct materials (consisting of metal, plastic and rubber) used in each unit is 1.10 kg. Metal, plastic, and rubber together amount to $1.50 per kg. Inventory of combined direct material on March 31 consisted of 13,145 kg. This plant likes to keep 10% of the materials needed for the next month in its ending inventory. Fifty percent of the payables is paid in the month of purchase, and 50% is paid in the month after purchase. Accounts Payable on March 31 will total $124,800. Direct Labour Labour requires 15 minutes per unit for completion and is paid at an average rate of $12 per hour. Manufacturing Overhead Indirect materials $0.50 per labour hour Indirect labour $0.50 per labour hour Utilities $0.60 per labour hour Maintenance $0.30 per labour hour Salaries $44,800 per month Depreciation $14,400 per month Property taxes $2,200 per month Insurance $1,050 per month Janitorial $2,400 per month Selling and Administrative Variable selling and administrative cost per unit is $1.40. Advertising $12,000 a month Depreciation $2,600 a month Insurance $1,200 a month Other fixed costs $3,500 a month Salaries $60,000 a month Other Information The Cash balance on March 31 will be $115,000, but Waterways has decided it would like to maintain a cash balance of at least $500,000 beginning on April 30. The company has an open line of credit with its bank. The terms of the agreement require borrowing to be in $1,000 increments at 2% interest. Borrowing is considered to be on the first day of the month and repayments are on the last day of the month. Assume interest is paid at the end of the quarter. In May, $880,000 of new equipment to update operations will be purchased. Three months’ insurance is prepaid on the first day of the first month of the quarter. For the second quarter of 2017, prepare a schedule for expected cash collections from customers. (Round answers to 0 decimal places, e.g. 5,275.) April May June Total Collections from March $ $ $ $ April April May May June Total cash collections
In: Accounting
Intermediate Accounting I
Accounting Project
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 Lisa Marton to manage the store, paying her a salary of $3,000 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 $2,000 a month, also on the 1st of the following month.
January 14: Paid utilities for 4th quarter of 2017, $875.
February 1: Installed new light fixtures and display cases in the leased store. CWB paid $1,800 for the fixtures, $230 for shipping to the store, and $800 to an electrician to install. The landlord gave CWB permission to remove and dispose of the old fixtures. CWB sold the old fixtures for $110. CWB anticipates being in the store for at least 3 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, which cost $5,400, if they move.
Both the display cases and light-fixtures have a six-year useful life.
March 1: CWB invests in a $2,000 3-month treasury bill paying interest of 2.0%
March 12: One of the standard bikes sold was returned by the customer. The bike sold for $225. CWB paid $80 for it. CWB provided a full refund. CWB’s policy is to provide a customer with a full refund within 30 day of purchase as long as the bike is returned in good condition. While the bike is in good working condition, CWB does not anticipate being able to sell the bike as new – rather it anticipates marking it down and selling it for $150.
March 24: A customer puts down a deposit of $400 on a high-end racing bike that sells for $2,800. 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 rents its premises for $1,600 per month, with rent due on the 15st of the prior month.
-CWB has a business insurance policy, which it purchased for $5,280 on May 1, 2017. The policy runs until April 30, 2018.
CWB has a $15,000 loan outstanding at an interest rate of 10% a year, with annual interest due on January 1. The loan matures on January 1, 2021.
CWB offers bike tune-ups for $80 each. CWB’s employees are experts in adjusting brakes. 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 |
12 |
|
February |
35 |
|
March |
30 |
CWB has the following purchases and sales of racing bikes (there were no racing bikes in beginning inventory)*:
|
Date |
Transaction |
Quantity |
Cost per Bike |
Sales Price per Bike |
|
January 15 |
Purchase |
10 |
$150 |
|
|
January 25 |
Purchase |
15 |
$155 |
|
|
February 12 |
Sale |
10 |
$635 |
|
|
February 13 |
Purchase |
14 |
$170 |
|
|
March 1 |
Sale |
20 |
$640 |
|
|
March 20 |
Purchase |
10 |
$180 |
*All purchasers of racing bikes are given two years of complimentary tune-ups. No tune-ups on bike’s sold were performed in the current quarter.
**All purchases were made using cash except the March 20th purchase for which CWB obtained three-months credit from the bike supplier.
CWB has 25 standard bikes in beginning inventory. The bikes were purchased at a price of $101 each. The following purchases and sales of standard bikes occurred during the quarter:
|
Date |
Transaction |
Quantity |
Cost per Bike |
|
January 31 |
Sale |
10 |
|
|
February 17 |
Purchase |
19 |
$111 |
|
February 19 |
Sale |
25 |
|
|
March 2 |
Purchase |
22 |
$120 |
+All purchasers of standard bikes are given the option of buying a bike for $285, or a bike with two years of tune-ups for $355. Three of the bikes sold on February 19th were sold with the tune-up option. No tune-ups on bike’s sold were performed in the current quarter.
CWB has 12 children’s bikes in beginning inventory. The bikes were purchased at a price of $98 each. The following purchases and sales of children’s bikes occurred during the quarter^:
|
Date |
Transaction |
Quantity |
Cost per Bike |
Sales Price per Bike |
|
January 3 |
Purchase |
30 |
$95 |
|
|
January 25 |
Sale |
5 |
$175 |
|
|
February 12 |
Sale |
10 |
$180 |
|
|
February 13 |
Purchase |
15 |
$99 |
|
|
March 11 |
Sale |
25 |
$175 |
^Tune-ups are not usually performed on children’s bikes
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 ten-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 Utility bill for the first quarter of 2018 - $945.
- The tax rate is 20%.
QUESTION: HI I have all of the journal entries done except inventory and COGS was wondering If could get help them. I cant figure out how to account for inventory and cost of goods sold. Thanks so much!
In: Accounting
XY merchandising has 20 coffee mugs in the beginning inventory at a cost of $5 per coffee mug . on february 1,2012 they purchase 10 coffee mugs on account (Each coffee mug cost $6). On februay 5,2012 they sell coffee mugs for $10 per coffee mug on account. The business uses first in first out. prepare the entry XY merchandising would make to record the sale of february 5,2012.
a) debt: accounts receivable -$150
credit: revenue - $150 debit:
cost of goods sold-$85
credit: inventory -$85
b) debt: accounts receivable - $150
credit: revenue - $150
debt: cost of goods sold - $80
credit: inventory - $80
c) debt: accounts receivable - $150
credit: revenue - $150
debt: cost of goods sold - $75
credit: inventory - $75
d) no entries needed on february 5, 2012
In: Accounting
1. GDP (Y) = C + I + G
Consumption = 10 + .75Y
Investment = 20 + .15Y
Government = 35
The size of the expenditure multiplier for this hypothetical economy is
a. 4.
b. 10.
c. 2.
d. none of the other answers are correct.
2. Find the level of equilibrium income, given the following values for the economy:
Consumption = 10 + .75Y
Investment = 20 + .15Y
Autonomous Taxes = 20
Government = 30
a. 180
b. 300
c. None of the other answers are correct.
d. 450
3. An economy with a marginal propensity to consume = .8 also has a marginal propensity to invest (an induced variable) = .1
When policy makers increase government spending by $ 100, we should expect (ceteris paribus) that income will increase by
a. none of the other answers are correct.
b. $ 100.
c. $ 200.
d. $ 500.
4. The most deflationary policy, ceteris paribus, among the following is
a. an appreciating domestic currency.
b. a reduction in reserve requirements.
c. a broad based tax cut.
d. a balanced-budget increase in both government spending and autonomous taxes.
e. a reduction in money demand.
f. an open market purchase by the central bank.
In: Economics
Ture or False.
1. In addition to the fact the opportunity cost of using a commodity as the medium of exchange is substantially greater than the opportunity cost of using a commodity as the medium of exchange is substantially greater than the opportunity cost of using fiat money, the monetary authority in an economy in which the medium of exchange is fiat money has greater discretion in its pursuit of monetary policies that deliver price stability.
2. According to fisher equation, if expected inflation increase by x percent the nominal interest rate will also increase by x percent but th real interest rate will not be affect.
3. The demand curve for loanable funds reflects the behavior of deficit spending units while the behavior underlying the bond demand curve is that of surplus spending units.
4. The ex-post real interest rate is most useful for planning purposes while the ex-ante real interest rate is more useful for ecaluating results of prior decisions.
5.A fundamental problem with yield curves based on corporate bonds is that differing degrees of default risk among corporate bonds would make it difficult to unambiguously assign responsibility for observed yield differentials to variation in length of time to maturity.
In: Economics
26. If average labor productivity increases, then the same number of employed workers will always produce:
A) more total output. B) less total output. C) less output per person. D) more output per person.
27. When jobs are hard to find, profits are low, few wage increases are given, and many companies go out of business, the economy is most likely in a(n):
A) expansion. B)recession. C) boom. D) shortage.
28. The rate at which prices in general are increasing is called:
A) the unemployment rate. B) the inflation rate. C) the trade balance. D) the standard of living.
29. A trade deficit occurs when:
A) exports are less than imports.
B) government revenue exceeds government
spending.
C) government spending exceeds government
revenue.
D) exports exceed imports.
30. Major macroeconomic issues include differences across countries in all of the following EXCEPT:
A) inflation rates B) economic growth rates C) unemployment rates D) infant mortality rates
31. Macroeconomic issues include all of the following EXCEPT:
A) energy reserves B) productivity C) economic growth D) recessions and expansions
In: Economics