back to top
Question 1
Our Earth Pty Ltd, an Australian owned company, are the manufacturers of a specially designed bio-degradable, disposable coffee cup made from sustainable materials. They are currently the sole supplier to coffee shops in Australia. During the year Our Earth Pty Ltd discovered that Coffee Bean Pty Ltd, the owner of a chain of coffee shops Australia wide, had been contracting an overseas company to manufacture a similar cup based on their design, for a cheaper price. Coffee Bean Pty Ltd hadn’t informed its customers that it was not the original Australian made Our Earth product that they were using.
As Our Earth Pty Ltd has a design patent over the cup they decided to take legal action against Coffee Bean Pty Ltd. As a result of the action, the following amounts were payable by Coffee Bean Pty Ltd to Our Earth Pty Ltd in the year ended 30 June 2019:
$300,000 damages for design patent infringement$200,000 for expected lost revenue over the 12 month period that Coffee Bean Pty Ltd had been using the other product$15,000 interest received on the damages payout$40,000 reimbursement of legal fees incurred by Our Earth Pty Ltd
Required:
Advise Our Earth Pty Ltd of the taxation consequences
of the above transactions .
Question 2
Sam purchased 80 acres of farmland in May 1984 for $270,000 on which he conducted a beef cattle breeding operation. In February 1995 he purchased an additional 20 acres of adjoining farmland for $110,000 in order to expand his operation. There was no house on the farmland so Sam lived in the nearby township. Due to ongoing drought conditions and Sam’s advancing age, he decided in 2017 to sell and retire from farming. A local real estate agent valued the property at $440,000. Given the time and effort Sam had put into the farm over the years he didn’t feel this was enough of a return on his investment. As the property was located close to town, the real estate suggested that Sam consider selling the land as a sub-division. This would likely generate a higher return per acre than selling the property as farmland.
Sam re-zoned and received council approval for the sub-division in May 2017. Over the period from July 2017 to January 2018 Sam spent $450,000 on sub-division costs such as surveyor fees, electricity and water connections and main road access. In April 2018 a local construction company agreed to buy the entire sub-division for $1,100,000. Although the contract for sale was dated in April, settlement didn’t take place until July 2018. Agent’s commission and legal fees payable by Sam amounted to $45,000.
Required:
Advise Sam of the taxation consequences of the above transactions .
In: Economics
Equipment Corporation incorporated was established on October 20, 1974. to comply with accounting requirements, the company uses an accrual method of accounting. Its accumulated earnings and profits as of December 31, 2016, were $1,200. It made cash distributions during its 2016 calendar tax year of $140,089. This consisted of $85,089 to preferred shareholders and $55,000 to common shareholders. The entire distribution to preferred shareholders is a taxable dividend. The $27,500 distribution on March 15, 2016, to common shareholders is a taxable dividend to extent of $27,318 (99.33%), and the $27,500 distribution on September 15, 2016, to common shareholders is a taxable dividend to the extent of $26,118 (94.97%).
The following profit and loss account appeared in the books of the Equipment Corporation for calendar year 2016. It is required to file Form 1120 and completes Form 1120-F (M-1 and M-2).
|
Account |
Debit |
Credit |
|
|
Gross sales |
$1,840,000 |
||
|
Sales returns and allowances |
$20,000 |
||
|
Cost of goods sold |
1,520,000 |
||
|
Interest income from: |
|||
|
Banks |
$10,000 |
||
|
Tax-exempt state bonds |
5,000 |
15,000 |
|
|
Proceeds from life insurance (death of corporate officer) |
6,000 |
||
|
Bad debt recoveries (no tax deduction claimed) |
3,500 |
||
|
Insurance premiums on lives of corporate officers (corporation is beneficiary of policies) |
9,500 |
||
|
Compensation of officers |
40,000 |
||
|
Salaries and wages |
28,000 |
||
|
Repairs |
800 |
||
|
Taxes |
10,000 |
||
|
Contributions: |
|||
|
Deductible |
$23,000 |
||
|
Other |
500 |
23,500 |
|
|
Interest paid (loan to purchase tax-exempt bonds) |
850 |
||
|
Depreciation |
5,200 |
||
|
Loss on securities |
3,600 |
||
|
Net income per books after federal income tax |
140,825 |
||
|
Federal income tax accrued for 2016 |
62,225 |
||
|
Total |
$1,864,500 |
$1,864,500 |
|
|
The corporation analyzed the retained earnings and the following items appeared in this account on its books. |
|||
|
Item |
Debit |
Credit |
|
|
Balance, January 1 |
$225,000 |
||
|
Net profit (before federal income tax) |
203,050 |
||
|
Reserve for contingencies |
$10,000 |
||
|
Income tax accrued for the year |
62,225 |
||
|
Dividends paid during the year |
140,089 |
||
|
Refund of 1995 income tax |
18,000 |
||
|
Balance, December 31 |
233,736 |
||
|
Total |
$446,050 |
$446,050 |
|
|
The following items appear on page 1 of Form 1120. |
|||
|
Gross sales ($1,840,000 less returns and allowances of $20,000) |
$1,820,000 |
||
|
Cost of goods sold |
1,520,000 |
||
|
Gross profit from sales |
$300,000 |
||
|
Interest income |
10,000 |
||
|
Total income |
$310,000 |
||
|
Deductions: |
|||
|
Compensation of officers |
$40,000 |
||
|
Salaries and wages |
28,000 |
||
|
Repairs |
800 |
||
|
Taxes |
10,000 |
||
|
Contributions (maximum allowable) |
22,500 |
||
|
Depreciation |
6,200 |
||
|
Total deductions |
107,500 |
||
|
Taxable income |
$202,500 |
||
In: Accounting
VISUAL STUDIO (File Creation and Submissions)
FLOWCHART
Writing program in C++ ( cout, \n, \t, solving expressions
)
Correcting errors
Q1: Draw flow Chart of the following problems:
a) Display “Hello World” on screen.
b) Display Your Name, date of birth and mobile number on
screen.
c) Compute and display the perimeter and area of a rectangle with a
height of 7 inches and width
of 5 inches.
d) Compute and display the perimeter and area of a circle with a
radius of 6 inches.
e) Compute and display the sum of a=1245698 and b=12345.
f) Read an employee's ID, total worked hours of a month and the
amount he received per hour.
Print the employee's ID and salary of a particular month
Test Data:
Input the Employees ID: 0342
Input the working hours: 8
Salary amount/hour: 15000
Expected Output:
Employees ID = 0342
Salary = RS. 120000.00
g) Read two item’s weight and number of purchase and calculate the
average value of the items
Test Data:
Weight of Item1: 15
No. of item1: 5
Weight of Item2: 25
No. of item2: 4
Expected Output:
Average Value = 19.444444
Q2: Practice the following on Visual Studio:
a) Create a blank C++ file using Microsoft Visual Studio
b) Create and save a cpp File in default
directory
c) Create and save a cpp file in any location other than default
location
d) Upload the test file for submission on portal.
Q3: Write C++ programs for the following problems.
a) Display Hello World message on screen.
Expected Output:
Hello World
b) Display Your Name, date of birth and mobile number on screen
separated by comma as follows:
Expected Output:
Ahmad, 5-06-1995, 0321-5673451
c) Display a horizontal line of ten consecutive asterisks on screen
as follows:
Expected Output:
**********
d) Display ITC LAB 1 on screen enclosed in single quotes as
follows:
Expected Output:
‘ITC LAB 03’
e) Display ITC LAB 1 on screen enclosed in double quotes as
follows:
Expected Output:
“ITC LAB 03”
Q4: Write the following lines of codes one by one as it is and then
analyze the output:
a) cout<< ‘This is my first ITC lab ‘
b) //cout<< ‘This is my first ITC LAB’
c) cout>> “987654321”;
d) cout<<” 9876
54321”;
e) cout<<” 9876”
“54321”;
f) cout<<” 9876”;
cout<<54321;
g) cout<<”test\t\test1”;
h) cout<<” ###### \n ****** \n
&&&&&&”;
i) cout<<” ###### \n &&&\t&&&”;
j) cout<<” 25+35”;
k) cout<< 100 + 200 ;
l) cout<<”40 * 3”;
cout<<”=”;
cout<<40*3;
m) cout<<10/5;
n) cout<<5/10;
o) cout<< k;
In: Computer Science
I NEED JAVASCRIPT PROGRAM
Chose an activity that you enjoy. It can be a sport that you
watch or participate in, collecting, hobbies, etc. Do
not use a collection of movies since we have covered that in the
assignment. Do not use the same topic as a
friend. (If two students that don’t know each other happen to
select the same topic, that is fine, since they will
naturally have different property names and values.)
1. Select some aspect of the activity and create an array of
objects denoting that aspect. For example, in
the case of movies, you could select movies themselves or you could
select movie stars, producers,
soundtracks, etc. There are many aspects of any activity that you
can use. Feel free to use the web to
research these values.
The array must contain at least 10 objects
The data must be actual data not just gibberish
Each object will have at least 4 properties with values
Each object in the array should have the same set of property names
with different values
At least one string value and one number value
Other properties can be of any JavaScript value type
2. Create a function that can be used to format your object in a
nice string format for output. This function
should be a pure function that takes one object as an argument and
return a string. The string can be
formatted in any way that you feel is appropriate for your data. It
must use one or more properties from
the object in the output string.
3. Create a new array from your array that only contains string
values produced by the above function. Sort
this array alphabetically and display an appropriate heading
followed by this list one string per line.
4. Prompt the user for a numeric value. Display a string (formatted
using the function above) for each of the
objects that have a property (you choose) that are greater or less
(up to you) the value provided by the
user. Be sure to provide a message if there are no objects that
match.
5. Calculate the average value based on some property of your
objects that makes sense. Output it with
descriptive text in a nicely formatted way.
Sample Output:
Movie Titles:
12 Angry Men (1957) by Sidney Lumet
Chak de! India (2007) by Shimit Amin
Hera Pheri (2000) by Priyadarshan
La Haine (1995) by Mathieu Kassovitz
Pulp Fiction (1994) by Quentin Tarantino
Schindler's List (1983) by Steven Spielberg
The Dark Knight (2008) by Christopher Nolan
The Godfather (1972) by Francis Ford Coppola
The Godfather: Part II (1974) by Francis Ford Coppola
The Good, the Bad and the Ugly (1966) by Sergio Leone
The Lord of the Rings: The Fellowship of the Ring (2001) by Peter
Jackson
The Lord of the Rings: The Return of the King (2003) by Peter
Jackson
The Shawshank Redemption (1994) by Frank Darabont
Movies newer than 2005:
Chak de! India (2007) by Shimit Amin
The Dark Knight (2008) by Christopher Nolan
The average age of these movies is: 31 years old.
In: Computer Science
You’re a physician in a practice group that became involved with PhyCor, Inc. Your group eliminated its entire management structure when PhyCor took over. Now, with PhyCor collapsing, you are being offered repurchase of your assets from PhyCor. What strategic planning steps do you propose to your group for going forward and selecting among options such as dissolving the group, purchasing the assets and finding another management firm, purchasing the assets and establishing in-house management, or other alternatives?
"Physician Practice Management Companies and PhyCor, Inc. Physician practice management (PPM) fi rms grew very rapidly in the late 1980s and early 1990s. PPMs promised to infuse physician practices with needed capital and provide signifi cant cost savings and increased revenues through economies of scale and improved management. They also promised to allow physicians to negotiate better contracts with the emerging HMOs and PPOs. However, by the end of the century, all of the major PPMs had gone out of business or signifi cantly downsized, with their valuations a tiny fraction of prior capitalization. Some, such as MedPartners, declared bankruptcy. Others saw their valuation plummet to almost nothing. What went wrong? This case examines the history of PPMs and the story of PhyCor, one of the prominent players.PPMs were created in response to the lack of retained earnings and marginal management that existed in many physician practices and the growth of HMOs and PPOs. As a result of increased managed care, physician organizations/medical groups experienced increased costs and lower net revenues. HMOs and PPOs also demanded large discounts from physicians. Capital was also needed to buy out senior partners, install information systems, and change their structures and governance. PPMs with signifi cant venture and Wall Street capital backing purchased prestigious medical groups, consolidated independent practices, and acquired staff clinics being divested by HMOs. Consolidation of PPMs left three large companies by the early 1990s.315Many of the physician practices signed 30- to 40-year management services contracts with the PPMs. These most often specifi ed that physicians would receive a split of revenues after payment of clinic expenses. The lower cost of capital, centralized purchasing, and greater bargaining leverage with insurer organizations were to lower costs and increase revenues.Phycor, Inc., incorporated in 1988, became by 1995 a medical network management company that managed multispecialty medical clinics and other physician organizations, provided contract management services to physician networks owned by health systems, and developed and managed independent practice associations (IPAs).1 The company also provided health care decision-support services, including demand management and disease management services, to managed care organizations, health care providers, employers, and other group associations."
In: Operations Management
This is t a relational database please write SQL queries to solve the listed questions.
The database is a variation of the “Movie Database” . There are several differences in it, so look it over carefully before writing your SQL queries
Notes:
|
City |
State |
Mayor |
CITY
|
TheaterNum |
Address |
Phone |
City |
State |
Capacity |
THEATER
|
MovieNum |
Title |
Year |
Length |
Type |
DirName |
ProdName |
Revenue |
MOVIE
|
TheaterNum |
MovieNum |
SHOWINGS
|
DirName |
Dir Address |
Dir Cell |
DIRECTOR
|
ProdName |
Prod Addr |
Proc Cell |
PRODUCER
|
ActorNum |
ActorName |
CurrentAge |
PlaceBirth |
ACTOR
|
ActorNum |
PreviousJob |
PREVIOUSJOB
|
ActorNum |
MovieNum |
Star |
ACTEDIN
|
NewsName |
City |
State |
NEWSPAPER
|
RevName |
Years Work |
REVIEWER
|
ReviewNum |
Text |
Date |
MovieNum |
NewsName |
RevName |
REVIEW
Questions
Remember to follow all of the instructions listed on the first page.
1. Which theater(s) in Tennessee have the largest capacity?
2. How many reviews were written for each movie directed by John Carter that were filmed in the period 2014 to 2019
3. List the phone number of every theater in Tennessee. Order the results by theater number.
4. What was the total revenue generated by movies made in 2015 that were both directed by James Smith and produced by Mary Jones?
5. Assume there is only one movie titled, “The Matrix.” Who reviewed it?
6. List the cities in Tennessee that have theaters with capacities of at least 200 seats. List the cities in alphabetic order.
7. Which movies have generated more revenue than the movie directed by John Carter in 2010 that generated the most revenue of the movies he directed that year?
8. Which theaters in Tennessee, Arkansas, or Mississippi (you may use 2-letter abbreviations) showed movies whose titles began with any of the letters R, S, or T? List the theaters in numeric order.
9. Who is the oldest actor who starred in a movie made between 1995 and 2005 that was both directed by James Smith and produced by Mary Jones?
10. What was the total revenue generated by movies produced by each producer from 2010 to 2018 that starred an actor who is currently under 40 years of age? Only include producers whose movies generated more than a total of $75,000,000.
In: Computer Science
Year Name MinPressure_before Gender_MF Category alldeaths
1950 Easy 958 1 3 2
1950 King 955 0 3 4
1952 Able 985 0 1 3
1953 Barbara 987 1 1 1
1953 Florence 985 1 1 0
1954 Carol 960 1 3 60
1954 Edna 954 1 3 20
1954 Hazel 938 1 4 20
1955 Connie 962 1 3 0
1955 Diane 987 1 1 200
1955 Ione 960 0 3 7
1956 Flossy 975 1 2 15
1958 Helene 946 1 3 1
1959 Debra 984 1 1 0
1959 Gracie 950 1 3 22
1960 Donna 930 1 4 50
1960 Ethel 981 1 1 0
1961 Carla 931 1 4 46
1963 Cindy 996 1 1 3
1964 Cleo 968 1 2 3
1964 Dora 966 1 2 5
1964 Hilda 950 1 3 37
1964 Isbell 974 1 2 3
1965 Betsy 948 1 3 75
1966 Alma 982 1 2 6
1966 Inez 983 1 1 3
1967 Beulah 950 1 3 15
1968 Gladys 977 1 2 3
1969 Camille 909 1 5 256
1970 Celia 945 1 3 22
1971 Edith 978 1 2 0
1971 Fern 979 1 1 2
1971 Ginger 995 1 1 0
1972 Agnes 980 1 1 117
1974 Carmen 952 1 3 1
1975 Eloise 955 1 3 21
1976 Belle 980 1 1 5
1977 Babe 995 1 1 0
1979 Bob 986 0 1 1
1979 David 970 0 2 15
1979 Frederic 946 0 3 5
1980 Allen 945 0 3 2
1983 Alicia 962 1 3 21
1984 Diana 949 1 2 3
1985 Bob 1002 0 1 0
1985 Danny 987 0 1 1
1985 Elena 959 1 3 4
1985 Gloria 942 1 3 8
1985 Juan 971 0 1 12
1985 Kate 967 1 2 5
1986 Bonnie 990 1 1 3
1986 Charley 990 0 1 5
1987 Floyd 993 0 1 0
1988 Florence 984 1 1 1
1989 Chantal 986 1 1 13
1989 Hugo 934 0 4 21
1989 Jerry 983 0 1 3
1991 Bob 962 0 2 15
1992 Andrew 922 0 5 62
1993 Emily 960 1 3 3
1995 Erin 973 1 2 6
1995 Opal 942 1 3 9
1996 Bertha 974 1 2 8
1996 Fran 954 1 3 26
1997 Danny 984 0 1 10
1998 Bonnie 964 1 2 3
1998 Earl 987 0 1 3
1998 Georges 964 0 2 1
1999 Bret 951 0 3 0
1999 Floyd 956 0 2 56
1999 Irene 987 1 1 8
2002 Lili 963 1 1 2
2003 Claudette 979 1 1 3
2003 Isabel 957 1 2 51
2004 Alex 972 0 1 1
2004 Charley 941 0 4 10
2004 Frances 960 1 2 7
2004 Gaston 985 0 1 8
2004 Ivan 946 0 3 25
2004 Jeanne 950 1 3 5
2005 Cindy 991 1 1 1
2005 Dennis 946 0 3 15
2005 Ophelia 982 1 1 1
2005 Rita 937 1 3 62
2005 Wilma 950 1 3 5
2005 Katrina 902 1 3 1833
2007 Humberto 985 0 1 1
2008 Dolly 963 1 1 1
2008 Gustav 951 0 2 52
2008 Ike 935 0 2 84
2011 Irene 952 1 1 41
2012 Isaac 965 0 1 5
2012 Sandy 945 1 2 159
Open Hurricane data.
SETUP: Is it reasonable to assume that average hurricane pressure for category 4 is different from that of category 1? Given the data, your job is to check if this assertion is indeed reasonable or not. HINT: Read Lecture 24.
19. What would be the correct Null-Hypothesis?
20. The P-value is 3.33E-09. What can be statistically concluded?
21. Write a one-line additional comment.
In: Statistics and Probability
Year Name MinPressure_before Gender_MF Category alldeaths 1950 Easy 958 1 3 2 1950 King 955 0 3 4 1952 Able 985 0 1 3 1953 Barbara 987 1 1 1 1953 Florence 985 1 1 0 1954 Carol 960 1 3 60 1954 Edna 954 1 3 20 1954 Hazel 938 1 4 20 1955 Connie 962 1 3 0 1955 Diane 987 1 1 200 1955 Ione 960 0 3 7 1956 Flossy 975 1 2 15 1958 Helene 946 1 3 1 1959 Debra 984 1 1 0 1959 Gracie 950 1 3 22 1960 Donna 930 1 4 50 1960 Ethel 981 1 1 0 1961 Carla 931 1 4 46 1963 Cindy 996 1 1 3 1964 Cleo 968 1 2 3 1964 Dora 966 1 2 5 1964 Hilda 950 1 3 37 1964 Isbell 974 1 2 3 1965 Betsy 948 1 3 75 1966 Alma 982 1 2 6 1966 Inez 983 1 1 3 1967 Beulah 950 1 3 15 1968 Gladys 977 1 2 3 1969 Camille 909 1 5 256 1970 Celia 945 1 3 22 1971 Edith 978 1 2 0 1971 Fern 979 1 1 2 1971 Ginger 995 1 1 0 1972 Agnes 980 1 1 117 1974 Carmen 952 1 3 1 1975 Eloise 955 1 3 21 1976 Belle 980 1 1 5 1977 Babe 995 1 1 0 1979 Bob 986 0 1 1 1979 David 970 0 2 15 1979 Frederic 946 0 3 5 1980 Allen 945 0 3 2 1983 Alicia 962 1 3 21 1984 Diana 949 1 2 3 1985 Bob 1002 0 1 0 1985 Danny 987 0 1 1 1985 Elena 959 1 3 4 1985 Gloria 942 1 3 8 1985 Juan 971 0 1 12 1985 Kate 967 1 2 5 1986 Bonnie 990 1 1 3 1986 Charley 990 0 1 5 1987 Floyd 993 0 1 0 1988 Florence 984 1 1 1 1989 Chantal 986 1 1 13 1989 Hugo 934 0 4 21 1989 Jerry 983 0 1 3 1991 Bob 962 0 2 15 1992 Andrew 922 0 5 62 1993 Emily 960 1 3 3 1995 Erin 973 1 2 6 1995 Opal 942 1 3 9 1996 Bertha 974 1 2 8 1996 Fran 954 1 3 26 1997 Danny 984 0 1 10 1998 Bonnie 964 1 2 3 1998 Earl 987 0 1 3 1998 Georges 964 0 2 1 1999 Bret 951 0 3 0 1999 Floyd 956 0 2 56 1999 Irene 987 1 1 8 2002 Lili 963 1 1 2 2003 Claudette 979 1 1 3 2003 Isabel 957 1 2 51 2004 Alex 972 0 1 1 2004 Charley 941 0 4 10 2004 Frances 960 1 2 7 2004 Gaston 985 0 1 8 2004 Ivan 946 0 3 25 2004 Jeanne 950 1 3 5 2005 Cindy 991 1 1 1 2005 Dennis 946 0 3 15 2005 Ophelia 982 1 1 1 2005 Rita 937 1 3 62 2005 Wilma 950 1 3 5 2005 Katrina 902 1 3 1833 2007 Humberto 985 0 1 1 2008 Dolly 963 1 1 1 2008 Gustav 951 0 2 52 2008 Ike 935 0 2 84 2011 Irene 952 1 1 41 2012 Isaac 965 0 1 5 2012 Sandy 945 1 2 159 Test if there is a significant difference in the death by Hurricanes and Min Pressure measured. Answer the questions for Assessment. (Pick the closest answer)
7. What is the P-value?
8. What is the Statistical interpretation?
9. What is the conclusion?
In: Statistics and Probability
Open Hurricanes data.
Test if there is a significant difference in the death by Hurricanes and Min Pressure measured. Answer the questions for Assessment. (Pick the closest answer)
7. What is the P-value?
8. What is the Statistical interpretation?
9. What is the conclusion?
Year Name MinPressure_before
Gender_MF Category alldeaths
1950 Easy 958 1
3 2
1950 King 955 0
3 4
1952 Able 985 0
1 3
1953 Barbara 987 1
1 1
1953 Florence 985 1
1 0
1954 Carol 960 1
3 60
1954 Edna 954 1
3 20
1954 Hazel 938 1
4 20
1955 Connie 962 1
3 0
1955 Diane 987 1
1 200
1955 Ione 960 0
3 7
1956 Flossy 975 1
2 15
1958 Helene 946 1
3 1
1959 Debra 984 1
1 0
1959 Gracie 950 1
3 22
1960 Donna 930 1
4 50
1960 Ethel 981 1
1 0
1961 Carla 931 1
4 46
1963 Cindy 996 1
1 3
1964 Cleo 968 1
2 3
1964 Dora 966 1
2 5
1964 Hilda 950 1
3 37
1964 Isbell 974 1
2 3
1965 Betsy 948 1
3 75
1966 Alma 982 1
2 6
1966 Inez 983 1
1 3
1967 Beulah 950 1
3 15
1968 Gladys 977 1
2 3
1969 Camille 909 1
5 256
1970 Celia 945 1
3 22
1971 Edith 978 1
2 0
1971 Fern 979 1
1 2
1971 Ginger 995 1
1 0
1972 Agnes 980 1
1 117
1974 Carmen 952 1
3 1
1975 Eloise 955 1
3 21
1976 Belle 980 1
1 5
1977 Babe 995 1
1 0
1979 Bob 986 0
1 1
1979 David 970 0
2 15
1979 Frederic 946 0
3 5
1980 Allen 945 0
3 2
1983 Alicia 962 1
3 21
1984 Diana 949 1
2 3
1985 Bob 1002 0
1 0
1985 Danny 987 0
1 1
1985 Elena 959 1
3 4
1985 Gloria 942 1
3 8
1985 Juan 971 0
1 12
1985 Kate 967 1
2 5
1986 Bonnie 990 1
1 3
1986 Charley 990 0
1 5
1987 Floyd 993 0
1 0
1988 Florence 984 1
1 1
1989 Chantal 986 1
1 13
1989 Hugo 934 0
4 21
1989 Jerry 983 0
1 3
1991 Bob 962 0
2 15
1992 Andrew 922 0
5 62
1993 Emily 960 1
3 3
1995 Erin 973 1
2 6
1995 Opal 942 1
3 9
1996 Bertha 974 1
2 8
1996 Fran 954 1
3 26
1997 Danny 984 0
1 10
1998 Bonnie 964 1
2 3
1998 Earl 987 0
1 3
1998 Georges 964 0
2 1
1999 Bret 951 0
3 0
1999 Floyd 956 0
2 56
1999 Irene 987 1
1 8
2002 Lili 963 1
1 2
2003 Claudette 979
1 1 3
2003 Isabel 957 1
2 51
2004 Alex 972 0
1 1
2004 Charley 941 0
4 10
2004 Frances 960 1
2 7
2004 Gaston 985 0
1 8
2004 Ivan 946 0
3 25
2004 Jeanne 950 1
3 5
2005 Cindy 991 1
1 1
2005 Dennis 946 0
3 15
2005 Ophelia 982 1
1 1
2005 Rita 937 1
3 62
2005 Wilma 950 1
3 5
2005 Katrina 902 1
3 1833
2007 Humberto 985 0
1 1
2008 Dolly 963 1
1 1
2008 Gustav 951 0
2 52
2008 Ike 935 0
2 84
2011 Irene 952 1
1 41
2012 Isaac 965 0
1 5
2012 Sandy 945 1
2 159
In: Statistics and Probability
Create a class called MovieReducerExtremes that implements MediaReducer. Implement a reducer that takes a movie list and an option ("newest" or "oldest"), then return the newest or oldest movie as appropriate.Submit both the MovieReducerExtremes and the Movie class from the first question.
/////Required Output:///////
Newest\n 2014 AKA Jessica Jones Action \n Oldest\n 1936 Cabaret Music \n
Given Files:
Movie.java
public class Movie extends Media {
public Movie(String name, int year, String genre) {
super(name, year, genre);
}
public String getEra() {
if (getYear() >= 2000) {
return "New Millennium Era";
} else if (getYear() >= 1977) {
return "Modern Era";
} else if (getYear() >= 1955) {
return "Change Era";
} else if (getYear() >= 1941) {
return "Golden Era";
}
return "Pre-Golden Era";
}
public boolean wasReleasedAfter(Media other) {
return getYear() > other.getYear();
}
public boolean wasReleasedBeforeOrInSameYear(Media other) {
return getYear() <= other.getYear();
}
}
Demo3.java
import java.io.FileNotFoundException;
import java.util.ArrayList;
public class Demo3
{
public static void main(String[] args) throws FileNotFoundException {
ArrayList movies = MovieLoader.loadAllMovies();
MediaReducer op = new MovieReducerExtremes();
System.out.println("Newest");
System.out.println(op.reduce(movies, "Newest"));
System.out.println("Oldest");
System.out.println(op.reduce(movies, "Oldest"));
}
}
Media.java
public abstract class Media {
private String name;
private int year;
private String genre;
public Media(String n, int y, String g) {
name = n;
year = y;
genre = g;
}
public String getName() {
return name;
}
public int getYear() {
return year;
}
public String getGenre() {
return genre;
}
public String toString() {
return String.format("%5d %-55s %-15s", year, name, genre);
}
//if the media was released on or after the year 2000, return New Millennium Era
//if the media was released on or after the year 1977, return Modern Era
//if the media was released on or after the year 1955, return Change Era
//if the media was released on or after the year 1941, return Golden Era
//in any other situation, return Pre-Golden Era
public abstract String getEra();
//return true if this media has a greater release year than the other's
public abstract boolean wasReleasedAfter(Media other);
//return true if this media was a lesser or equal release yearn than the other's
public abstract boolean wasReleasedBeforeOrInSameYear(Media other);
}
MovieLoader.java
import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Scanner;
public class MovieLoader {
public static ArrayList loadAllMovies() throws FileNotFoundException {
File f = new File("movie_list.txt");
Scanner inputFile = new Scanner(f);
ArrayList result = new ArrayList<>();
while (inputFile.hasNextLine()) {
String name = inputFile.nextLine();
int year = inputFile.nextInt();
//skip new line
inputFile.nextLine();
String genre = inputFile.nextLine();
Media m = new Movie(name, year, genre);
result.add(m);
}
return result;
}
}
MediaReducer
import java.util.ArrayList;
public interface MediaReducer {
public String reduce(ArrayList list, String key);
}
A couple from the movie_list.txt
!Next? 1994 Documentary #1 Single 2006 Reality-TV #ByMySide 2012 Drama #Follow 2011 Mystery #nitTWITS 2011 Comedy $#*! My Dad Says 2010 Comedy $1,000,000 Chance of a Lifetime 1986 Game-Show $100 Makeover 2010 Reality-TV $100 Taxi Ride 2001 Documentary $100,000 Name That Tune 1984 Game-Show $100,000 Name That Tune 1984 Music $2 Bill 2002 Documentary $2 Bill 2002 Music $2 Bill 2002 Music $2 Bill 2002 Music $2 Bill 2002 Music $25 Million Dollar Hoax 2004 Reality-TV $40 a Day 2002 Documentary $5 Cover 2009 Drama $5 Cover: Seattle 2009 Drama $50,000 Letterbox 1980 Game-Show $9.99 2003 Adventure $weepstake$ 1979 Drama ' Horse Trials ' 2011 Sport '80s Videos: A to Z 2009 Music 'Allo 'Allo! 1982 Comedy 'Allo 'Allo! 1982 War 'Conversations with My Wife' 2010 Comedy 'Da Kink in My Hair 2007 Comedy 'Da Kink in My Hair 2007 Drama 'More strasti' 2000 Romance 'Ons Sterrenkookboek' 2007 Documentary 'Orrible 2001 Comedy 'Orrible 2001 Crime 'Orrible 2001 Drama 'S ann an Ile 2009 Documentary 'Sang linggo nAPO sila 1995 Game-Show 'Sang linggo nAPO sila 1995 Musical 'T Wilhelmina 1975 Comedy 'Til Death Do Us Part 2006 Crime 'Til Death Do Us Part 2006 Drama 'Til Death Do Us Part 2006 Fantasy 'Til Death Do Us Part 2006 Romance 'Til Death Do Us Part 2006 Thriller 'Til Death 2006 Comedy 'Untold 2004 Documentary 'Wag kukurap 2004 Horror 'Way Out 1961 Drama 'Way Out 1961 Horror 'Way Out 1961 Sci-Fi 'n Shrink 2009 Comedy 't Is maar TV 1999 Comedy 't Is maar TV 1999 Game-Show 't Is maar een spel 2002 Comedy 't Is maar een spel 2002 Game-Show 't Schaep Met De 5 Pooten 1969 Comedy 't Schaep Met De 5 Pooten 2006 Comedy 't Schaep Met De 5 Pooten 2006 Drama 't Zal je gebeuren... 1998 Drama 't Zonnetje in huis 1993 Comedy (S)truth 1999 Drama + Clair 2001 Documentary + Emprendedores mi+d 2010 Documentary + Investigadores 2008 Documentary + de cin�ma 2001 Documentary + de cin�ma 2001 News ... ins Gr�ne! Das Stadt-Land-Lust-Magazin 2010 Documentary ... und basta! 2006 Comedy ... und basta! 2006 Music ... und die Tuba bl�st der Huber 1981 Comedy
In: Computer Science