Write a program that prompts the user to enter a file name, then opens the file in text mode and reads names. The file contains one name on each line. The program then compares each name with the name that is at the end of the file in a symmetrical position. For example if the file contains 10 names, the name #1 is compared with name #10, name #2 is compared with name #9, and so on. If you find matches you should print the name and the line numbers where the match was found.
While entering the file name, the program should allow the user to type quit to exit the program.
If the file with a given name does not exist, then display a message and allow the user to re-enter the file name.
The file may contain up to 100 names.
You can use an array or ArrayList object of your choosing, however you can only have one array or ArrayList.
Input validation:
a) If the file does not exist, then you should display a message "File 'somefile.txt' is not found." and allow the user to re-enter the file name.
b) If the file is empty, then display a message "File 'somefile.txt' is empty." and exit the program.
Hints:
a) Perform file name input validation immediately after the user entry and use a while loop .
b) Use one integer variable to count names in the file and another one for counting matches.
d) You can use either a while loop or a for loop to find the matches.
In: Computer Science
In: Biology
Please write the correct query for the following questions:
Select the name of each manufacturer along with the name and price of its most expensive product.
Computer products are expensive. Find the maximum priced product. Which products are within $30 of the maximum priced product.
Find the maker of the most expensive ‘drive’. Note, there are variety of drives in the data. Regular expressions help.
Using the following table:
CREATE TABLE manufacturers (
code number PRIMARY KEY NOT NULL,
name varchar(50) NOT NULL
);
CREATE TABLE products (
code NUMBER PRIMARY KEY NOT NULL,
name varchar(50) NOT NULL ,
price real NOT NULL ,
manufacturer number NOT NULL
CONSTRAINT fk_manufacturers_code REFERENCES
manufacturers(code)
);
INSERT INTO manufacturers(code,name) VALUES(1,'Sony');
INSERT INTO manufacturers(code,name) VALUES(2,'Creative
Labs');
INSERT INTO manufacturers(code,name)
VALUES(3,'Hewlett-Packard');
INSERT INTO manufacturers(code,name) VALUES(4,'Iomega');
INSERT INTO manufacturers(code,name) VALUES(5,'Fujitsu');
INSERT INTO manufacturers(code,name) VALUES(6,'Winchester');
INSERT INTO products(code,name,price,manufacturer)
VALUES(1,'Hard drive',240,5);
INSERT INTO products(code,name,price,manufacturer)
VALUES(2,'Memory',120,6);
INSERT INTO products(code,name,price,manufacturer) VALUES(3,'ZIP
drive',150,4);
INSERT INTO products(code,name,price,manufacturer) VALUES(4,'Floppy
disk',5,6);
INSERT INTO products(code,name,price,manufacturer)
VALUES(5,'Monitor',240,1);
INSERT INTO products(code,name,price,manufacturer) VALUES(6,'DVD
drive',180,2);
INSERT INTO products(code,name,price,manufacturer) VALUES(7,'CD
drive',90,2);
INSERT INTO products(code,name,price,manufacturer)
VALUES(8,'Printer',270,3);
INSERT INTO products(code,name,price,manufacturer) VALUES(9,'Toner
cartridge',66,3);
INSERT INTO products(code,name,price,manufacturer) VALUES(10,'DVD
burner',180,2);
In: Computer Science
Interpreting Financial Statements
BYP14.2 Loblaw Companies Limited is Canada's food and pharmacy leader and the nation's largest retailer. The company operates stores such as Real Canadian Superstore and Shoppers Drug Mart in communities across Canada. In 2017, Loblaw renewed its application to repurchase up to 21 million more common shares after 15.5 million and 10.3 million were repurchased and cancelled in 2017 and 2016, respectively. Financial information for Loblaw for the years ended December 31, 2017, and 2016 follows (in millions of dollars except per share data):
|
2017 |
2016 |
|
|
Profit for the year |
$ 1,526 |
$ 990 |
|
Shareholders' equity at December 31 |
$13,052 |
$13,028 |
|
Dividends declared to common shareholders |
$ 421 |
$ 416 |
|
Number of common shares outstanding |
385.5 |
399.7 |
|
Weighted average number of common shares outstanding |
393.8 |
405.1 |
Instructions
a. Explain the different effects that a cash dividend, stock dividend, and stock split would have on Loblaw's assets, liabilities, shareholders' equity, and the number of shares outstanding.
b. What is the likely reason that Loblaw has repurchased its common shares?
c. During the fiscal periods ended December 31, 2016, and 2017, Loblaw repurchased and cancelled a total of 25,820,827 common shares. In 2015, the common share market price per share was $65.34; in 2016, it was $70.84; and in 2017, it was $68.22. In 2015, the dividend declared per common share was $0.995; in 2016, it was $1.03; and in 2017, it was $1.07. Comment on the impact the reacquisition may have had on the market price and dividends per share.
d. Based on the following excerpt from the notes to the financial statements of Loblaw (in millions of dollars except common share data) for the year ended December 31, 2017, on the share reacquisition, did the company pay more than the average per share amount or less than the average per share amount to repurchase the common shares in 2017 and 2016? Explain.
|
2017 |
2016 |
|
|
Common shares repurchased for cancellation |
15,533,527 |
10,287,300 |
|
Repurchase resulted in a reduction of: |
||
|
Share capital |
$ 301 |
$198 |
|
Retained earnings |
790 |
510 |
|
Total cost |
$1,091 |
$708 |
e. Calculate the return on shareholders' equity, earnings per share, and payout ratio for the shareholders for 2017 and 2016. Comment on the company's profitability. Shareholders' equity at January 2, 2016 (2015 fiscal year end) was $13,124.
In: Accounting
Loblaw Companies Limited is Canada's food and pharmacy leader and the nation's largest retailer. The company operates stores such as Real Canadian Superstore and Shoppers Drug Mart in communities across Canada. In 2017, Loblaw renewed its application to repurchase up to 21 million more common shares after 15.5 million and 10.3 million were repurchased and cancelled in 2017 and 2016, respectively. Financial information for Loblaw for the years ended December 31, 2017, and 2016 follows (in millions of dollars except per share data):
|
2017 |
2016 |
|
|---|---|---|
|
Profit for the year |
$ 1,526 |
$ 990 |
|
Shareholders' equity at December 31 |
$13,052 |
$13,028 |
|
Dividends declared to common shareholders |
$ 421 |
$ 416 |
|
Number of common shares outstanding |
385.5 |
399.7 |
|
Weighted average number of common shares outstanding |
393.8 |
405.1 |
Instructions
a.
Explain the different effects that a cash dividend, stock dividend, and stock split would have on Loblaw's assets, liabilities, shareholders' equity, and the number of shares outstanding.
b.
What is the likely reason that Loblaw has repurchased its common shares?
c.
During the fiscal periods ended December 31, 2016, and 2017, Loblaw repurchased and cancelled a total of 25,820,827 common shares. In 2015, the common share market price per share was $65.34; in 2016, it was $70.84; and in 2017, it was $68.22. In 2015, the dividend declared per common share was $0.995; in 2016, it was $1.03; and in 2017, it was $1.07. Comment on the impact the reacquisition may have had on the market price and dividends per share.
d.
Based on the following excerpt from the notes to the financial statements of Loblaw (in millions of dollars except common share data) for the year ended December 31, 2017, on the share reacquisition, did the company pay more than the average per share amount or less than the average per share amount to repurchase the common shares in 2017 and 2016? Explain.
|
2017 |
2016 |
|
|---|---|---|
|
Common shares repurchased for cancellation |
15,533,527 |
10,287,300 |
|
Repurchase resulted in a reduction of: |
||
|
Share capital |
$ 301 |
$198 |
|
Retained earnings |
790 |
510 |
|
Total cost |
$1,091 |
$708 |
e.
Calculate the return on shareholders' equity, earnings per share, and payout ratio for the shareholders for 2017 and 2016. Comment on the company's profitability. Shareholders' equity at January 2, 2016 (2015 fiscal year end) was $13,124.
In: Accounting
46 In a perfectly competitive market, the type of decision a firm has to make is different in the short run than in the long run. Which of the following is an example of a short-run decision a perfectly competitive firm makes?
a. the profit-maximizing level of output
b. how much to spend on advertising and sales promotion
c. what price to charge buyers for the product
d. whether or not to enter or exit an industry
47 Which barrier to entry is an exclusive right granted to the author or composer of a literary, musical, dramatic or artistic work?
a. patent
b. copyright
c. public franchise
d. government license
In: Economics
This format should allow you more time to think about your answer. You can also use the readings to support your answer. Be sure to cite the author and page number for all quotes or ideas taken from one of the authors (e.g. Chang, p. 81). The length of your answers should range from 1-3 paragraphs, depending on the complexity of the question.
Interest in Heterodox economics is increasing. What events have taken place to bring more attention to heterodox perspectives? Explain, in particular, the alleged shortcomings of neoclassical economics in relation to these recent economic events.
In: Economics
In: Economics
superbtext publishing is a textbook publishing company with the headquarter locatio a warehouse and 3 sales office that each have sales manager and sales reps. a superbtext sales to schools, college, and individuals . many author writes more than one books for superb text . and some book are witten by more than one authors. superbtext maintains and activelist of more than 100 books. each identified by the universal code cal ISBN. a. you have been asked to draw ERD for suberbtext information system . b. you have been asked to draw a class diagram for superbtext information system.
In: Computer Science
An employee’s total weekly pay equals the hourly wage multiplied by the total number of regular hours plus any overtime pay. Overtime pay equals the total overtime hours multiplied by 1.5 times the hourly wage. Write a python program that takes as input the hourly wage, total regular hours, and total overtime hours and displays an employee’s total weekly pay.
The script must start with comments about the author, assignment and submission date. Save the script using the following naming convention: Name_SID_Assignment#.py. Please submit pseudocode, flow chart and screenshot of the output.
In: Computer Science