A program that accepts an employee’s ID, total worked hours in a month and the amount he received per hour. Print the ID and salary (with two decimal places) of the employee for a particular month.

Here, we have a basic program example to print the id and monthly salary of the employee using different languages. This program is created in c language, c++, Java, and Python.

Program to print id and monthly salary of the employee in C language

#include <stdio.h>
int main() {
	char id[10];
	int hour;
	double value, salary;
	printf("Input the Employees ID(Max. 10 chars): ");
	scanf("%s", &id);
	printf("\nInput the working hrs: ");
	scanf("%d", &hour);
	printf("\nSalary amount/hr: ");
	scanf("%lf", &value);
	salary = value * hour;
	printf("\nEmployees ID = %s\nSalary = U$ %.2lf\n", id,salary);
	return 0;
}

Program to print id and monthly salary of the employee in C++ language

#include<iostream>
#include<stdlib.h>
#include<cmath>
using namespace std;
int main()
{
	char id[10];
	int hour;
	double value, salary;
	cout<<"Input the Employees ID(Max. 10 chars): ";
	cin>>id;
	cout<<"\nInput the working hrs: ";
	cin>>hour;
	cout<<"\nSalary amount/hr: ";
	cin>>value;
	salary = value * hour;

    cout<<"\nEmployee ID = "<<id<<"\nSalary = "<<salary;
    return 0;
}

Program to print id and monthly salary of the employee in Python language

id = input('Enter employee ID(Max. 10 chars): ')
hour = input('Enter the working hours: ')
value = input('Enter the salary amount/hr: ')
salary = float(value) * float(hour)
print('Employee ID =  {0} Salary = {1}'.format(id,salary))

Program to print id and monthly salary of the employee in Java language

import java.util.Scanner;
public class employee
  {
      public static void main(String args[])
         {
             int id;
             int hour;
            double value, salary;
            Scanner sc = new Scanner(System.in);
            System.out.print("Enter the employee id: ");
            id=sc.nextInt();
           System.out.print("Enter the working hours: ");
           hour=sc.nextInt();
           System.out.print("Enter the salary amount/hr: ");
           value=sc.nextInt();
           salary=value*hour;
           System.out.println("Employee id = "+id+" Salary = " +salary);
        }
  }