Binary Search

I. Objectives:
Practicing with Binary Search (Chapter 16) and Sorting Algorithms (Chapter 16 and Chapter 8)
Practicing writing a small-to-medium size program that is modularized (using functions) and deals with lists
II. Instructions:
You job is to write a menu-based program to manipulate a patient database in a hospital. I do not provide any skeleton code for this assignment. You will have to design all the data structures and program structure yourself. The designing of your program will be a big part of your grade in this assignment.
1. Your program should do the following
(a) Show the user a menu that has the following options.
1. Print patients
2. Add a patient
3. Sort patients by last name
4. Sort patients by ID
5. Search patient by last name
6. Search patient by ID
7. Exit the program
(b) Allow the user to select an option from the menu, perform the requested option, show the user the results, and finally show menu to the user again to let picking another option.
2. Design-Needs of your program
(a) Your program should create a struct or class called patientType to hold information about a single patient: first name (string), last name (string), patient ID (int).
(b) You also need to define an array to hold the list of patients. Each element of the array will of type struct or class patientType that you created in step 2(a) above. You can create a static array (like in Chapter 8) with a max size = 10.
(c) Your program must be a modular one: That is, printing of the menu (in step 1a above) on the screen as well as each operation in the menu should have a corresponding function. Then, the main function of your program should be mostly composed of function calls. That is, your main function should be a short function that mainly calls other functions!
(d) Sorting: For options 3 and 4 in the menu (that is sorting the patient list by last name or ID), you have to use and adapt one of the sorting algorithms in the text book: Bubble Sort (Chapter 16 , page 1019), Insertion Sort (Chapter 16, pg 1024) or Selection Sort (Chapter 8, pg 533).
(e) Searching: For option 5 and 6 (searching the patients by last name or ID), you have to use the binary search algorithm and adapt it to your program (Chapter 16, pg 1026).
3. Other Important Notes
(a) The outputs of your program should be nicely formatted. You should provide the user enough explanations to use your program comfortably.

1. If your program handles the patient list (in step 2b) and all the corresponding operations (step 2c) using a vector (Chapter 16) of struct or class patientType, you will get up to +20 points.
2. If your menu also has a working delete option as well, you will get up to a total of +10 points. You can delete a patient using last name or ID. Handling each will be an extra +5 point.
3. We studied Bubble Sort in detail in class, you are responsible to study Selection and Insertion Sort on your own for the exam. For this assignment, if you complete part 2d above (that is both the sorting options in the menu) either using Selection Sort (Chapter 8, pg 533) or Insertion Sort (Chapter 16, pg 1024) you will get an extra +5 points.
III. What to Submit:
1. Your assign4-yourName.cpp file for the program.
2. You also have to submit a README file named README-yourName.txt. Your README should include the following
a. Explain what works what does not work in your program – If your program has extra features, you can mention it too.

b. Include several test cases that you used to test the correctness of your code.

You can upload your files to this Angel drop box as a single .zip file or one by one (note that you should do one submission but you can attach multiple .cpp files to your submission!).
IV. Grading:
100 pts in total. See the Assignment rubric on how your assignment will be evaluated.
1. 90% – Your .cpp file, its content, and programs execution
2. 10% – The README file and its content
3. Extra Credit: Up to 32 points of extra credit for additional features (that is use of vector’s in the program and adding delete option).


You are a new staff accountant with a large regional CPA firm, participating in your first audit. You recall from your auditing class that CPAs often use ratios to test the reasonableness of accounting numbers provided by the client. Since ratios reflect the relationships among various account balances, if it is assumed that prior relationships still hold, prior years’ ratios can be used to estimate what current balances should approximate. However, you never actually performed this kind of analysis until now. The CPA in charge of the audit of Covington Pike Corporation brings you the list of ratios shown below and tells you these reflect the relationships maintained by Covington Pike in recent years.

Profit margin on sales = 5%
Return on assets = 7.5%
Gross profit margin = 40%
Inventory turnover ratio = 6 times
Receivables turnover ratio = 25
Acid-test ratio = .9
Current ratio = 2 to 1
Return on shareholders’ equity = 10%
Debt to equity ratio = 1/3
Times interest earned ratio = 12 times

Jotted in the margins are the following notes

Net income $15,000
Only one short-term not ($5,000); all other current liabilities are trade accounts
Property, plant, and equipment are the only noncurrent assets
Bonds payable are the only noncurrent liabilities
The effective interest rate on short-term notes and bonds is 8%
No investment securities
Cash balance totals $15,000

You are requested to approximate the current year’s balances in the form of a balance sheet and income statement, to the extent the information allows. Accompany those financial statements with the calculations you use to estimate each amount reported.

Expert Answers

The statement of changes in retained earnings for the year shows:
A. the retained earnings balance at the beginning of the year.
B. amounts received from the sale of additional common stock during the year.
C. extraordinary gains or losses during the year.
D. the effect of a stock split during the year.

Which of the following is an accurate statement regarding a statement of cash flows?
A. Only cash items that affect the income statement are included.
B. Only material cash items that affect the income statement are included.
C. Material non-cash transactions are included.
D. Immaterial financing activities that affect cash do not need to be included.
E. None of the above.

Revenue may be recognized:
A. from the sale of a company’s own common stock.
B. if a company trades inventory at its usual sale value for newspaper advertising.
C. if management believes the market value of land held for future development rises.
D. in 2010 from the sale of subscriptions of a magazine to be published in 2011.

The term, “realization,” in revenue recognition refers to which of the following?
A. The entity has completed, or substantially completed, the activities it must perform to be entitled to the revenue benefits.
B. The product or service has been exchanged for cash, claims to cash, or an asset that is readily convertible to a known amount of cash or claims to cash.
C. The entity has received an irrevocable order for goods or services.
D. Cash has been received with an irrevocable order for goods or services.
E. None of the above.

Essay Questions (show your work):

Problem 1: The balance sheet caption for common stock is:
Common stock, $10 par value, 7,000,000 shares authorized, 5,700,000 shares issued, 5,500,000 shares outstanding.

(a.) Calculate the dollar amount that will be presented opposite of this caption.

(b.) Calculate the total amount of a cash dividend of $1.00 per share.

(c.) What accounts for the difference between issued shares and outstanding shares?
Problem 2: Use the appropriate information from the data provided below to calculate operating income for the year ended December 31, 2011.

Cost of goods sold $117,000
General and administrative expenses 48,000
Net cash provided by financing activities 69,000
Dividends paid 16,000
Extraordinary loss from a flood, net of
tax savings of $32,000 74,000
Income tax expense 11,000
Other selling expenses 26,000
Net sales 278,000
Advertising expense 39,000
Accounts receivable 33,000


The following is a summary of performance data of FedEx over a three-year period: In millions Year1 Year 2 Year 3 Sales 34,734 39,304 42,680 COGS 33,550 37,852 40,648 Net Income 1,184 1,452 2,032 Assets 25,654 27,385 29,903 Total Debt 11,695 10,498 13,926 Equity 15,654 15,220 14,727 Operating Cash Flow 1,998 2,378 3,186 Investment Cash Flow -2,781 -3,419 -4,049 Financing cash flow -692 -287 -244 Required: Given the information in the table above, calculate the following: •Profit margin on sales •Return on assets •Return on equity •Total debt to total assets •Total asset turnover Explain and evaluate your results as they pertain to profitability, debt, and asset turnover for the company over a three-year period.