Compute the income tax based on the old income tax rate

Assignment Help Business Management
Reference no: EM132263373

Make an R program to compute the income tax based on the old income tax rate:

Under $25,000 = 15%

$25,000-74,999 = 25%

$75,000-149,999 = 28%

$150,000-299,999 = 33%

$300,000 and over = 35%

The main program creates a random sample incomes between $1,900 to $500,000 of 15 people. The function set.seed(256) is to set the random number seed to 256. The random number generator will generate the sequence of random samples specific to the seed. A fixed seed will allow you getting the SAME random samples for every run. That way, you will have an easier time to debug your program. This, by the way, demonstrates to you that they are not real random samples. They are what is called pseudo-random numbers. The function sample ( ) does the actual work. Check the help manual on sample ( ) to find out more.

The 15 random samples between $1,900 and $500,000 is then assigned to vector incomes. In the next statement:

income.table = income.tax(incomes)

the assignment statement calls a user defined function income.tax( incomes) by passing the incomes vector to that function. Consequently, income.tax ( ) will return a data frame with two columns: incomes and rate of each person. The data frame is assigned to income.table, which allows you compute the tax for each person by multiplying the incomes and rate. Then the mean and standard deviation and the histogram of incomes of this 15 people sample are computed and displayed.

1. Write the income.tax ( ) function that computes and creates the data frame. YOU ARE NOT ALLOWED TO USE LOOPS. (Hints: sapply( ).)

2. After (1) is working, change the sample size from 15 to 150000. Repeat the execution. Compare the histogram of this run to the one you got in 1. Explain your results in a Word document. Save it as prog7.docx and save your R script as incometax.R

Question 2:

This exercise is to make sure you know the basic construct and flow of control of nested if-else statements. I added line number to the LeapYear.R that you did in Prog1 as follows:

1. year = 1900         # This is an inline comment. We assign the integer 1900 to variable name year

2. answer = 'Not a Leap Year'    #initialize year, assuming it is not a leap year

3. if (year %% 4 == 0)            # if the year is fully divisible by 4

{

4. If ( year %% 100 == 0)       # if the year is fully divisible by 100

{

5. if ( year %% 400 == 0)    # and year is fully divisible by 400, then it is a leap year

6. answer = 'Leap Year'    

}     # not a leap year

7. else answer = 'Leap Year'   # if it is fully divisible by 4 but not 100, then it is a leap year

}

8. paste(year, answer)

Fill in the execution step (line numbers) in the table below for the following years: 1900, 1992, 2000, 2016, 2018,2019, 2020. I illustrated the execution for year 2018. 

Leap Yr = No

Explanations: line 1, year = 2018; line 2, answer = 'Not a Leap Year'; line 3, "if" statement is false. It drops completely from the if-else block (from line 3 to 7) to line 8 since answer remains as 'Not a Leap Year'.

Reference no: EM132263373

Questions Cloud

What is sickle cell anemia : What is sickle cell anemia? Explain the cause and risk factors for developing the disorder.
Explain in detail privacy issues related to the case study : Explain in detail, privacy issues related to the case study. Explain in detail, privacy issues related to the case study.Identify the U.S. citizen privacy law.
Dhcp can also be used as a malicious attack tool : 1. DHCP is a very promiscuous service, and this can cause unplanned service interruptions if not configured properly. Explain.
Creating a visualisation in each of given made-up scenarios : This exercise involves you using imagination and logical reasoning to occupy the mindset of a visualiser facing the task of formulating a brief for different.
Compute the income tax based on the old income tax rate : Make an R program to compute the income tax based on the old income tax rate:
Program that prompts the user for an integer number : 1. Program that prompts the user for an integer number from the keyboard, and store it in a variable num. After each number is typed in, add num to a total.
What are the security risks in database migration : Project is a 12-minute presentation to be presented at the residency. You must select a topic from the list provided in this weeks folder.
Wireless access point in a fitness center : An administrator is installing a wireless access point in a fitness center. There will only be 5 devices that have access to it, and they are all company owned.
Summarizing the content of the article or paper : You should summarize the content of the article or paper and explain how it relates to STRIDE and Threat Modeling. Provide your own assessment of the article.

Reviews

Write a Review

Business Management Questions & Answers

  Caselet on michael porter’s value chain management

The assignment in management is a two part assignment dealing 1.Theory of function of management. 2. Operations and Controlling.

  Mountain man brewing company

Mountain Man Brewing, a family owned business where Chris Prangel, the son of the president joins. Due to increase in the preference for light beer drinkers, Chris Prangel wants to introduce light beer version in Mountain Man. An analysis into the la..

  Mountain man brewing company

Mountain Man Brewing, a family owned business where Chris Prangel, the son of the president joins. An analysis into the launch of Mountain Man Light over the present Mountain Man Lager.

  Analysis of the case using the doing ethics technique

Analysis of the case using the Doing Ethics Technique (DET). Analysis of the ethical issue(s) from the perspective of an ICT professional, using the ACS Code of  Conduct and properly relating clauses from the ACS Code of Conduct to the ethical issue.

  Affiliations and partnerships

Affiliations and partnerships are frequently used to reach a larger local audience? Which options stand to avail for the Hotel manager and what problems do these pose.

  Innovation-friendly regulations

What influence (if any) can organizations exercise to encourage ‘innovation-friendly' regulations?

  Effect of regional and corporate cultural issues

Present your findings as a group powerpoint with an audio file. In addition individually write up your own conclusions as to the effects of regional cultural issues on the corporate organisational culture of this multinational company as it conducts ..

  Structure of business plan

This assignment shows a structure of business plan. The task is to write a business plane about a Diet Shop.

  Identify the purposes of different types of organisations

Identify the purposes of different types of organisations.

  Entrepreneur case study for analysis

Entrepreneur Case Study for Analysis. Analyze Robin Wolaner's suitability to be an entrepreneur

  Forecasting and business analysis

This problem requires you to apply your cross-sectional analysis skills to a real cross-sectional data set with the goal of answering a specific research question.

  Educational instructional leadership

Prepare a major handout on the key principles of instructional leadership

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd