0% found this document useful (0 votes)
15 views2 pages

C Programming - Assignment 7 (12!3!25)

The document outlines an assignment for a C Programming Lab, consisting of two main questions. The first question involves writing a program to decode a message by shifting a specified letter to the next character in the alphabet. The second question requires developing an Employee Payroll Management System that calculates gross and net salaries for multiple employees based on their hourly wage, hours worked, tax rate, and insurance deductions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views2 pages

C Programming - Assignment 7 (12!3!25)

The document outlines an assignment for a C Programming Lab, consisting of two main questions. The first question involves writing a program to decode a message by shifting a specified letter to the next character in the alphabet. The second question requires developing an Employee Payroll Management System that calculates gross and net salaries for multiple employees based on their hourly wage, hours worked, tax rate, and insurance deductions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Assignment 7

C Programing Lab (Section B)


Instruction:
1. Follow the programming guidelines taught in the theory class. Refer to the provided slides to
ensure you're writing in a clear and effective style.
2. Once completed, show your code to the respective TAs.
3. You may ask the TAs for help if you're encountering syntax errors or having trouble
understanding the questions. However, the TAs will not provide you with the exact logic; you'll
need to figure that out on your own.

Question 1: Problem: Magical Scroll


A group of explorers discovered a magical scroll with an encoded message. The magic is such
that each time a certain letter appears in the scroll, it must be replaced by the next character in
the alphabet to unlock the hidden meaning. If the letter is 'z', it wraps around to 'a'. Your
job is to write a C program that applies this transformation to all instances of a specific letter in
any given string.
Your Task:
1. Prompt the user to enter a string (the encoded message).
2. Prompt the user to choose which letter needs to be shifted to the next letter in the alphabet.
3. Transform all instances of that chosen letter in the string.
o If the letter is 'z', replace it with 'a'.
o Otherwise, replace it with its next neighbor (e.g., 'a' -> 'b', 'b' -> 'c', etc.).
4. Print the transformed string.

Question 2: Employee Payroll Management System


You are hired by a software company to develop an Employee Payroll Management
System. The company needs a program to calculate the monthly salary of multiple
employees based on their hourly wage and the number of hours worked. Additionally,
the program needs to handle deductions like tax and insurance.

The company wants you to implement the following requirements using multiple
functions to make the program modular and reusable.

Requirements:

1. Input: The program should accept the following information for each employee:
a. Employee ID
b. Hourly wage
c. Hours worked for the month
d. Tax rate (as a percentage)
e. Insurance deduction (fixed amount)
2. Output: The program should calculate and display the following for each employee:
a. Gross salary (before deductions)
b. Net salary (after tax and insurance deduction)

3. Custom Functions to Implement:


a. calculate_gross_salary: This function should calculate and return the gross
salary based on the employee's hourly wage and hours worked.
float calculate_gross_salary(float hourly_wage, float hours_worked)
b. calculate_tax: This function should calculate and return the amount of tax to be
deducted based on the gross salary and tax rate.
float calculate_tax(float gross_salary, float tax_rate)
c. calculate_net_salary: This function should calculate and return the net salary
after tax and insurance deductions.
float calculate_net_salary(float gross_salary, float tax, float insurance)

4. Iterating for Multiple Employees: The program should handle payroll calculation for
multiple employees and display the results in a tabular format. The number of
employees should be input by the user.

You might also like