0

I just dont know where to start on this. Can anyone lend me a hand?

4- Write a Java program to create the following array that hold the salaries of employees:

1550.8 2439.5 1800.75 2890.0
The company wants to give the employees a bonus of 30% of their initial salary, your program should first create the array with the initial employees’ salaries and then update the salaries to show the 30% increase.

thanks

5
Contributors
4
Replies
5
Views
6 Years
Discussion Span
Last Post by plasticfood
1

this mean: YOU
should first create the array with the initial employees’ salaries
and then update the salaries to show the 30% increase

Read Me: Starting "Java" [Java tutorials / resources / faq] - first thread on the page

0

if(you are serious about this qn)
------initialise a double array, iterate thru each element in a for loop, and 1.3X
------the value of each element;
------read the array API;
else
------wtf;
------System.exit(0);

0
double [] salary = new double [4];
	salary[0] = 1550.8;    
	salary[1] = 2439.5;
	salary[2] = 1800.75;
	salary[3] = 2890.0;
	
	//show the array before the bonus//
	for(int i = 0; i < 4; i++){
		System.out.println(salary[i]);
	}
	System.out.println("----- with bonus-------");
	double bonus = 0;
	
	for(int i = 0; i<4; i++){
		bonus = (salary[i]*30)/100.0;
		salary[i] += bonus;
		System.out.println(salary[i]);
	}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.