
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
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](https://content.bartleby.com/qna-images/question/6bf2943f-700f-43bc-a328-58066267f331/96ad8309-efbc-400b-af4b-fe8fbf6bfa5d/9mbcuwr_thumbnail.png)
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 nowThis is a popular solution!
Step by stepSolved 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.Similar questions
- Write a Java program that will use while loops. The while loop will show the cards currently in the hand and ask the user to accept a card (Hit) or to stop (Stand). Within the while loop the program should print the card that was just added, all the cards in the hand, and the new value of the hand. If the value of the hand exceeds 21, the game should end (the while loop should stop). Write out the algorithm for the while loop. Turn in a printout of the algorithm, the code and a printout of a sample run. Place the algorithm and the sample run inside comment blocks in the code. "The sample runs of such a program are on the attached image."arrow_forwardDon't try to copy anything. If I see plagiarism then I'll reduce rating for sure.arrow_forwardCreate a program, the only requirement is you must implement the @Override annotation. (Write a simple Java program)arrow_forward
- this needs to be corrected The file provided in the code editor to the right contains syntax and/or logic errors. In each case, determine and fix the problem, remove all syntax and coding errors. java import java.util.Scanner; public class DebugThree3 { public static void main(String args[]) { String name; name = getName() displayGreeting(namme); } public static String getName(void) { String name; Scanner input = new Scanner(System.in); System.in.print("Enter name "); name = input.nexlLine(); return namer; } public static displayGreeting(String name) { System.outprintln("Hello, " + name + "!"); } }arrow_forwardPLz help with the following: in javaarrow_forwardNeed help to make a calculator in coding with Java.arrow_forward
- The following code implements a Java Pasta timer that looks like the application below.• Once the start button is pressed the timer will count to two minutes.• The timer can be stopped by pressing stop.• When the timer is finished, it should pop-up an appropriate dialog box that states the timeis up.You are given a partial implementation of program. Fill out the missing code to complete theprogram import javax.swing.*;import java.awt.event.*;import javax.swing.border.*;public class PastaTimerApp extends implements { private JProgressBar progrBar; private JButton startButton, stopButton; private JLabel textLabel; private PastaTimer PastaTimer; public PastaTimerApp() { JPanel p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); p.setBorder(new TitledBorder("Pasta Timer:")); progrBar = new JProgressBar(JProgressBar.HORIZONTAL, 0, 540); textLabel = new JLabel(" 0 Seconds "); p.add(progrBar); p.add(textLabel); // Initialize buttons and add action listeners JPanel controls =…arrow_forwardFind out about Java’s switch-case statement. What is its -purpose? How is it used? Write an example. (This is also a control flow -statement, so you will find information in similar locations as for the do-while loop.)arrow_forwardthe java file is here. and the question is attached as a photo. i // **************************************************************** // ParseInts.java Authors: Lewis, Loftus & DuVall-Early // Date: 4/17/21 // // Reads a line of text and prints the integers in the line. // // **************************************************************** import java.util.Scanner; public class ParseInts { //--------------------------------------------- // main method //--------------------------------------------- public static void main(String[] args) { int val, sum=0; Scanner scan = new Scanner(System.in); System.out.println("Enter a line of text"); Scanner scanLine = new Scanner(scan.nextLine()); while (scanLine.hasNext()) { val = Integer.parseInt(scanLine.next()); sum += val; } System.out.println("The sum of the integers on this line is " + sum); scan.close(); scanLine.close(); } }arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

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