224k views
2 votes
Modify the program you created in Lab Assignment #9 (Babbage's Cabbages, Part 3) to include the following features:

Add a new input function to your program that asks if the employee uses the parking garage, participates in the transit program, or rents a bike locker, and calculates the appropriate deduction. An employee can only participate in one of the three programs. If the employee uses the parking garage, $7.50 is deducted from their weekly check. If the employee participates in the transit program, $5.00 is deducted. If the employee rents a bike locker, $1.00 is deducted. If the employee does none of these, nothing additional is deducted from their weekly check.

Your function should gather the appropriate information from the user and return the amount of the employee's deduction; refer to the sample run that follows for example prompts and calculations.

User Kreeszh
by
8.7k points

1 Answer

5 votes

Final answer:

To modify the program, add a new input function that calculates deductions based on whether the employee uses the parking garage, participates in the transit program, or rents a bike locker.

Step-by-step explanation:

To modify the program you created in Lab Assignment #9 to include the new features, you need to add a new input function that asks the employee if they use the parking garage, participate in the transit program, or rent a bike locker. Based on their answer, you can calculate the appropriate deduction. If the employee uses the parking garage, deduct $7.50 from their weekly check. If they participate in the transit program, deduct $5.00, and if they rent a bike locker, deduct $1.00. If they don't use any of these programs, no additional deduction is made.

Here's an example of how the prompt and calculation could look like:
Enter your choice:
1. Use parking garage
2. Participate in transit program
3. Rent a bike locker
4. None
Choice: 1
Deduction: $7.50

User Tuutsrednas
by
7.2k points