Income tax based on the old income tax rate

Assignment Help Basic Computer Science
Reference no: EM132263855

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: EM132263855

Questions Cloud

What is the definition of technical communication : ENGL 4092 Assignment - What is the definition of technical communication? What is the purpose of a persuasive document
Cause unplanned service interruptions : DHCP is a very promiscuous service, and this can cause unplanned service interruptions if not configured properly. Explain.
Define cost of capital for a new enterprise : Define Cost of Capital for a new enterprise. Describe the various layers of the capital structure and how they can be used to balance the Cost of Capital.
What your organization does to implement the stated control : Download the Cloud Security Alliance (CSA) Cloud Controls Matrix spreadsheet. (A quick Internet search should give you the address of the most current version.
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:
Prompts the user for an integer number : 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.
Enhancement and pre-structuring techniques : Also, discuss input enhancement and pre-structuring techniques that exploit space for time with an example (please do not use the same example as your peers).
Third normal form : To take this motley crew of tables to Third Normal Form (3NF), we must now take 2NF tables and eliminate all transitive (i.e., hidden) dependencies.
What conclusions have you been able to draw : Based on your research, what conclusions have you been able to draw related to your final presentation topic? Please describe your final presentation topic.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

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