Question

There are N employees already working for a company and M new candidates eligible for the work. At the end of the financial yOutput Format: Output a single integer denoting total number of employees working for the company after this process. Input CPlease code in java

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Java Code:

import java.util.*;
public class Main
{
   public static void main(String[] args) {
   Scanner sc = new Scanner(System.in); //scanner object
       int i,n,m,x;   
       n=sc.nextInt(); //inputing the values of n,m,x
       m=sc.nextInt();
       x=sc.nextInt();
       int arr[][]=new int[n][x]; //two dimensional array that takes
       int inc[]=new int[n]; //previous salary and demanded salary
       for(i=0;i<n;i++)
       {
       arr[i][0]=sc.nextInt(); //inputing the values
       arr[i][1]=sc.nextInt();
       inc[i]=arr[i][1]-arr[i][0]; //inc[i] is increment in salary
       }
       int ne[]=new int[m]; //array to store values of new employees
       for(i=0;i<m;i++)
       {
       ne[i]=sc.nextInt(); //ne[i] is salary of new employees
       }
       int all[]=new int[m+n]; //all[] array to store all values of increment of old employees
       for(i=0;i<n;i++) //and salary for new employees
       {
       all[i]=inc[i];
       }
       for(;i<m+n;i++)
       {
       all[i]=ne[i-n];
       }
       Arrays.sort(all); //sorting the array to know that which operation is better
       int res=0,c=0; // increment the salary or hire new employees
       for(i=0;i<m+n;i++)
       {
       if(all[i]+res<=x)
       {
       res+=all[i];
       c++; //count number of exployees we can maximize
       }
       }
       System.out.println(c); //printing the result
   }
}

Screenshots:

import java.util.*; public class Main public static void main(String[] args) { Scanner sc = new Scanner(System.in); //scanner

for(;i<m<n;i++) all[i]=ne[i-n]; Arrays.sort(all); int res=0,c=0; for(i=0;i<m+n;i++) 1/sorting the array to know that which op

Output:

53 20 10 15 78 B 10 15 17 200 300 10 27

If you have any queries, please comment below.

Please upvote , if you like this answer.

Add a comment
Know the answer?
Add Answer to:
Please code in java There are N employees already working for a company and M new...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • C++ Code Please, Three employees in a company are up for a special pay increase. You...

    C++ Code Please, Three employees in a company are up for a special pay increase. You are given a file, say Ch3_Ex5Data.txt, with the following data: Miller Andrew 65789.87 5 Green Sheila 75892.56 6 Sethi Amit 74900.50 6.1 Each input line consists of an employee’s last name, first name, current salary, and percent pay increase. For example, in the first input line, the last name of the employee is Miller, the first name is Andrew, the current salary is 65789.87,...

  • Edison Inc., an electrical utility company, is moving from using only traditional sources of electricity to...

    Edison Inc., an electrical utility company, is moving from using only traditional sources of electricity to promoting the use of solar and wind power. It is one of the first utilities in the country to move heavily to solar and wind-generated electricity. Which of the following steps should the HR director take in order to cope with these new technologies at Edison Inc.? a. Avoid including specific designations such as EEO/M-F/AA/ADA in the job advertisements b. Focus on training and...

  • New to DB's Please help! You are designing and creating a database named COMPANY for an HR (Human Resource) Dept of...

    New to DB's Please help! You are designing and creating a database named COMPANY for an HR (Human Resource) Dept of a Software Consulting Company to manage their employees and their assigned work (projects) in the company First Step to Design and Create a Database is Creating an E-R Diagram by Identifying Entities, Attributes and Relationships between any two Entities to Create a Company Database Scheme. 1. Create an E-R Diagram for the Company database from the raw data files...

  • Group work #2 Case Study The "XYZ company decided to implement a new performance management system based on employees' performance and merit. During its 50 years of existence, t...

    Group work #2 Case Study The "XYZ company decided to implement a new performance management system based on employees' performance and merit. During its 50 years of existence, the company practiced "paternalistic" HRM system with the following features: Jobs, not skills or performance, are the foundations of HR decisions Performance appraisal does not take into account the merit of the employees Compensation system is based on jobs rather than performance or skills . The new performance management system was decided...

  • Use program control statements in the following exercises: Question 1 . Write pseudocode for the following:...

    Use program control statements in the following exercises: Question 1 . Write pseudocode for the following: • Input a time in seconds. • Convert this time to hours, minutes, and seconds and print the result as shown in the following example: 2 300 seconds converts to 0 hours, 38 minutes, 20 seconds. Question 2. The voting for a company chairperson is recorded by entering the numbers 1 to 5 at the keyboard, depending on which of the five candidates secured...

  • Please develop the following code using C programming and using the specific functions, instructi...

    Please develop the following code using C programming and using the specific functions, instructions and format given below. Again please use the functions given especially. Also don't copy any existing solution please write your own code. This is the first part of a series of two labs (Lab 7 and Lab 8) that will complete an implementation for a board-type game called Reversi (also called Othello). The goal of this lab is to write code that sets up the input...

  • Actions that damage a company and its employees should be stamped out, everyone would agree. But ...

    Actions that damage a company and its employees should be stamped out, everyone would agree. But should the people responsible be stamped out, too? HBR CASE STUDY The Reign of Zero Tolerance by Ben Gerson "Mr. Pemberton?" manager. The guards had radioed her that the "Yes, that's me," Simon replied distractedly, his back turned. target wasn't putting up much resistance. "Your personal belongings will be messen The two burly gentlemen who had suddenly gered to your home later today," Sallie...

  • Discussion questions 1. What is the link between internal marketing and service quality in the ai...

    Discussion questions 1. What is the link between internal marketing and service quality in the airline industry? 2. What internal marketing programmes could British Airways put into place to avoid further internal unrest? What potential is there to extend auch programmes to external partners? 3. What challenges may BA face in implementing an internal marketing programme to deliver value to its customers? (1981)ǐn the context ofbank marketing ths theme has bon pururd by other, nashri oriented towards the identification of...

  • Identify 8 issues in regards to Recruitment and Selection, 3 issues for Labour Relation in the...

    Identify 8 issues in regards to Recruitment and Selection, 3 issues for Labour Relation in the following case study : You have recently been hired as an HR Consultant in the new HR Department of Outrage Video Games. Outrage is a five year old, upstart company, run by two very bright young men - Will Bates – President, and his best friend Steve Cobbs, Vice President. This is a very exciting change for you because Outrage, which literally started in...

  • Industrial and Organizational Psychology questions

    Industrial-organizational psychologists are interested in all of the following except1. how to best diagnose clinical disorders and offer therapy to employees.2. how personality characteristics influence work behavior.3. how culture influences people's perceptions of their working environments.4. how people's work affects their home life.An organizational psychologist would be most likely concerned with1. studying the interaction between humans and technology.2. All of the these3. interviewing potential employees.4. helping people organize their schedules and daily planners.5. understanding the emotional and motivational side of...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT