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

Recommended Answers

All 4 Replies

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

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);

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]);
	}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.