Posts

A mobile manufacturing company pays its employees as follows: - C Programming

A mobile manufacturing company pays its employees as follows:   Team leaders (fixed fortnightly salary)   Sales workers ($500 plus 6.5% of their gross fortnightly sales)   Pieceworkers (fixed amount of money per item for each of the items they produce, each piece worker in this company works on only 1 type of item)   Hourly workers (fixed hourly wage for up to the first 60 hours they work and "time-and a-half" i.e., 1.5 times their hourly wage, for overtime hours worked)   Write a program to compute the weekly pay for each employee. You do not know the number of employees in advance. Each type of employee has its own pay code:   Code 1: Team leaders   Code 2: Sales workers   Code 3: Pieceworkers   Code 4: Hourly workers  There will be an undetermined number of entries into the payroll. Use a switch to c...

How to enable autocomplete in Eclipse - (Eclipse 2020.06)

Image
How to enable autocomplete in Eclipse Eclipse 2020.06 1. 2.Auto Activation > Auto activation triggers for Java 3.Enter all the characters you want to trigger autocomplete, such as the following: abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ._ SOURCE :  https://stackoverflow.com/a/32621121/11714532

Implement a class named RandNum. The class should have a 5x5 2D array of 25 integers. The constructor should use the random() function to generate a random number in the range of 1 to 100 for each element in the array. Implement a method to calculate the minimum, maximum and average of the 25 values. Implement a method to display the values of the array, minimum, maximum and average of the 25 values.

Image
Question: Implement a class named RandNum. The class should have a 5x5 2D array of 25 integers. The constructor should use the random() function to generate a random number in the range of 1 to 100 for each element in the array. Implement a method to calculate the minimum, maximum and average of the 25 values. Implement a method to display the values of the array, minimum, maximum and average of the 25 values. Model Answer: Java public class RandNum { int minValue; int maxValue; int sum; double average; int[][] arr = new int[5][5]; public RandNum(){ int max = 100; int min = 1; int range = max - min + 1; for (int i = 0; i < 5; i++) { for (int j = 0; j < 5; j++) { arr[i][j] = (int)(Math.random() * range) + min; } } } public void calculateValues(){ maxValue = arr[0][0]; for (int j = 0; ...