Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

bartleby

Concept explainers

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 ]
expand button
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
Check Mark
Knowledge Booster
Background pattern image
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.
Similar questions
    Recommended textbooks for you
    Text book image
    Database System Concepts
    Computer Science
    ISBN:9780078022159
    Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
    Publisher:McGraw-Hill Education
    Text book image
    Starting Out with Python (4th Edition)
    Computer Science
    ISBN:9780134444321
    Author:Tony Gaddis
    Publisher:PEARSON
    Text book image
    Digital Fundamentals (11th Edition)
    Computer Science
    ISBN:9780132737968
    Author:Thomas L. Floyd
    Publisher:PEARSON
    Text book image
    C How to Program (8th Edition)
    Computer Science
    ISBN:9780133976892
    Author:Paul J. Deitel, Harvey Deitel
    Publisher:PEARSON
    Text book image
    Database Systems: Design, Implementation, & Manag...
    Computer Science
    ISBN:9781337627900
    Author:Carlos Coronel, Steven Morris
    Publisher:Cengage Learning
    Text book image
    Programmable Logic Controllers
    Computer Science
    ISBN:9780073373843
    Author:Frank D. Petruzella
    Publisher:McGraw-Hill Education