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
File Explorer contains ribbon tabs that can be used for various functions. Which ribbon tab provides options to open a new File
padilas [110]

Answer:

file

Explanation:

click on file

6 0
3 years ago
How to burn mp3 on dvd
ki77a [65]
Look up on google a software that can do it for you. Doing it through a pre-made software is about the only way to do it most computers won't allow you to.

7 0
3 years ago
Read 2 more answers
Help? Can you explain what this mean?
Pani-rosa [81]

Death by PowerPoint simply refers to a phenomenon that's caused as a result of the poor use of a presentation software.

It should be noted that the phrase was coined by Angela Garber. It simply means when an individual uses the presentation software poorly.

The main contributors to death by PowerPoint include confusing graphics, slides that had too much text, etc. It's important to present one's work logically with good information.

Learn more about PowerPoint on:

brainly.com/question/25795152

3 0
2 years ago
Jorge is looking for information about the life of his favorite music artist, Ray Charles. Which type of resource(s) would provi
Bumek [7]
He could read a biography.
4 0
3 years ago
Every chart has a corresponding ____ that contains the numerical data displayed by the chart.
katen-ka-za [31]

Answer:

B) Worksheet

Explanation:

In Microsoft Excel and all the other spreadsheet applications, a worksheet is  a file that contains cells, the cells are an intersections of rows and columns, and it provides the interface where the users can input and modify data, because of the row/column nature of worksheets, a table structure can easily be developed for the organization of data/information from where they can be plotted to a chart. Hence every chart has a corresponding worksheet containing its numerical data.

4 0
3 years ago
Other questions:
  • Select the correct answer.
    15·1 answer
  • The following 2D array has been created:
    12·2 answers
  • Which statement describes borders and shading ?
    13·1 answer
  • 1. If this traffic signal is turned on after the red light, it means you may cross the intersection, but you _______ wait until
    12·2 answers
  • Briefly describe the fundamental differences between project-based and product-based Software Engineering.
    10·1 answer
  • Hurry im TIMED
    8·1 answer
  • I will give brainliest!!!
    13·1 answer
  • You Could Never Size Me UP! Been Doing This Sh*t A Long ⏱time
    15·1 answer
  • Explain how communication facilitate cordination​
    14·1 answer
  • a user complains he cannot access a particular website, although he is able to access other websites. At which layer of the OSI
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!