Case Study 3: Free Clinic Woes
As the director of Franklin Creek District Health Department, Jane Potterfield was proud of her self. She had gotten a small grant from a local corporation for a part-time receptionist and had received free use of an old store in one of her counties the county that was most rural. She also had all she needed to start a free clinic.
This primary care clinic would be available for those in the rural county who were working but unable to afford health insurance. In other word, they were too poor to afford an individual health plan but probably too rich to be eligible for Medicaid. Because all services were to be free, the state would furnish special help, such as free malpractice insurance coverage for the doctors.
Furthermore, the state health department had given Janeâs health department approval to hold a childhood vaccine program in the same rural building twice a month. This would make it possible to increase the number of rural children who got immunized according to the state timetables.
Jane was at her desk preparing an agenda for the next board of health meeting, with all this good news on it. She felt that she was really making a difference in her region.
Suddenly, there was a knock at her office door.
Jane looked up to see a member of the board of health, Dr. Karen Matthewsen. Jane felt Karen was the best board member they had. Karen was a country doctor who worked in the rural county where Janeâs concerns were the strongest, and Karen was a champion of the medically indigent throughout the whole region.
âCome in, Karen,â Jane said with enthusiasm. âYou can perhaps give me some help drawing up the agenda item about the wonderful new free clinic and vaccine program.â
âWell, that is why I wanted to come see you, Jane I am worried about those new developments.â Karen said these words as she sat down in the guest chair by Janeâs desk. Karen was clearly upset.
âBut you are the biggest champion for the dispossessed on our board. I thought you would be tickled pink to see more services opening where the need is so great.â Jane was also getting a little upset. This reaction from her old friend was not expected.
âAs you know, Jane, I see more poor patients than any other doctor in the area, and I must say that it is tough enough to make a living in a rural county without having neighboring doctors come in and give free care. I know they are not supposed to take my Medicaid patients, but I operate on a close margin closer than you might expect and the loss of even underpaying private pay patients and maybe some Medicaid ones, too, is problematic. Some patients might even prefer your services to going on Medicaid, while I work to get my uninsured patients covered by Medicaid and never turn a Medicaid patient down.
âFurthermore, lots of residents of our rural county could use the new childhood vaccine program you are offering, and those vaccines represent 20% of my practice net income every summer in the month before school opens.â
Jane countered by noting that the free clinic would be encouraging eligible individuals to sign up for Medicaid and to see local doctors, but Karen noted that the free clinic would not be operating but two half days a week, and with volunteer labor, it would be unlikely to do a lot of follow up and paperwork.
âNo,â Karen said, looking Jane straight in the eye. âI must say that, for the first time, I am against a new health department program aimed at the indigent. I believe country doctors like me need to be free of well-meaning government initiatives that are redundant, with private enterprises already struggling financially. I plan to vote against the clinic.â
Questions;
1.How do you feel about Karenâs position? What are its strengths and weaknesses?
2.Organizational staff people like to avoid having many split votes on crucial issues. What can Jane do to meet the needs of her community and maintain the boardâs unity. Is there an effective compromise position that can be championed?
3.If you were a working but poor person needing care in the rural county, what would you recommend the board do
In: Nursing
ALMOST half the worldâs population now lives in a democracy, according to the Economist Intelligence Unit, a sister organisation of this newspaper. And the number of democracies has increased pretty steadily since the second world war. But it is easy to forget that most nations have not been democratic for much of their history and that, for a long time, democracy was a dirty word among political philosophers.
One reason was the fear that democratic rule would lead to ruin. Plato warned that democratic leaders would ârob the rich, keep as much of the proceeds as they can for themselves and distribute the rest to the peopleâ. James Madison, one of Americaâs founding fathers, feared that democracy would lead to âa rage for paper money, for an abolition of debts, for an equal division of property and for any other improper or wicked projectsâ. Similarly John Adams, the countryâs second president, worried that rule by the masses would lead to heavy taxes on the rich in the name of equality. As a consequence, âthe idle, the vicious, the intemperate would rush into the utmost extravagance of debauchery, sell and spend all their share, and then demand a new division of those who purchased from them.â
Democracy may have its faults but alternative systems have proved no more fiscally prudent. Dictatorships may still feel the need to bribe their citizens (eg, via subsidised fuel prices) to ensure their acquiescence while simultaneously spending large amounts on the police and the military to shore up their power. The absolute monarchies of Spain and France suffered fiscal crises in the 17th and 18th centuries, and were challenged by Britain and the Netherlands which, though not yet democracies, had dispersed power more widely. Financial problems contributed to the collapse of the Soviet Union.
Nevertheless, with much of the democratic world now in the throes of a debt crisis, it is tempting to ask whether the fears of Madison and Adams have come to pass. Given the rise in inequality in America and Britain over the past 30 years, it is hard to argue that democracies have led to the confiscation of private wealth. Quite the reverse: modern American politicians either need to be wealthy, or need the financial backing of the rich.
But there is a broader problem. Modern governments play a much larger role in the economy than the ancient Greeks or the founding fathers could have imagined. This makes political leaders a huge source of patronage, in the form of business contracts, social benefits, jobs and tax breaks. As the late political scientist, Mancur Olson, pointed out, these goodies are highly valuable to the recipients but the cost to the average voter of any single perk will be small. So beneficiaries will have every incentive to lobby for the retention of their perks and taxpayers will have little reason to campaign against them. Over time the economy will be weighed down by all these costs, like a barnacle-encrusted ship. The Greek economy could be seen as a textbook example of these problems.
One answer could be to take fiscal policy out of the hands of elected leaders, just as responsibility for monetary policy has been handed to independent central bankers. To some extent, that has been happening. Greece was briefly run by Lucas Papademos, an unelected former central banker, and Italy is still ruled by Mario Monti, a former EU commissioner. These technocrats are, it is assumed, more willing to take unpopular decisions.
Another approach, with which America has occasionally flirted, is to pass decisions to a bipartisan commission. (This may be the best answer to the âfiscal cliffâ that looms in 2013.) Since the decisions of such a commission, and indeed of technocrats in Greece and Italy, are still subject to a parliamentary vote, democracy is not completely abandoned.
For a long time, there did not seem to be any limit to the amount democracies could borrow. Creditors have been more patient with democratic governments than with other regimes, probably because the risk of abrupt changes of policy (like the repudiation of Tsarist debts by Russia in 1917) are reduced. But this has postponed the crunch point, rather than eliminated itâand allowed stable democracies to accumulate higher debt, relative to their GDP, than many, more volatile countries ever achieved. Governments can, as Madison suggested, confiscate the wealth of domestic creditors via inflation, taxes or default. But however often they vote, democracies cannot make foreign lenders extend credit. That harsh truth is now being discovered.
__________________
This question is based on the article above, âDemocracies and debtâ published by The Economist on September 1, 2012.
(A) According to the article, what are the two main factors that tend to raise public debt levels in democracies?
(B) The article mentions three mechanisms that can curb excessive government borrowing in democracies. What are those mechanisms? How do they work?
In: Economics
Blue Apron IPO Leaves a Bad Taste Founded in 2012, Blue Apron is one of the top meal-kit delivery services doing business in the United States. Started by three co-founders—Matt Salzberg, Matt Wadiak, and Ilia Pappas—Blue Apron provides pre-portioned ingredients (and recipes) for a meal, delivered to consumers’ front doors. According to recent research, the U.S. meal-kit delivery industry is an $800 million business with the potential to scale up quickly, as more and more consumers struggle to find time to go grocery shopping, make meals, and spend time with family and friends in their hectic daily lives. As word spread among foodies about the quality and innovative meals put together by Blue Apron, the company’s popularity took off, supported by millions in start-up funding. Costs to scale the business have not been cheap—estimates suggest that Blue Apron’s marketing costs have been high. Despite the challenges, by early 2017 the company was selling more than 8 million meal kits a month and decided to go public in an effort to raise more money and scale its operations, including a new fulfillment facility in New Jersey. According to the IPO paperwork filed with the SEC, the company had net revenues of $84 million in 2014, which increased to $795 million in 2016. However, those ambitious numbers were not without warnings: company losses increased in the same time period from $33 million to $55 million. Even with those larges losses on its balance sheet, Blue Apron decided to go ahead with the IPO and hired Goldman Sachs and Morgan Stanley, two top stock underwriters, to figure out the right price for the initial offering. While Blue Apron and its underwriters were finalizing stock prices, Amazon announced plans to acquire Whole Foods—a move that could negatively affect Blue Apron’s business going forward. Even after Amazon’s announcement, Blue Apron and its financial advisors priced the initial offering at $15 to $17 a share and met with investors across the country to inform them about the IPO, which would value the company on paper at more than $3 billion. As part of the IPO strategy, Blue Apron executives needed to communicate a strong financial picture while providing potential investors with an honest assessment of investor demand, especially for institutional investors, who typically are repeat buyers when it comes to IPOs. According to sources close to the IPO experience, Blue Apron’s bankers told investors late in the IPO pricing process that they were “closing their order books early,” which meant there was a heightened demand for the stock—a signal that the stock would be priced in the original $15–$17 range. A day later, however, Blue Apron amended its prospectus with a price range between $10 and $11 a share, which shocked potential investors—a move greeted with criticism that Blue Apron’s messaging now lacked credibility in the eyes of the investment community if the company priced the IPO $5 lower per share than originally estimated. With that sudden change in the IPO offering, investors walked away, and the $10 initial offering for Blue Apron stock actually declined on its first day of trading. As of this writing, the stock has lost close to 40 percent from the original $10-per-share price. With continued consolidation in the meal-kit delivery sector inevitable, Blue Apron is at a crossroads when it comes to generating revenue and stabilizing costs while trying to sign up more subscribers. One of its competitors, Plated, was recently acquired by the Alberstons grocery chain, and Amazon has already trademarked the phrase, “We do the prep. You be the chef,” as it relates to prepared food kits. Critical Thinking Questions What issues should executives of a company such as Blue Apron consider before deciding to go public? In your opinion, was the company ready for an IPO? Why or why not? How else could Blue Apron have raised funds to continue to grow? Compare the risks of raising private funding to going public. Use a search engine and a site such as Yahoo! Finance to learn about Blue Apron’s current Prepare a brief summary, including the company’s current financial situation. Is it still a public company, and how has its stock fared? Would you invest in it? Explain your reasoning.
In: Finance
Case Study 2 â Auditing ACCT3000 (Semester 2, 2019)
You are an Audit Senior currently planning the 30 June 20X9 audit
of Technology Limited, an Australian-owned company that produces
and exports computer chips to China. At a recent planning meeting
with Technology Limitedâs senior staff, you obtained the following
overview of this yearâs operations:
Tight checks by Australian custom officials have delayed several
shipments of computer chips. These delays have angered Chinese
customers who are threatening to deduct 20% from the amounts owing
as compensation for lost production time.
One of Technology Limitedâs customers, Blue Chip Limited, is
claiming that the latest batch of computer chips it received was
found to be faulty. Blue Chip Limited is refusing to pay its
account, which is allegedly seven months overdue. Technology
Limited has claimed to have launched an investigation into the
allegations, but as yet not been able to substantiate them.
Technology Limited has suffered significant cash flow problems
because another major customer, Creative Limited (Creative), is
experiencing financial difficulties. As a result, Creative is
taking well over 120 days to pay outstanding amounts, despite
Creativeâs terms of trade being payment within 30 days. Creative
makes up 40 per cent of Technology Limitedâs sales and the board
has been reluctant to take any action that might adversely affect
those sales. Consequently, Technology Limited has had to increase
its dependency on its line of credit, and this has caused it to
temporarily breach the debt to equity ratio required in its loan
covenant with Big Bank Limited.
One of Technology Limitedâs major suppliers went bankrupt one month
ago, causing major product shortages. To overcome the problem,
Peter James, the husband of the finance director, Natalie James,
provided electronic components used in the production of computer
chips to Technology Limited through his private company Norton
Limited. Norton Limited demands payment in $US prior to the
electronic components being supplied. There is no formal agreement
in place with Peter James, however, the goods are being provided at
competitive prices. You are concerned about the electronic
components that Peter Jamesâ company is supplying, because his
products are new to the market and you have heard some of
Technology Limitedâs staff complaining that they are of poor
quality.
Due to increased competitive pressure, Technology Limited has
recently moved the manufacture of some of its computer chips to
Bangladesh. Technology Limited saves around 25 per cent in costs
compared to the equivalent Australian made items. However, the
manufacturing process takes longer and on a few occasions late
delivery from Bangladesh has resulted in lost sales.
Last month, a protester suffered a broken leg, allegedly because he
was hit by a company truck. The protester is now suing Technology
Limited for damages, claiming the contractor was in fact an
employee of Technology Limited at the time of the accident, and was
acting on Technology Limitedâs instructions. Technology Limited is
fighting the case and appears to have a reasonable chance of
winning; however, the adverse publicity being generated is making
the company nervous about its sales in the future.
During the period, the Australian dollar has remained steady
against the Chinese Yuan, although it fell by about 3% against the
US dollar. Debtors are invoiced in $US at the time of shipment, and
payment is received in $US one month after the shipment is
delivered. It takes around six weeks for the charter vessels to
travel from Technology Limitedâs shipyard at Bigmantle Bay to
China. A recent downturn in the Chinese economy is affecting
forward orders, which have fallen by 15%.
Required:
Prepare a memorandum to the audit manager, outlining your risk
assessment relating to Technology
Limited. When making your risk assessment:
(a) Identify two (2) balance sheet accounts from the information
provided that are subjected
to an increase in audit risk. Briefly explain what factors increase
the audit risk associated
with the two (2) account balances identified. In your explanation,
please mention the key
assertion(s) at risk of material misstatement and the components of
the audit risk model
affected for each account balance identified.
(b) Identify how the audit plan will be affected and recommend
specific audit procedures to
address the risks associated with each account balance
identified.
(Please Note â Maximum Word Limit: 800 Words excluding
references)
In: Accounting
This question is based on the article below:
Article: Democracies and debt
ALMOST half the worldâs population now lives in a democracy, according to the Economist Intelligence Unit, a sister organisation of this newspaper. And the number of democracies has increased pretty steadily since the second world war. But it is easy to forget that most nations have not been democratic for much of their history and that, for a long time, democracy was a dirty word among political philosophers.
One reason was the fear that democratic rule would lead to ruin. Plato warned that democratic leaders would ârob the rich, keep as much of the proceeds as they can for themselves and distribute the rest to the peopleâ. James Madison, one of Americaâs founding fathers, feared that democracy would lead to âa rage for paper money, for an abolition of debts, for an equal division of property and for any other improper or wicked projectsâ. Similarly John Adams, the countryâs second president, worried that rule by the masses would lead to heavy taxes on the rich in the name of equality. As a consequence, âthe idle, the vicious, the intemperate would rush into the utmost extravagance of debauchery, sell and spend all their share, and then demand a new division of those who purchased from them.â
Democracy may have its faults but alternative systems have proved no more fiscally prudent. Dictatorships may still feel the need to bribe their citizens (eg, via subsidised fuel prices) to ensure their acquiescence while simultaneously spending large amounts on the police and the military to shore up their power. The absolute monarchies of Spain and France suffered fiscal crises in the 17th and 18th centuries, and were challenged by Britain and the Netherlands which, though not yet democracies, had dispersed power more widely. Financial problems contributed to the collapse of the Soviet Union.
Nevertheless, with much of the democratic world now in the throes of a debt crisis, it is tempting to ask whether the fears of Madison and Adams have come to pass. Given the rise in inequality in America and Britain over the past 30 years, it is hard to argue that democracies have led to the confiscation of private wealth. Quite the reverse: modern American politicians either need to be wealthy, or need the financial backing of the rich.
But there is a broader problem. Modern governments play a much larger role in the economy than the ancient Greeks or the founding fathers could have imagined. This makes political leaders a huge source of patronage, in the form of business contracts, social benefits, jobs and tax breaks. As the late political scientist, Mancur Olson, pointed out, these goodies are highly valuable to the recipients but the cost to the average voter of any single perk will be small. So beneficiaries will have every incentive to lobby for the retention of their perks and taxpayers will have little reason to campaign against them. Over time the economy will be weighed down by all these costs, like a barnacle-encrusted ship. The Greek economy could be seen as a textbook example of these problems.
One answer could be to take fiscal policy out of the hands of elected leaders, just as responsibility for monetary policy has been handed to independent central bankers. To some extent, that has been happening. Greece was briefly run by Lucas Papademos, an unelected former central banker, and Italy is still ruled by Mario Monti, a former EU commissioner. These technocrats are, it is assumed, more willing to take unpopular decisions.
Another approach, with which America has occasionally flirted, is to pass decisions to a bipartisan commission. (This may be the best answer to the âfiscal cliffâ that looms in 2013.) Since the decisions of such a commission, and indeed of technocrats in Greece and Italy, are still subject to a parliamentary vote, democracy is not completely abandoned.
For a long time, there did not seem to be any limit to the amount democracies could borrow. Creditors have been more patient with democratic governments than with other regimes, probably because the risk of abrupt changes of policy (like the repudiation of Tsarist debts by Russia in 1917) are reduced. But this has postponed the crunch point, rather than eliminated itâand allowed stable democracies to accumulate higher debt, relative to their GDP, than many, more volatile countries ever achieved. Governments can, as Madison suggested, confiscate the wealth of domestic creditors via inflation, taxes or default. But however often they vote, democracies cannot make foreign lenders extend credit. That harsh truth is now being discovered.
In: Economics
Jim Jasons is thinking about starting a company to produce high performance video gaming computers. He loves playing video games. He sees it as an opportunity to be his own boss, making a living doing what he likes best. Jim paid $1,000 for training, and he has already purchased new equipment costing $10,000 to assemble the computers. He estimates that it will cost $750 in materials (case, monitor, keyboard, graphics card, CPU, etc.) to make each computer. If he decides to make computers full time, he will need to rent office and manufacturing space at an estimated $1,200 per month for rent plus another $300 per month for various utility bills. Jim would perform all the manufacturing and run the office, and he would like to pay himself a salary of $5,000 per month. Jim plans to hire two salespeople at a base salary of $1,500 each per month plus a commission of $100 per computer. Jim plans to sell each computer for $1,500. He believes that he can sell 50 computers in December for Christmas, but he is not sure what the sales will be during the rest of the year. However, he is sure that the computers will be popular because so many of his friends play video games. Overall, he is confident that he can pay all his business costs, pay himself, the monthly salary of $5,000 and earn at least $2,000 more than that per month. (Ignore income taxes.)
The following questions will help you analyze the information for this problem. Use Excel for all calculations and Microsoft Word for the written portion. One team member will submit one file in Canvas. You will be graded on accuracy and organization.
A. Preform analyses to estimate the number of computers Jim would need to manufacture and sell each year for his business to be financially successful:
1. List all the costs described and indicate whether each cost is (a) a relevant fixed cost, (b) a relevant variable cost, or (c) NOT relevant to Jimâs decision.
2. Calculate the contribution margin per unit and the contribution margin ratio.
3. Write down the total cost function for the computers and calculate the annual breakeven point in units and in revenues.
4. How many computers would Jim need to sell annually to earn $2,000 per month more than his salary?
B. Identify uncertainties about the CVP calculations:
1. Explain why Jim cannot know for sure whether his actual costs will be the same dollar amounts that he estimated. In your explanation, identify as many business risks as you can. (Hint: For each of the costs for Jimâs business that he has not identified, think about reasons why the annual cost might be different than the amount he estimated.)
2. Identify possible costs for Jimâs business that he has not identified. List as many additional types of cost as you can.
3. Explain why Jim cannot know for sure how many computers he will sell each year. In your explanation, identify as many risks as you can and discuss whether Jim is likely to be biased in his revenue and cost estimates.
4. Explain how business risk and Jimâs potential biases might affect interpretation of the breakeven analysis results.
PART A ANSWERED:
1.)
Relevant Fixed Costs Monthly: Rent $1,200, Various Utility Bills $300, Own Salary $5,000, Base salary for salespeople $3,000 (1500*2), Total Fixed Cost per month $9,500,
Relevant Variable Cost per unit: Cost of materials $750, Sales Commission $100, Total Variable Cost per unit $850
Not Relevant to the decision, Cost of trainning $1,000, Cost of Equipment $10,000, These are sunk cost, already incurred
CONTRIBUTION MARGIN Sales Price per unit $1,500 Variable cost per unit $850 Contribution Margin per unit=1500-850 $650 Contribution Margin Ratio=650/1500= 0.433333
3 TOTAL COST FUNCTION: TC=850Q+9500 TC=Total Cost Q=Quantity Sold
Breakeven Point in Units=Fixed Cost/Unit Contribution Margin Breakeven Point in Units=9500/650 14.61538 Rounded to whole number, Break even point in units 15 Break Even point in Revenue=$1500*15
$22,500 4 Net Earning =$2000 Number of Units to be sold=15+2000/650 =18
PLEASE JUST ANSWER PART B (BOLDED)
In: Accounting
Q1: Which of the following is not an algorithm?
Q2: Which of the following is true?
Q3: Which of the following is not a benefit of âgoto-less programmingâ?
Q4: Which of the following is not a control structure:
Q5: Which of the following is an action-state symbol?
Q6: Which statement is false?
Q7: Which of the following is a double-selection control statement?
Q8: Which of the following is not a Java keyword?
Q9: What is output by the following Java code segment?
int temp;
temp = 200;
if ( temp > 90 )
System.out.println( "This porridge is too hot." );
if ( temp < 70 )
System.out.println( "This porridge is too cold." );
if ( temp == 80 )
System.out.println( "This porridge is just right!" );
Q10: A decision symbol in an activity diagram takes the shape of a ________.
Q11: Which of the following is not included in an activity diagram for a control structure?
Q12: Which of the following is not true about the conditional operator ( ?: )?
Q13: What is output by the following Java code segment?
int temp;
temp = 180;
if ( temp > 90 )
{
System.out.println( "This porridge is too hot." );
// cool down
temp = temp â ( temp > 150 ? 100 : 20 );
} // end if
else
{
if ( temp < 70 )
{
System.out.println("This porridge is too cold.");
// warm up
temp = temp + (temp < 50 ? 30 : 20);
} // end if
} // end else
if ( temp == 80 )
System.out.println( "This porridge is just right!" );
Q14: A dangling-else can be clarified by using:
Q15: The empty statement is denoted with what symbol?
ANS: a. Semicolon ;
Q16: Which statement is false?
Q17: What is output by the following Java code segment?
int temp;
temp = 180;
while ( temp != 80 )
{
if ( temp > 90 )
{
System.out.print( "This porridge is too hot! " );
// cool down
temp = temp â ( temp > 150 ? 100 : 20 );
} // end if
else
{
if ( temp < 70 )
{
System.out.print(
"This porridge is too cold! ");
// warm up
temp = temp + (temp < 50 ? 30 : 20);
} // end if
} // end else
} // end while
if ( temp == 80 )
System.out.println( "This porridge is just right!" );
Q18: Which of the following is not an error (either a syntax error or a logic error)?
Q19: In an activity diagram, the merge symbol has the same shape as what other symbol?
In: Computer Science
I need original java code that completes this program and gets it to print out results just like in the example. Also please upload answer in a word document format only.
Implement both linear search and binary search, and see which one performs better given an array 1,000 randomly generated whole numbers (between 0-999), a number picked to search that array at random, and conducting these tests 20 times. Each time the search is conducted the number of checks (IE number of times the loop is ran or the number of times the recursive method is called) needs to be counted and at the end the total number of checks should be averaged.
A few notes
Each algorithm (linear search and binary search) is ran 20 times
Each time a new sorted array of whole numbers is created and populated with random values from 0-999
A value to be searched in the said array is randomly selected from the range 0-999
Each algorithm must display if that number was successfully found
Each algorithm must display the number of checks it took to determine the above answer
It is advisable to create a method that returns the sorted array
Populate the array with random numbers
Search the array next
Return whether or not the value was found in the array
Implement both searches as a method
However instead of returning whether or not it found the number it should return the number of checks.
Whether the value is or is not found can be printed in the method
Binary search is fairly simple to create using recursion
Do not count the out of bounds or stopping index as a check
Example:
Welcome to the search tester. We are going to see which algorithm performs the best out of 20 tests
Searching using linear search
Found!
Searching using binary search
Found!
Linear Checks: 753
Binary Checks: 8
Searching using linear search
Found!
Searching using binary search
Found!
Linear Checks: 834
Binary Checks: 10
Searching using linear search
Not Found
Searching using binary search
Not Found
Linear Checks: 1000
Binary Checks: 10
Searching using linear search
Found!
Searching using binary search
Found!
Linear Checks: 515
Binary Checks: 6
Searching using linear search
Found!
Searching using binary search
Found!
Linear Checks: 757
Binary Checks: 7
Searching using linear search
Found!
Searching using binary search
Found!
Linear Checks: 395
Binary Checks: 9
Searching using linear search
Found!
Searching using binary search
Found!
Linear Checks: 117
Binary Checks: 7
Searching using linear search
Found!
Searching using binary search
Found!
Linear Checks: 334
Binary Checks: 10
Searching using linear search
Found!
Searching using binary search
Found!
Linear Checks: 521
Binary Checks: 9
Searching using linear search
Not Found
Searching using binary search
Not Found
Linear Checks: 1000
Binary Checks: 10
Searching using linear search
Not Found
Searching using binary search
Not Found
Linear Checks: 1000
Binary Checks: 10
Searching using linear search
Not Found
Searching using binary search
Not Found
Linear Checks: 1000
Binary Checks: 10
Searching using linear search
Not Found
Searching using binary search
Not Found
Linear Checks: 1000
Binary Checks: 10
Searching using linear search
Found!
Searching using binary search
Found!
Linear Checks: 901
Binary Checks: 10
Searching using linear search
Found!
Searching using binary search
Found!
Linear Checks: 626
Binary Checks: 8
Searching using linear search
Found!
Searching using binary search
Found!
Linear Checks: 361
Binary Checks: 9
Searching using linear search
Found!
Searching using binary search
Found!
Linear Checks: 630
Binary Checks: 9
Searching using linear search
Found!
Searching using binary search
Found!
Linear Checks: 443
Binary Checks: 7
Searching using linear search
Found!
Searching using binary search
Found!
Linear Checks: 818
Binary Checks: 10
Searching using linear search
Found!
Searching using binary search
Found!
Linear Checks: 288
Binary Checks: 7
The average number of checks for 20 were:
Linear Search 664
Binary Search 8
In: Computer Science
For this program you will implement the following utility functions to test mastery of C strings.
*******you MUST use these these function*****
void removeBlanks(char *src, char *dest);
void replaceChar(char *src, char oldChar, char newChar);
char *flipCase(const char *src);
Please read the description of these functions carefully.
In the removeBlanks function you will implement a routine that takes a string in as src and outputs the same string into dest but removing any blank space character encountered. For example, if the src is âHel lo Wor ld!â, this function should return the value âHelloWorld!â via the dest pointer . 1
In the replaceChar function your function should operate much like a find and replace operation in a word processor works, meaning that the function will replace any instance of the character oldChar and replace it with the character newChar. For example, for a src string âHel lo Wor ldâ, if oldChar is âoâ and newChar is âeâ, then src is modified as âHel le Were ld!â.
In the flipCase function the function turns each lowercase character into an uppercase character and each uppercase character into a lowercase character. For example, if the src string is âGNU Image Processing Tool-Kitâ, then this function should return a string âgnu iMAGE pROCESSING tOOL-kITâ.
steps for flipCase function: 1. dynamically create a new string (character array) equivalent to the length of src. In this string, you will store the src after the case converstion. 2. Use a FOR LOOP interate through each character of src. Check for upper case and lower case, else assign the current character of src to the new string (no conversion is required) 3. Finally add a null terminating character at the end of the new string and return it.
In your main function, you should prompt the user for a string to use for the first two functions, and a string to use for the third function. The user should be allowed to enter any string including ones with white spaces as input. You should also prompt the user for a character to replace and a replacement character for the flip case function. You may assume that any input string will be at maximum 100 characters.
****************************
So I can't figure out how to fix my code. It is IMPORTANT that it is fixed following the guidlines above.
#include<stdio.h>
#include<stdlib.h>
#include<ctype.h>
#include<string.h>
void removeBlanks(char *src, char *dest);
void replaceChar(char *src, char oldChar, char newChar);
char *flipCase(const char *src);
int main(void) {
char string1[100];
char string2[100];
char before;
char after;
char destination;
printf("Enter string for remove blanks and replace
char function functions:\n");
fgets(string1, 100, stdin);
//printf("%s", string1);
printf("Enter string for flip case
function:\n");
fgets(string2, 100, stdin);
//printf("%s", string2);
printf("Enter character to replace:\n");
scanf("%c", &before);
printf("Enter replacement character:\n");
scanf("%c", &after);
printf("1. Remove Blanks\n");
printf("Remove all blanks in %s", string1);
removeBlanks(string1, &destination);
printf("%c\n", destination);
printf("2. Replace Char\n");
printf("Remove all '%c's in '%s' with '%c's:", before,
string1, after);
replaceChar(string1, before, after);
printf("%s\n", string1);
printf("3. Flip Case\n");
printf("Original string is: %s", string2);
printf("Flipped case string is: %s\n",
flipCase(string2));
return 0;
}
void removeBlanks(char *src, char *dest) {
int length = strlen(src);
int i = 0;
int j = 0;
for(i = 0; i < length; i++) {
if(src[i] != ' ') {
dest[j] =
src[i];
j++;
}
}
dest[j] = '\0';
}
void replaceChar(char *src, char oldChar, char newChar) {
int length = strlen(src);
int i;
for(i = 0; i < length; i++) {
if(src[i] == oldChar) {
//Compare
src[i] =
newChar; //Assign
}
}
}
char *flipCase(const char *src) {
char *tempStr = malloc(strlen(src) + 1);
//Copy source to tempStr
strncpy(tempStr, src, strlen(src));
int i;
//Check if case if lower or upper
for(i = 0; i < strlen(src); i++) {
if(isupper(src[i])) {
tempStr[i] =
tolower(src[i]);
} else if(islower(src[i])) {
tempStr[i] =
toupper(src[i]);
} else {
tempStr[i] =
src[i];
}
tempStr[i] = '\0';
}
return tempStr;
//return 0;
}
In: Computer Science
In: Accounting