public static void main(String[] args){ String[] names = new String[3]; double[] salaries = new double[3]; Scanner input = new Scanner(System.in); // First, using loop to get 3 employee names from the user, and save them in the array "names" // Hint: to get String values, use input.nextLine () method // Next, using loop to get the salaries of the 3 employees, and save them in the array "salaries" // The program should prompt the user with employee names, like: // "What is the salary of Xiaoxing?" // Then, modify the statements below to print out the average salary of all employees // and the NAME of the employee with the highest salary // You should invoke the methods index0fHighest(), and getArrayAverage(). // The average number should have two decimal points System.out.printf("The average salary is: "); // incomplete System.out.println("The employee with the highest salary is: "); // incomplete private static double getArrayAverage(double[] input){ //This method should return the average of the array elements in the array "input" return 0; // remove this line when you start working private static int indexOfHighest(int[] input){ // This method should return the INDEX of the largest element in the array "input" return 0; // remove this line when you start working
public static void main(String[] args){ String[] names = new String[3]; double[] salaries = new double[3]; Scanner input = new Scanner(System.in); // First, using loop to get 3 employee names from the user, and save them in the array "names" // Hint: to get String values, use input.nextLine () method // Next, using loop to get the salaries of the 3 employees, and save them in the array "salaries" // The program should prompt the user with employee names, like: // "What is the salary of Xiaoxing?" // Then, modify the statements below to print out the average salary of all employees // and the NAME of the employee with the highest salary // You should invoke the methods index0fHighest(), and getArrayAverage(). // The average number should have two decimal points System.out.printf("The average salary is: "); // incomplete System.out.println("The employee with the highest salary is: "); // incomplete private static double getArrayAverage(double[] input){ //This method should return the average of the array elements in the array "input" return 0; // remove this line when you start working private static int indexOfHighest(int[] input){ // This method should return the INDEX of the largest element in the array "input" return 0; // remove this line when you start working
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
Complete the uncompleted java program. The sample run is attached below.
![Salary x
Compile
Undo
Cut
Соpy
Paste
Find...
Close
Source Code
*/
public class Salary
|{
public static void main(String[] args){
String[] names
double[] salaries
Scanner input = new Scanner(System.in);
= new String[3];
new double[3];
// First, using loop to get 3 employee names from the user, and save them in the array "names"
// Hint: to get String values, use input.nextLine() method
// Next, using loop to get the salaries of the 3 employees, and save them in the array "salaries"
// The program should prompt the user with employee names, like:
// "What is the salary of Xiaoxing?"
// Then, modify the statements below to print out th
// and the NAME of the employee with the highest salary
// You should invoke the methods index0fHighest(), and getArrayAverage().
// The average number should have two decimal points
System.out.printf("The average salary is: "); // incomplete
System.out.println("The employee with the highest salary is: ");
average salary of all employees
// incomplete
private static double getArrayAverage (double[] input){
//This method should return the average of the array elements in the array "input"
return 0; // remove this line when you start working
%3D
private static int index0fHighest(int[] input){
// This method should return the INDEX of the largest element in the array "input"
return 0; // remove this line when you start working
}
saved](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F6bf2943f-700f-43bc-a328-58066267f331%2F96ad8309-efbc-400b-af4b-fe8fbf6bfa5d%2F9mbcuwr_processed.png&w=3840&q=75)
Transcribed Image Text:Salary x
Compile
Undo
Cut
Соpy
Paste
Find...
Close
Source Code
*/
public class Salary
|{
public static void main(String[] args){
String[] names
double[] salaries
Scanner input = new Scanner(System.in);
= new String[3];
new double[3];
// First, using loop to get 3 employee names from the user, and save them in the array "names"
// Hint: to get String values, use input.nextLine() method
// Next, using loop to get the salaries of the 3 employees, and save them in the array "salaries"
// The program should prompt the user with employee names, like:
// "What is the salary of Xiaoxing?"
// Then, modify the statements below to print out th
// and the NAME of the employee with the highest salary
// You should invoke the methods index0fHighest(), and getArrayAverage().
// The average number should have two decimal points
System.out.printf("The average salary is: "); // incomplete
System.out.println("The employee with the highest salary is: ");
average salary of all employees
// incomplete
private static double getArrayAverage (double[] input){
//This method should return the average of the array elements in the array "input"
return 0; // remove this line when you start working
%3D
private static int index0fHighest(int[] input){
// This method should return the INDEX of the largest element in the array "input"
return 0; // remove this line when you start working
}
saved

Transcribed Image Text:Please enter 3 employee names:
Liu
Bradley
Chays
Please enter the salary of Liu
5000
Please enter the salary of Bradley
6000
Please enter the salary of Chays
4500
The average salary is: 5166.67
The employee with highest salary is: Bradley
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON

Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education