In: Computer Science
Write a Java program to compute your final grade for the course.
Assume the following (you can hard-code these values in your program).
Assignments are worth 30%
Labs are worth 40%
Mid-term is worth 15%
Final is worth 15%
Ask for the grades in each category.
Store them in a double variable.
Print out the final percentage grade.
For example,
Final Grade Calculation
Enter percentage grades in the following order.
Assignments, Labs, Mid-term test, Final Exam: 95 88 86 92
The final grade is 90
2. Create a Project and a Class called “AgeCheck”
Write a Java program to ask the user for their name and age. Use a string variable for the name and an int variable for the age. Output a message using the name and whether the user is old enough to purchase alcohol (21 years old).
For example,
Age Checker
Enter your name: Steve
Enter your age: 19
Hello, Steve, you are only 19 and not old enough to purchase
alcohol.
Age Checker
Enter your name: Jane
Enter your age: 25
Hello, Jane, you are 25 and old enough to purchase alcohol.
In: Computer Science
i want Solution From Question Number 5 Solution Of questions 1-4
in Previou Post
Note (I Want ScreenShot For Solution)
Use Kali Linux Commands to show me the following:
1. Who are you?
2. Change directory to Downloads
3. Make a new directory
4. Make a new text file under your name (Ghada.txt)
5. Write a paragraph about Cyber security (4 to 5 sentences)
>>simply open the file and write
inside it
6. Change the permission to be 764
7. Open the file but with a cyber security match Show me each and
every step with figure
b. Enter into Portswagger lab (Username enumeration via subtly
different responses)
https://portswigger.net/web-security/authentication/password-based/lab-username-enumerationvia-subtly-different-responses
Show me step-by-step how to use burp to get the username and
password. Name the username list
with your name ex. Ghada_usename.txt and
Ghada_password.txt
Use Seed Machine (the same SQL injection website)to conduct SQL
Injection such that:
1. Update Boby nickname to be your name (by Alice)
2. Update Boby password to be (your name as a password) (by
Alice).
In: Computer Science
C++ programming
To store the information about a city and its weather forecast, create a struct that holds the city's name (string), population (int), and a forecast array storing 7 string elements representing the city's weather in the next 7 days.
The program will then accept user input to enter the name and population of the city, then it accepts 7 string inputs to store into the forecast array.
Then the program will output the city's name, population, and forecast data.
Ex: If the inputs are:
Houston 2313000 sunny sunny sunny rainy thunderstorm sunny sunny
the function outputs:
Houston Population: 2313000 7 Day Forecast: Day 0: sunny Day 1: sunny Day 2: sunny Day 3: rainy Day 4: thunderstorm Day 5: sunny Day 6: sunny
Your program must name the struct "city" with name, population, and forecast as the corresponding member names!
Your program must define and call this function to output the city information:
void city_info(city c)
#include <iostream>
using namespace std;
/* Define your struct here */
/* Define your printing function here */
int main() {
/* Type your code here */
return 0;
}
In: Computer Science
Consider the following scenario: Your boss has come to you for advice on the current finances of the company and needs you to create an extended DuPont analysis, common size analysis, and percentage change analysis. Your boss wants you to fill out the attached Excel file because he/she has no idea what she is talking about and is going to use your report as her work. Remember to answer all the questions in the attached document. Has J&W's liquidity position improved or worsened? Explain Has J&W's ability to manage its assets improved or worsened? Explain How has J&W's profitability changed during the last year? Perform an extended DuPont analysis for J7W for 2015 and 2016. What do these results tell you? Perform a common size analysis. What has happened to the composition (That is, the percentage in each category) of assets and liabilities? Perform a percentage change analysis. What does this tell you about the change in profitability and asset utilization?
| Joshua & White Technologies: December 31 Balance Sheets | ||||||
| (Thousands of Dollars) | ||||||
| Assets | 2016 | 2015 | ||||
| Cash and cash equivalents | $21,000 | $20,000 | ||||
| Short-term investments | 3,759 | 3,240 | ||||
| Accounts Receivable | 52,500 | 48,000 | ||||
| Inventories | 84,000 | 56,000 | ||||
| Total current assets | $161,259 | $127,240 | ||||
| Net fixed assets | 218,400 | 200,000 | ||||
| Total assets | $379,659 | $327,240 | ||||
| Liabilities and equity | ||||||
| Accounts payable | $33,600 | $32,000 | ||||
| Accruals | 12,600 | 12,000 | ||||
| Notes payable | 19,929 | 6,480 | ||||
| Total current liabilities | $66,129 | $50,480 | ||||
| Long-term debt | 67,662 | 58,320 | ||||
| Total liabilities | $133,791 | $108,800 | ||||
| Common stock | 183,793 | 178,440 | ||||
| Retained Earnings | 62,075 | 40,000 | ||||
| Total common equity | $245,868 | $218,440 | ||||
| Total liabilities and equity | $379,659 | $327,240 | ||||
| Joshua & White Technologies December 31 Income Statements | ||||||
| (Thousands of Dollars) | ||||||
| 2016 | 2015 | |||||
| Sales | $420,000 | $400,000 | ||||
| COGS except excluding depr. and amort. | 300,000 | 298,000 | ||||
| Depreciation and Amortization | 19,660 | 18,000 | ||||
| Other operating expenses | 27,600 | 22,000 | ||||
| EBIT | $72,740 | $62,000 | ||||
| Interest Expense | 5,740 | 4,460 | ||||
| EBT | $67,000 | $57,540 | ||||
| Taxes (40%) | 26,800 | 23,016 | ||||
| Net Income | $40,200 | $34,524 | ||||
| Common dividends | $18,125 | $17,262 | ||||
| Addition to retained earnings | $22,075 | $17,262 | ||||
| Other Data | 2016 | 2015 | ||||
| Year-end Stock Price | $90.00 | $96.00 | ||||
| # of shares (Thousands) | 4,052 | 4,000 | ||||
| Lease payment (Thousands of Dollars) | $20,000 | $20,000 | ||||
| Sinking fund payment (Thousands of Dollars) | $5,000 | $5,000 | ||||
| Ratio Analysis | 2016 | 2015 | Industry Avg | |||
| Liquidity Ratios | ||||||
| Current Ratio | 2.58 | |||||
| Quick Ratio | 1.53 | |||||
| Asset Management Ratios | ||||||
| Inventory Turnover (Total COGS/Inventories) | 7.69 | |||||
| Days Sales Outstanding | 47.45 | |||||
| Fixed Assets Turnover | 2.04 | |||||
| Total Assets Turnover | 1.23 | |||||
| Debt Management Ratios | ||||||
| Debt Ratio (Total debt-to-assets) | 20.0% | |||||
| Liabilities-to-assets ratio | 32.1% | |||||
| Times-interest-earned ratio | 15.33 | |||||
| EBITDA coverage ratio | 4.18 | |||||
| Profitability Ratios | ||||||
| Profit Margin | 8.86% | |||||
| Basic Earning Power | 19.48% | |||||
| Return on Assets | 10.93% | |||||
| Return on Equity | 16.10% | |||||
| Market Value Ratios | ||||||
| Earnings per share | NA | |||||
| Price-to-earnings ratio | 10.65 | |||||
| Cash flow per share | NA | |||||
| Price-to-cash flow ratio | 7.11 | |||||
| Book Value per share | NA | |||||
| Market-to-book ratio | 1.72 | |||||
| a. Has Joshua & White's liquidity position improved or worsened? Explain. | ||||||
| b. Has Joshua & White's ability to manage its assets improved or worsened? Explain. | ||||||
| c. How has Joshua & White's profitability changed during the last year? | ||||||
| d. Perform an extended Du Pont analysis for Joshua & White for 2008 and 2009. | ||||||
| ROE = | PM x | TA Turnover x Equity Multiplier | ||||
| 2016 | ||||||
| 2015 | ||||||
| e. Perform a common size analysis. What has happened to the composition | ||||||
| (that is, percentage in each category) of assets and liabilities? | ||||||
| Common Size Balance Sheets | ||||||
| Assets | 2016 | 2015 | ||||
| Cash and cash equivalents | ||||||
| Short-term investments | ||||||
| Accounts Receivable | ||||||
| Inventories | ||||||
| Total current assets | ||||||
| Net fixed assets | ||||||
| Total assets | ||||||
| Liabilities and equity | 2016 | 2015 | ||||
| Accounts payable | ||||||
| Accruals | ||||||
| Notes payable | ||||||
| Total current liabilities | ||||||
| Long-term debt | ||||||
| Total liabilities | ||||||
| Common stock | ||||||
| Retained Earnings | ||||||
| Total common equity | ||||||
| Total liabilities and equity | ||||||
| Common Size Income Statements | 2016 | 2015 | ||||
| Sales | ||||||
| COGS except excluding depr. and amort. | ||||||
| Depreciation and Amortization | ||||||
| Other operating expenses | ||||||
| EBIT | ||||||
| Interest Expense | ||||||
| EBT | ||||||
| Taxes (40%) | ||||||
| Net Income | ||||||
| f. Perform a percent change analysis. What does this tell you about the change in profitability | ||||||
| and asset utilization? | ||||||
| Percent Change Balance Sheets | Base | |||||
| Assets | 2016 | 2015 | ||||
| Cash and cash equivalents | ||||||
| Short-term investments | ||||||
| Accounts Receivable | ||||||
| Inventories | ||||||
| Total current assets | ||||||
| Net fixed assets | ||||||
| Total assets | ||||||
| Base | ||||||
| Liabilities and equity | 2016 | 2015 | ||||
| Accounts payable | ||||||
| Accruals | ||||||
| Notes payable | ||||||
| Total current liabilities | ||||||
| Long-term debt | ||||||
| Total liabilities | ||||||
| Common stock | ||||||
| Retained Earnings | ||||||
| Total common equity | ||||||
| Total liabilities and equity | ||||||
| Base | ||||||
| Percent Change Income Statements | 2016 | 2015 | ||||
| Sales | ||||||
| COGS except excluding depr. and amort. | ||||||
| Depreciation and Amortization | ||||||
| Other operating expenses | ||||||
| EBIT | ||||||
| Interest Expense | ||||||
| EBT | ||||||
| Taxes (40%) | ||||||
| Net Income | ||||||
In: Finance
The first part of the case, presented in Chapter 6, dis- cussed the situation of Computron Industries after an expansion program. A large loss occurred in 2015, rather than the expected profit. As a result, its man- agers, directors, and investors are concerned about the firm’s survival.
Jenny Cochran was brought in as assistant to Gary Meissner, Computron’s chairman, who had the task of getting the company back into a sound financial
position. Computron’s 2014 and 2015 balance sheets and income statements, together with projections for 2016, are shown in the following tables. The tables also show the 2014 and 2015 financial ratios, along with industry average data. The 2016 projected finan- cial statement data represent Cochran’s and Meiss- ner’s best guess for 2016 results, assuming that some new financing is arranged to get the company “over the hump.”
|
Balance Sheet |
||||||
|
2014 |
2015 |
2016 |
||||
|
Assets |
||||||
|
Cash |
$9,000 |
$7,282 |
$14,000 |
|||
|
Short-term investments |
48,000 |
20,000 |
71,632 |
|||
|
Accounts receivable |
351,200 |
632,160 |
878,000 |
|||
|
Inventories |
751,200 |
1,287,360 |
1,716,480 |
|||
|
Total current assets |
$1,124,000 |
$1,946,802 |
$2,680,112 |
|||
|
Gross fixed assets |
491,000 |
1,202,950 |
1,220,000 |
|||
|
Less: Accumulated depreciation |
146,200 |
263,160 |
383,160 |
|||
|
Net fixed assets |
$344,800 |
$39,790 |
$36,840 |
|||
|
Total assets |
$1,468,800 |
$2,886,592 |
$,516,952 |
|||
|
2011 |
2012 |
2013 |
||||
|
Liabilities & Equity |
||||||
|
Accounts payable |
$145,600 |
$324,000 |
$359,800 |
|||
|
Notes payable |
200,000 |
720,000 |
300,000 |
|||
|
Accruals |
136,000 |
284,960 |
380,000 |
|||
|
Total current liabilities |
$481,600 |
$1,328,960 |
$1,039,800 |
|||
|
Long-term debt |
323,432 |
1,000,000 |
500,000 |
|||
|
Common stock (100,000 shares) |
460,800 |
460,000 |
1,680,936 |
|||
|
Retained earnings’ |
203,768 |
97,632 |
296,216 |
|||
|
Total equity |
$663,768 |
$557,632 |
$1,977,152 |
|||
|
Total liabilities & Equity |
$1,468,800 |
$2,886,592 |
$3,516,952 |
|||
|
Note: “E” denotes, “estimated”; the 2013 data for forecasts. |
||||||
|
Income Statement |
||||||
|
2014 |
2015 |
2016 |
||||
|
Sales |
$3,432,000 |
$5,834,400 |
$7,035,600 |
|||
|
Cost of goods sold |
2,864,000 |
4,980,000 |
5,800,000 |
|||
|
Other expenses |
340,000 |
720,000 |
612,960 |
|||
|
Depreciation & Amortization |
18,900 |
116,960 |
120,000 |
|||
|
Total operating Cost |
$3,222,900 |
$5,816,960 |
$6,532,962 |
|||
|
EBIT |
$209,100 |
$17,440 |
$502,640 |
|||
|
Interest expense |
62,500 |
176,000 |
80,000 |
|||
|
EBT |
$146,600 |
($158,560) |
$422,640 |
|||
|
Taxes (40%) |
58,640 |
(63,424) |
169,056 |
|||
|
Net Income |
$87,960 |
($95,136) |
$253,584 |
|||
|
Other Data |
||||||
|
Stock price |
$8.50 |
$6.00 |
$12.17 |
|||
|
Shares outstanding |
100,000 |
100,000 |
250,000 |
|||
|
2011 |
2012 |
2013E |
||||
|
EPS |
$0.880 |
($0.951) |
$1.014 |
|||
|
DPS |
$0.220 |
0.110 |
0.220 |
|||
|
Tax rate |
40% |
40% |
40% |
|||
|
Book value per share |
$6.638 |
$5.576 |
$7.909 |
|||
|
Lease payment |
$40,000 |
$40,000 |
$40,000 |
|||
|
Note: “E” denotes “estimated”; the 2013 data are forecasts. |
||||||
|
Ratio Analysis |
||||||
|
2014 |
2015 |
2016E |
Industry Average |
|||
|
Current |
2.3 |
1.5 |
------------------ |
2.7 |
||
|
Quick |
0.8 |
0.5 |
------------------ |
1.0 |
||
|
Inventory turnover |
4.8 |
4.5 |
------------------ |
6.1 |
||
|
Days sales outstanding |
37.3 |
39.6 |
------------------ |
32.0 |
||
|
Fixed assets turnover |
10.0 |
6.2 |
----------------- |
7.0 |
||
|
Total assets turnover |
2.3 |
2.0 |
--------------- |
2.5 |
||
|
Debt ratio |
54.8% |
80.7% |
-------------- |
50.0% |
||
|
TIE |
3.3 |
0.1 |
-------------- |
6.2 |
||
|
EBITDA Coverage |
2.6 |
0.8 |
-------------- |
8.0 |
||
|
Profit margin |
2.6% |
-1.6% |
-------------- |
3.6% |
||
|
Basic earning power |
14.2% |
0.6% |
-------------- |
17.8% |
||
|
ROA |
6.0% |
-3.3% |
-------------- |
9.0% |
||
|
ROE |
13.3% |
-17.1% |
-------------- |
17.9% |
||
|
Price / Earnings (P/E) |
9.7 |
-6.3 |
-------------- |
16.2 |
||
|
Price / Cash flow |
8.0 |
27.5 |
------------- |
7.6 |
||
|
Market / Book |
1.3 |
1.1 |
------------- |
2.9 |
||
Cochran must prepare an analysis of where the company is now, what it must do to regain its finan- cial health, and what actions to take. Your assignment is to help her answer the following questions. Provide clear explanations, not yes or no answers.
a. Why are ratios useful? What three groups use ratio analysis and for what reasons?
b. Calculate the 2016 current and quick ratios based on the projected balance sheet and income statement data. What can you say about the company’s liquidity position in 2014, 2015, and as projected for 2016? We often think of ratios as being useful: (1) to managers to help run the business, (2) to bankers for credit analysis, and
(3) to stockholders for stock valuation. Would these different types of analysts have an equal interest in the liquidity ratios?
c. Calculate the 2016 inventory turnover, days sales outstanding (DSO), fixed assets turnover, and total assets turnover. How does Computron’s utilization of assets stack up against that of other firms in its industry?
d. Calculate the 2016 debt ratio, liabilities-to- assets ratio, times-interest-earned ratio, and EBITDA coverage ratios. How does Computron compare with the industry with respect to fi- nancial leverage? What can you conclude from these ratios?
e. Calculate the 2016 profit margin, basic earning h. power
(BEP), return on assets (ROA), and return
on equity (ROE). What can you say about these ratios?
f. Calculate the 2016 price/earnings ratio, price/ i. cash flow
ratio, and market/book ratio. Do these
ratios indicate that investors are expected to j. have a high or
low opinion of the company?
g. Perform a common size analysis and percent- age change analysis. What do these analyses tell you about Computron?
h. Use the extended DuPont equation to provide a summary and overview of Computron’s finan- cial condition as projected for 2016. What are the firm’s major strengths and weaknesses?
i. What are some potential problems and limita- tions of financial ratio analysis?
j. What are some qualitative factors that analysts should consider when evaluating a company’s likely future financial performance?
In: Accounting
Compute and Interpret Liquidity, Solvency and Coverage Ratios
Balance sheets and income statements for Lockheed Martin Corporation follow. Refer to these financial statements to answer the requirements.
| Consolidated Statements of Earnings | |||
|---|---|---|---|
| Year Ended December 31 (In millions) | 2016 | 2015 | |
| Net sales | |||
| Products | $ 40,365 | $ 34,868 | |
| Services | 6,883 | 5,668 | |
| Total net sales | 47,248 | 40,536 | |
| Cost of sales | |||
| Products | (36,616) | (31,091) | |
| Services | (6,040) | (4,824) | |
| Severance and other charges | (80) | (82) | |
| Other unallocated costs | 550 | (47) | |
| Total cost of sales | (42,186) | (36,044) | |
| Gross Profit | 5,062 | 4,492 | |
| Other income, net | 487 | 220 | |
| Operating profit | 5,549 | 4,712 | |
| Interest expense | (663) | (443) | |
| Other non-operating income (expense), net | - | 30 | |
| Earnings before taxes | 4,886 | 4,299 | |
| Income tax expense | (1,133) | (1,173) | |
| Net earnings from continuing operations | 3,753 | 3,126 | |
| Net (loss) earnings from discontinued operations | 1,549 | 479 | |
| Net earnings | $ 5,302 | $ 3,605 | |
| Consolidated Balance Sheets | ||
|---|---|---|
| December 31 (in millions, except par value) | 2016 | 2015 |
| Assets | ||
| Current Assets | ||
| Cash and cash equivalents | $ 1,837 | $ 1,090 |
| Receivables, net | 8,202 | 7,254 |
| Inventories, net | 4,670 | 4,819 |
| Other current assets | 399 | 441 |
| Assets of discontinued operations | - | 969 |
| Total current assets | 15,108 | 14,573 |
| Property, plant and equipment, net | 5,549 | 5,389 |
| Goodwill | 10,764 | 10,695 |
| Intangible assets, net | 4,093 | 4,022 |
| Deferred income taxes | 6,625 | 6,068 |
| Other noncurrent assets | 5,667 | 5,396 |
| Assets of discontinued operations | - | 3,161 |
| Total assets | $ 47,806 | $ 49,304 |
| Liabilities and stockholders' equity | ||
| Current Liabilities | ||
| Accounts payable | $ 1,653 | $ 1,745 |
| Customer advances and amounts in excess of costs incurred | 6,776 | 6,703 |
| Salaries, benefits and payroll taxes | 1,764 | 1,707 |
| Current maturities of long-term debt | - | 956 |
| Other current liabilities | 2,349 | 1,859 |
| Liabilities of discontinued operations | - | 948 |
| Total current liabilities | 12,542 | 13,918 |
| Long-term debt | 14,282 | 14,305 |
| Accrued pension liabilities | 13,855 | 11,807 |
| Other post-retirement benefit liabilities | 862 | 1,070 |
| Other noncurrent liabilities | 4,659 | 4,902 |
| Liabilities of discontinued operations | - | 205 |
| Total Liabilities | 46,200 | 46,207 |
| Stockholders' equity | ||
| Common stock, $1 par value per share | 289 | 303 |
| Additional paid-in capital | -- | -- |
| Retained earnings | 13,324 | 14,238 |
| Accumulated other comprehensive loss | (12,102) | (11,444) |
| Total stockholders' equity | 1,511 | 3,097 |
| Noncontrolling interests in subsidiary | 95 | - |
| Total equity | 1,606 | 3,097 |
| Total liabilities and stockholders' equity | $ 47,806 | $ 49,304 |
| Consolidated Statement of Cash Flows | |||
|---|---|---|---|
| Year Ended December 31 (in millions) | 2016 | 2015 | |
| Operating Activities | |||
| Net earnings | $ 5,302 | $ 3,605 | |
| Adjustments to reconcile net earnings to net cash provided by operating activities: | |||
| Depreciation and amortization | 1,215 | 1,026 | |
| Stock-based compensation | 149 | 138 | |
| Deferred income taxes | (152) | (445) | |
| Severance charges | 99 | 102 | |
| Gain on divestiture of IS&GS business | (1,242) | - | |
| Gain on step acquisition of AWE | (104) | - | |
| Changes in operating assets and liabilities: | |||
| Receivables, net | (811) | (256) | |
| Inventories, net | (46) | (398) | |
| Accounts payable | (188) | (160) | |
| Customer advances and amounts in excess of costs incurred | 3 | (32) | |
| Post-retirement benefit plans | 1,028 | 1,068 | |
| Income taxes | 146 | (48) | |
| Other, net | (210) | 501 | |
| Net cash provided by operating activities | 5,189 | 5,101 | |
| Investing Activities | |||
| Capital expenditures | (1,063) | (939) | |
| Acquisition of business/investments in affiliated | - | (9,003) | |
| Other, net | 78 | 208 | |
| Net cash used for investing activities | (985) | (9,734) | |
| Financing Activities | |||
| Special cash payment from divestiture of IS&GS businessk | 1,800 | - | |
| Repurchases of common stock | (2,096) | (3,071) | |
| Proceeds from stock option exercises | 106 | 174 | |
| Dividends paid | (2,048) | (1,932) | |
| Proceeds from the issuance of long-term debt | - | 9,101 | |
| Repayments of long-term debt | (952) | - | |
| Proceeds from borrowings under revolving credit facilities | - | 6,000 | |
| Repayments from borrowings under revolving credit facilities | - | (6,000) | |
| Other, net | (267) | 5 | |
| Net cash (used for) financing activities | (3,457) | 4,277 | |
| Net change in cash and cash equivalents | 747 | (356) | |
| Cash and cash equivalents at beginning of year | 1,090 | 1,446 | |
| Cash and cash equivalents at end of year | $ 1,837 | $ 1,090 | |
(a) Compute Lockheed Martin's current ratio and quick ratio for
2016 and 2015. (Round your answers to two decimal places.)
2016 current ratio = Answer
2015 current ratio = Answer
2016 quick ratio = Answer
2015 quick ratio = Answer
(b) Compute total liabilities-to-equity ratios and total
debt-to-equity ratios for 2016 and 2015 . (Round your answers to
two decimal places.)
2016 total liabilities-to-stockholders' equity = Answer
2015 total liabilities-to-stockholders' equity = Answer
2016 total debt-to-equity = Answer
2015 total ebt-to-equity = Answer
(c) Compute times interest earned ratio, cash from operations to
total debt ratio, and free operating cash flow to total debt
ratios. (Round your answers to two decimal places.)
2016 times interest earned = Answer
2015 times interest earned = Answer
2016 cash from operations to total debt = Answer
2015 cash from operations to total debt = Answer
2016 free operating cash flow to total debt = Answer
2015 free operating cash flow to total debt = Answer
In: Accounting
C++
For this assignment, you will create a search benchmark, that is a comparison between the Linear and Binary Search algorithm on the same list of names provided in a text file.
1. Ask the user to enter a filename
2. Ask the user to enter a name; this is the search item.
3. Loop until you reach the end of the file and read all the names
and store them in an array. Ensure that the array is large enough,
for now a size of 50 is good.
i) Make sure that you do not occur an out of bounds error on the array.
ii) You can convert the case of the names in the file as soon as
you read it and store it in an array.
4. Your program should call a function that uses the Linear Search
algorithm to locate the search item.
i) Make sure you make your comparisons case insensitive. That is, convert the user entered name to upper case for the assignment (converting to lower case will also result the same but I am testing with upper case values) before any comparison.
ii) Your function should keep a count of the number of
comparisons it makes until it finds the value or reaches the end of
the array.
5. Your program should then call a function that uses the Binary
Search algorithm to locate the same value. It should also keep
count of the number of comparisons it makes.
6. Display the number of comparisons that both the algorithms
make.
Hints:
//string userInput contains the user's input or a name read from the file
for(int index = 0; index < userInput.length(); index++)
{
if(userInput[index] >= 'a' && userInput[index] <= 'z')
userInput[index] = toupper(userInput[index]);
}
cout << "uppercase is: " << userInput << endl;
Example 1: Your program should start by getting the file name from the user, followed by a name as user input.
Enter the file name: names.txt Enter name to search:
Let's say the user enters 'Sarah' as input then the output should be the following:
Enter name to search: Sarah Using Linear Search, SARAH was found in the array in 32 comparisons. Using Binary Search, SARAH was found in the array in 9 comparisons.
Example 2:
Enter name to search: Amy Using Linear Search, AMY was found in the array in 2 comparisons. Using Binary Search, AMY was found in the array in 9 comparisons.
Example 3:
Enter name to search: Virginia Using Linear Search, VIRGINIA was found in the array in 35 comparisons. Using Binary Search, VIRGINIA was found in the array in 13 comparisons.
Example 4:
If at any time the user enters a file name that doesn't exist, or
your program is unable to open the file, you should display an
error message. For example, if input.txt file doesn't exist, the
output should be the following.
Enter file name: input.txt Error!! Could not open file!
In: Computer Science
create a C++ Program
1. Ask and get a course name
2. Create an array of students of size 10,
3. Initialize the elements of the students array of appropriate names and grades
4. Create an object of class GradeBook (provide the course name and the created student array, in 3 above, as arguments to the constructor call. The arguments are used to initialize the data members of the class GradeBook.
Desired Output:
=========================================================
Enter course name: Object Oriented Programming
=====================Entering Students' Information===============================
Enter the name and grade for 10 students
student # 1 name: John
Student # 1 grade : 100
student # 2 name: Mark
Student # 2 grade : 100
student # 3 name: Jesus
Student # 3 grade : 89
student # 4 name: Tony
Student # 4 grade : 87
student # 5 name: Leo
Student # 5 grade : 79
student # 6 name: Don
Student # 6 grade : 75
student # 7 name: Devin
Student # 7 grade : 83
student # 8 name: Xavier
Student # 8 grade : 90
student # 9 name: jerry
Student # 9 grade : 25
student # 10 name: Jones
Student # 10 grade : 46
============================================================================
Welcome to the grade book for
Object Oriented Programming!
=====================After Processing Class's Grade===============================
The grades are:
Jonh : 100
Mark : 100
Jesus: 89
Tony : 87
Leo: 79
Don : 75
Devin: 83
Xavier : 90
Jerry : 25
Jones : 46
Class average is 77.40
Lowest grade is 25
Highest grade is 100
Grade distribution:
0-9:
10-19:
20-29: *
30-39:
40-49: *
50-59:
60-69:
70-79: **
80-89: ***
90-99: *
100: **
Press any key to continue . . .
SAMPLE CODE!!!!!!!!!!!!!!!!!!!!!!!!
GradeBook.h
|
#pragma once #include<string> #include<array> class GradeBook { public: GradeBook(std::string& cName,std::array<int,10>& sGrades) : courseName{ cName }, studentGrades{ sGrades } { } std::string getCourseName() const { return courseName; } void setCourseName(const std::string& cName) { courseName = cName; } void processGrades() const { outputGrades(); std::cout << "\nClass average: " << getAverage() << std::endl; std::cout << "\nClass maximum: " << getMaximum() << std::endl; std::cout << "\nClass minimum: " << getMinimum() << std::endl; std::cout << "Bar Chart:\n"; outputBarChart(); } int getMaximum() const { int highGrade{ 0 }; //range-based for loop for (int grade : studentGrades) { if (highGrade < grade) { highGrade = grade; } } return highGrade; } int getMinimum() const { int lowGrade{ 100 }; for (int grade : studentGrades) { if (lowGrade > grade) { lowGrade = grade; } } return lowGrade; } double getAverage() const { int sum{ 0 }; for (int grade : studentGrades) { sum += grade; } return static_cast<double>(sum) / studentGrades.size(); } void outputGrades() const { std::cout << "\n The grades are: \n\n"; for (size_t i{ 0 }; i < studentGrades.size(); ++i) { std::cout <<"Student "<< i + 1 << " grade: " << studentGrades.at(i) << std::endl; } } void outputBarChart() const { std::cout << "\nGrade distribution:\n"; std::array<int, 11> frequency{}; for (int grade : studentGrades) { ++frequency[grade / 10]; } for (size_t i{ 0 }; i < frequency.size(); ++i) { if (i == 0) { std::cout << " 0-9:"; } else if (i == 10) { std::cout << " 100:"; } else { std::cout << i * 10 << "-" << (i*10) + 9 << ":"; } for (unsigned stars{ 0 }; stars < frequency[i]; ++stars) { std::cout << '*'; } std::cout << std::endl;
} } private: std::string courseName; std::array<int, 10> studentGrades; }; |
GradeBookDriver.cpp
|
#include<iostream> #include<string> #include"GradeBook.h" #include<array> using namespace std; int main() { string courseName = "COSC 1337 Object Oriented Programming"; array<int, 10> studentGrades{ 87, 68, 94, 100, 83, 78, 85, 91, 76, 87 }; GradeBook myGradeBook(courseName,studentGrades); myGradeBook.setCourseName(courseName); myGradeBook.processGrades(); } |
In: Computer Science
Using an Aging Schedule to Account for Bad Debts
Sparkle Jewels distributes fine stones. It sells on credit to retail jewelry stores and extends terms that require the stores to pay in 60 days. For accounts that are not overdue, Sparkle has found that there is a 90% probability of collection. For accounts up to one month past due, the likelihood of collection decreases to 75%. If accounts are between one and two months past due, the probability of collection is 60%, and if an account is over two months past due, Sparkle Jewels estimates only a 40% chance of collecting the receivable.
On December 31, 2016, the credit balance in Allowance for Doubtful Accounts is $11,500. The amounts of gross receivables by age on this date are as follows:
| Category | Amount |
| Current | $195,000 |
| Past due: | |
| Less than one month | 44,300 |
| One to two months | 24,800 |
| Over two months | 1,400 |
Required:
1. Prepare a schedule to estimate the amount of uncollectible accounts at December 31, 2016.
| Sparkle Jewels | |||
| Aging Schedule to Account for Bad Debts | |||
| Category | Amount | Estimated Percent Uncollectible | Estimated Amount Uncollectible |
| Current | $195,000 | ||
| Past due: | |||
| Less than one month | 44,300 | fill in the blank 6104da026070016_3% | fill in the blank 6104da026070016_4 |
| One to two months | 24,800 | fill in the blank 6104da026070016_5% | fill in the blank 6104da026070016_6 |
| Over two months | 1,400 | fill in the blank 6104da026070016_7% | fill in the blank 6104da026070016_8 |
| Totals | $265,500 | $fill in the blank 6104da026070016_9 | |
2. On the basis of the schedule in part (1), prepare the journal entry on December 31, 2016, to estimate bad debts. Indicate the effect on financial statement items by selecting "–" for decrease (or negative effect), "+" for increase (or positive effect) and "NE" for No Entry (or no effect) on the financial statement.
| Journal | Balance Sheet | Income Statement | |||||||||||||
| Stockholders’ | Net | ||||||||||||||
| Date | Description | Debit | Credit | Assets | = | Liabilities | + | Equity | Revenues | – | Expenses | = | Income | ||
| 2016 | |||||||||||||||
| Dec. 31 | |||||||||||||||
3. Show how accounts receivable would be presented on the December 31, 2016, balance sheet.
| Sparkle Jewels | ||
| Partial Balance Sheet | ||
| Current Assets | ||
In: Accounting