CECS 100
LAB ASSIGNMENT 2
Assigned date:
 9/9
Due date:   
Monday 9/18
30 points

Objectives:

In this lab, you learn to create a Raptor flowchart.

After completing this lab, you will be able to:

PreLab

Do the following activities before doing the lab assignment. 

Problem 1 [10 points]

 Draw a flowchart (name the file as lab2.rap)  using Raptor to compute a person's income tax. Here is the relevant tax law:

The user inputs are the gross income and number of dependents. The program calculates the income tax based on the inputs and the tax law and then displays the income tax.

The user interface for the income tax program

Enter the gross income:  500000.00
Enter the number of dependents: 4
The income tax is $96400.00
The gross income after tax  $ 403600.0

Requirements

There are no magic numbers in the flowchart.  A magic numbers are always constant in the program.  In the lab assignment, flat rate, $10,000, $2000 are constants. You need to create a named constant (constant variable) to represent the magic number. The named constants should be always written in uppercase.

Example: Define the constants using a named constant.. A number that is not changed in a program should be assigned to a named constant. The named constant is sometimes called a constant variable. All the characters in a constant variable should be uppercase.

TAX_RATE = 0.2
STANDARD_DEDUCTION -= 10000.0
DEPENDENT_DEDUCTION = 2000.0

When you write an expression that has the magic number, you should replace it with the named constant.

Example:

TAX_RATE = 0.02
incomeTax = grossIncome * 0.02 - This expression has a magic number 0.02. You need to rewrite the expression with a named constant.

incomeTax = grossIncome * TAX_RATE

All the variable must be camel casing.

Hints:

Grading

Name the Raptor flowchart file as lab2.rapDo not change the file name to any other name. Submit the file to the Beachboard.

Problem 2 [8 points]

Convert the flowchart in the lab assignment 1 into a Python program.

Problem 3 [12 points]

Convert the problem 1 in the lab assignment 2 into a Python program. Name the file lab22.py

Grading

Name the Raptor flowchart file as lab23.pyDo not change the file name to any other name. Submit the file to the Beachboard.

Lab assignment Grading Rubric
Criteria Approx. % of Grade Excellent (100%) Adequate (80%)  Poor (60%) Not Met (0%)
Program Specification /Correctioness 50%(10 points) No errors, program always works correctly and meets the specification(s). Minor details of the program specification are violated, program functions incorrectly for some inputs. Significant details of the specification are violated, program often exhibits incorrect behavior. Program only functions correctly in very limited cases or not at all.
Readability 20% (4 points) No errors, code is clean, understandable, and well-organized. Minor issues with consistent indentation, use of whitespace, variable naming, or general organization. At least one major issue with indentation, whitespace, variable names, or organization. Major problems with at three or four of the readability subcategories.
Documentation 10% (2 points) No errors, code is well-commented. One or two places that could benefit from comments are missing them or the code is overly commented. File header missing, complicated lines or sections of code uncommented or lacking meaningful comments. No file header or comments present.
Code Efficiency 15% (3 points) No errors, code uses the best approach in every case. No errors, code uses the working approach in every case.  Code uses poorly-chosen approaches in at least one place. Many things in the code could have been accomplished in an easier, faster, or otherwise better fashion.
Assignment Specifications 5% (1 point) No errors N/A Minor details of the assignment specification are violated, such as files named incorrectly or extra instructions slightly misunderstood. Significant details of the specification are violated, such as extra instructions ignored or entirely misunderstood.