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
How do you tack pictures for this app
olga2289 [7]
There is a paper clip on the bottom left on your screen. When answering a question click it to apply a picture. Have a wonderful day.

(Take*)
3 0
3 years ago
If a website ends with .gov does it mean that its written by the government or?
Soloha48 [4]
Umm... No. (I'm pretty sure)
7 0
3 years ago
Read 2 more answers
Chill and text part 2<br><br> (TEST) How do i copy apex questions
tresset_1 [31]

Answer:

Oracle doc...

7.3.4 Copying a Database Application Page

You can copy a page from the current application or from another application. During the copy process, you can also copy shared components or change mappings to shared components in the target application.

To copy a page:

Navigate to the application you want to copy to:

Navigate to the Workspace home page.

Click the Application Builder icon.

Select an application.

Select a page.

The Page Definition appears.

In Tree view:

Under Page Rendering, select the page name.

Right-click and select copy.

In Component view:

Under Page, click the Copy icon.

For Copy Page Option, select one of the following:

Page in this application

Page in another application

Follow the on-screen instructions.

8 0
3 years ago
Read 2 more answers
Explica la importancia que tiene el plan de trabajo (cronograma) en los proyectos y porque se realiza antes de ejecutar la soluc
zysi [14]

Answer:

El plan de trabajo permite delimitar la necesidad a la cual se debe responder con una solución (<em>descripción del problema</em>), los hitos que se deben alcanzar (<em>objetivos general y específico</em>), los recursos requeridos para lograr desarrollar y aplicar la solución (<em>marco teórico</em>), los posibles beneficios derivados del proceso exitoso (<em>justificación del proyecto</em>) y una administración racional y realistas de los recursos a disposición en cuanto a disponibilidad, tiempo y personal mediante una secuenciación de tareas (i.e. <em>diagramas de Gantt</em>), todo reduce el componente iterativo inherente a diseño y producción de un producto, permite prever posibles imprevistos y mantener una perspectiva realista y una eficiencia aceptable en cuanto a presupuesto, metodologías y tecnologías a usar.

El plan de trabajo debe incluir principios de ingeniería concurrente para minimizar para manera mejor los posibles imprevistos, usualmente difíciles de manera con principios de ingeniería secuencial.

Explanation:

El plan de trabajo permite delimitar la necesidad a la cual se debe responder con una solución (<em>descripción del problema</em>), los hitos que se deben alcanzar (<em>objetivos general y específico</em>), los recursos requeridos para lograr desarrollar y aplicar la solución (<em>marco teórico</em>), los posibles beneficios derivados del proceso exitoso (<em>justificación</em>) y una administración racional y realistas de los recursos a disposición en cuanto a disponibilidad, tiempo y personal mediante una secuenciación de tareas (i.e. diagramas de Gantt), todo reduce el componente iterativo inherente a diseño y producción de un producto, permite prever posibles imprevistos y mantener una perspectiva realista y una eficiencia aceptable en cuanto a presupuesto, metodologías y tecnologías a usar.

El plan de trabajo debe incluir principios de ingeniería concurrente para minimizar para manera mejor los posibles imprevistos, usualmente difíciles de manera con principios de ingeniería secuencial.

5 0
3 years ago
Canada’s energy plan, named __________, makes three governmental agencies accountable for safeguarding Canada’s environment.
stepan [7]

Answer:

Canada launched the national Generation Energy Council of leading Canadians, who proposed principles to the Government of Canada on how to build our energy future. Today, these principles guide government decisions to support Canadian families, businesses, and communities. Together, we are: saving energy powering clean communities.

Explanation:

8 0
2 years ago
Other questions:
  • Maria is comparing her history project's second-place award to her classmate's first-place award. She starts planning how to win
    6·2 answers
  • A user can easily moved to the end of document by pressing what key combination?
    8·2 answers
  • What are some of the causes for error 1921 when updating?
    11·2 answers
  • Which one of the following is a correct declaration for a method named passAList that has as arguments an array list myList of s
    8·1 answer
  • The Technology Librarian asks you to find out how many hops it takes to get to the first Wi-Fi kiosk. What Windows command can y
    5·1 answer
  • Design and implement a class dayType that implements the day of the week in a program. The class dayType should store the day, s
    11·1 answer
  • Assume the availability of a function is_prime. Assume a variable n has been associated with positive integer. Write the stateme
    15·1 answer
  • A popular database software program called ____ offers a wizard and QBE tool to help build and generate SQL queries
    9·1 answer
  • (Comparable interface) Write Rectangle class that implements the Comparable interface. Override the equals method so that two Re
    12·1 answer
  • Electronic evidence on computer storage media that is not visible to the average user is called​ ________.
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!