Knowee
Questions
Features
Study Tools

Problem StatementIn a corporate office, HR wants to implement a program to input an employee's ID and salary. Your task is to assist him in using pointers to efficiently manage and print the employee details, displaying the ID and salary for accurate record-keeping.Input format :The first line of input consists of an integer, representing the employee ID.The second line consists of a float value, representing the salary of the employee.Output format :The first line of output prints "ID: " followed by the employee ID, as an integer.The second line prints "Salary: " followed by the salary of the employee, as a float value, rounded off to two decimal places.

Question

Problem StatementIn a corporate office, HR wants to implement a program to input an employee's ID and salary. Your task is to assist him in using pointers to efficiently manage and print the employee details, displaying the ID and salary for accurate record-keeping.Input format :The first line of input consists of an integer, representing the employee ID.The second line consists of a float value, representing the salary of the employee.Output format :The first line of output prints "ID: " followed by the employee ID, as an integer.The second line prints "Salary: " followed by the salary of the employee, as a float value, rounded off to two decimal places.

...expand
🧐 Not the exact question you are looking for?Go ask a question

Solution

This problem can be solved using C or C++ programming language. Here is a step-by-step guide on how to do it:

Step 1: Declare the variables First, you need to declare the variables for the employee ID and salary. Since the problem statement mentions that the ID is an integer and the salary is a float, you should declare them as such. Also, since you need to use pointers, declare pointer variables for both.

int id;
float salary;
int *ptr_id = &id;
float *ptr_salary = &salary;

Step 2: Input the values Next, you need to input the values for the employee ID and salary. You can use the scanf function for this. Remember to use the address-of operator (&) since you're inputting the values into the memory locations pointed to by the pointers.

printf("Enter employee ID: ");
scanf("%d", ptr_id);
printf("Enter salary: ");
scanf("%f", ptr_salary);

Step

This problem has been solved

Similar Questions

Write a C program to store the information of employees in a company using structures. Each employee should have the following details:Employee code (integer)Employee name (string)Salary (float)Department number (integer)The program should allow the user to input the number of employees (n) and then input the details of each employee. i.Display the employee name with the maximum salary.ii. Display the average salary of all employees in the company.Test Case:3 // number of employees101  //Enter employee code:John Doe // Enter employee name:50000.00 // Enter salary:1  // Enter department number:102Jane Smith60000.001103Suresh Raina55000.002Output:Jane Smith55000.00  // avg of all employees salary

Design a structure in C to represent an employee's information, including their name, employee ID, department, and salary. Additionally, write a program that allows users to input employee data, display employee information, and update an employee's salary. write a code for demonstrating the implementation of the structure and program functionalities.input and output Enter employee details:Enter employee name: John DoeEnter employee ID: 101Enter department: SalesEnter salary: 50000Employee Information:Name: John Employee ID: 101 Department:Sales Salary: 50000.00Enter new salary: 55000Salary updated successfully.Updated Employee Information:Name: JohnEmployee ID: 101Department: SalesSalary: 55000.00

Write a C++ program to implement a class called Employee that has member variables for name, ID, appraisal_score A (out of 10) and salary. Include member functions to calculate salary based on employee performance. Create object and call the member function and print the results.If A>5 and A<8  - increment is 60% of his old salaryIf A>=8   - increment is 80% of his old salaryIf A>= 2 & A<=5-  increment is 40 % of his old salaryIf A=1 -No incrementnew salary=increment+old_salarySample InputJeny223300006Sample OutputJeny increment is 18000Jeny new salary is 48000

Single File Programming QuestionProblem StatementMark wants to calculate his monthly savings based on his salary and a specified savings percentage.Write a program to help Mark that input the monthly salary and the percentage of the salary to save. Use pointers to calculate the amount to save. Display the calculated amount with two decimal places.Input format :The first line of input consists of a floating-point value, representing the monthly salary.The second line consists of a floating-point value, representing the savings percentage.Output format :The output prints a floating-point value, representing the calculated savings amount, rounded off to two decimal places.Refer to the sample output for formatting specifications.Code constraints :In this scenario, the test cases fall under the following constraints:1.00 ≤ monthly salary ≤ 1,00,000.001.00 ≤ percentage ≤ 100.00Sample test cases :Input 1 :10000.5010.75Output 1 :1075.05Input 2 :80575.2514.50Output 2 :11683.41Note :The program will be evaluated only after the “Submit Code” is clicked.Extra spaces and new line characters in the program output will result in the failure of the test case.Marks : 10Negative Marks : 0WhitelistSet 1:*

Problem StatementFin is managing salary taxation and wants a program to determine the net salaries based on the provided salary amount. Determine the net salary: If the salary is less than 50000, print "No Tax." For salaries between 50000 (inclusive) and 100000 (exclusive), apply 10% tax and print the net salary after deduction.For 100000 or more, apply 20% tax and print the net salary after deduction.Implement a program that takes Fin's salary as input (integer) and calculates the net salary after converting it into float.Input format :The input consists of an integer value n, representing Fin's monthly salary.Output format :If no tax is applicable, the output prints "No Tax"If a tax is applicable, the output prints "Salary after X% Tax: Y" where X represents the applicable tax percent value and Y represents the net salary after deduction with two decimal places.Refer to the sample output for the formatting specifications.Code constraints :In this scenario, the test cases fall under the following constraints:1000 ≤ n ≤ 120000Sample test cases :Input 1 :40000Output 1 :No TaxInput 2 :60000Output 2 :Salary after 10% Tax: 54000.00Input 3 :120000Output 3 :Salary after 20% Tax: 96000

1/3

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.