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
Database management systems _____. a. include transaction-processing reports for database analysis b. are used to create, organi
GaryK [48]

Answer:B. Are used to create, organize, and manage databases

Explanation: Database management system (DBMS) is a computer software which is used to collect, analyse or evaluate and retrieve data from a database. It is essential to the flow of businesses or other activities of an organisation.

Examples of database management system softwares MICROSOFT ACCESS,FOXPRO,ORACLE etc all this are effective as it helps to manipulate the data structure,field names,the file formats etc.

3 0
4 years ago
11111 Power 2 sovle ​
erastovalidia [21]
123,454,321. you just multiply 11111 by itself
4 0
3 years ago
What pointer appears when pointing to a hyperlink
Leokris [45]
Your answer would be: a hand pointer.
6 0
3 years ago
Read 2 more answers
How does one select an entrepreneurial activity?
dem82 [27]
<span>Entrepreneurial activity is a human action with the goal of the generation of value, through the creation or expansion of economic activity. Several things must be taken into consideration before starting an </span><span>entrepreneurial activity but the most important is :
- the benefits it will give (financial but also personal , will you be satisfied doing that activity and will the activity bring financial benefits to you?
If yes, then you can do this activity.
</span>
6 0
4 years ago
What is one way a senior employee can mentor a new employee? Give orders about what to do and what not to do Gossip about which
den301095 [7]

A good way for a senior employee to mentor a new employee is to share company knowledge and job expertise.

7 0
3 years ago
Other questions:
  • How many times is "Alert" displayed in the following loop? for (int k =0; k&lt;= 100; k++) cout &lt;&lt; "Alert"; O 101 0 1 oo О
    7·1 answer
  • Suppose in a class of 100 students, there is a homework due every week. The professor wants to encourage students to hand in the
    8·1 answer
  • 7. Glaciers have two types of deposition. Define them below:
    6·1 answer
  • What kinds of online behaviors could be considered cyberbullying?
    7·2 answers
  • Which of the following is an Example of a technical (“hard”) skill
    6·2 answers
  • Which tab allows you to modify the width of a page margins in Microsoft word?
    7·2 answers
  • If after a run of arc consistency during the backtracking search we end up with the filtered domains of *all* of the not yet ass
    12·1 answer
  • The Electronic Communications Privacy Act requires an investigator to have a wiretap order to acquire ___________ information fr
    8·1 answer
  • When I press F3, F4, and any of my apps on my mac why wouldn't it do anything? Do you have a way to solve this problem? When I p
    10·2 answers
  • Web résumés allow you to include extra graphics and images that you would not include in a traditional résumé. please select the
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!