1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
SashulF [63]
3 years ago
12

Code a complete Java program to load and process a 1-dimensional array.

Computers and Technology
1 answer:
zepelin [54]3 years ago
6 0

Answer:

Here you go.Consider giving brainliest if it helped.

Explanation:

import java.io.*;//include this header for the file operation

import java.util.*;//to perform java utilities

import javax.swing.JOptionPane;//needed fro dialog box

class Driver{

  public static void main(String args[]){

      int wages[]=new int[15];//array to hold the wages

      int index=0;

      try{

          //use try catch for the file operation

          File file=new File("wages.txt");

          Scanner sc=new Scanner(file);//pass the file object to the scanner to ready values

          while(sc.hasNext()){

              String data=sc.nextLine();//reads a wage as a string

              String w=data.substring(1);//remove the dollar from the string data

              wages[index++]=Integer.parseInt(w);//convert the wage to int and store it in the array

          }

          sc.close();//close the scanner

      }catch(FileNotFoundException e){

          System.out.println("Error Occurrred While Reading File");

      }

     

      //sort the array using in built sort function

      Arrays.sort(wages);

      //print the wages

      System.out.println("Wages of 15 person in ascending order:");

      for(int i=0;i<wages.length;i++){

          System.out.print("$"+wages[i]+" ");

      }

      //call the increases wages method

      wages=increaseWages(wages);//this method return the updated wages array

     

  }

 

  //since we can call only static methods from main hence increaseWages is also static

  public static int[] increaseWages(int wages[]){

      //increase the wages

      for(int i=0;i<wages.length;i++){

          wages[i]+=500;

      }

     

      //print the new wages

      int sum=0;

      System.out.println("\n\nNew wages of 15 person in ascending order:");

      for(int i=0;i<wages.length;i++){

          sum+=wages[i];//sums up the new wages

          System.out.print("$"+wages[i]+" ");

      }

     

      //display the summation of the new wages in a dialog box

      JOptionPane.showMessageDialog(null,"Total of new wages: "+sum);

      return wages;

  }

}

You might be interested in
What is block chain?
LuckyWell [14K]

Answer:

Block Chain is a system of recording information that makes it difficult or impossible to change, hack, or cheat the system.

A blockchain is essentially a digital ledger of transactions that is duplicated and distributed across the entire network of computer systems on the blockchain.

Hope this helps.

x

6 0
2 years ago
Read 2 more answers
A(n) _____ describes your core values and highest career goals. A. résumé B. objective statement C. qualifications profile D. pe
Juli2301 [7.4K]

Answer: D.) Personal Mission Statement

Explanation: The personal mission statement refers to a write up which is usually written by an individual and it's tailored to embody one's complete definition in terms of core values, skills, attributes and most importantly present and future desires, goals and objectives. The statement of purpose is usually detailed and will showcase where an individual is currently placed while also showcasing how he or she intends to achieve future aspiration.

8 0
3 years ago
Read 2 more answers
Which of the following BEST describes the relationship between the Boston Marathon bombing and biometrics?
ale4655 [162]

Answer:

Because of the newly developed biometric technology, the FBI was able to

quickly identify two suspects.

The blurry photos released by the FBI after the bombing prompted

researchers to improve their early biometric software.

Because biometric technology was unavailable at the time, the Boston

Marathon bomber remains at large.

The Boston Marathon bombing made researchers aware of how biometric

technology is sometimes useless and ineffective.

Explanation:

6 0
2 years ago
How can cars get faster
Varvara68 [4.7K]
Tape a spoiler to the trunk.
5 0
2 years ago
History of computer from difference engine <br>​
harkovskaia [24]

Answer:

Charles Babbage (1791-1871), computer pioneer, designed two classes of engine, Difference Engines, and Analytical Engines. Difference engines are so called because of the mathematical principle on which they are based, namely, the method of finite differences.

Explanation:

4 0
2 years ago
Read 2 more answers
Other questions:
  • Why are computer programs so much longer now than they were in the late 1980?
    8·1 answer
  • Give some examples of CyberCrime
    9·1 answer
  • The array index can be any nonnegative integer less than the array size.
    10·1 answer
  • A user of the wireless network is unable to gain access to the network. The symptoms are:1.) Unable to connect to both internal
    6·1 answer
  • Select two netiquette guidelines. In a paragraph of no less than 125 words, explain why these guidelines make professional onlin
    9·1 answer
  • Jerry has received an email on his company’s email system. The email is in regard to a new update the company plans to implement
    9·1 answer
  • What function returns a line and moves the file pointer to the next line?
    9·1 answer
  • Application software can run without the presence of system software true or false ​
    5·1 answer
  • You are splitting up all your apples equally between 3 people. which statement below will calculate how many apples will be left
    12·1 answer
  • The cameras picture review function allows you to look at the _ you've taken
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!