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
Libreoffice is an example of which type of software?.
max2010maxim [7]

LibreOffice is an Open Source Software.

<h3>Open Source Software (OSS)</h3>

A software is classified as <u>Open Source</u> when your code can be use, modified and distribute with its original rights.

<h3>LibreOffice</h3>

For answering this question, you should know a software LibreOffice.

LibreOffice is a software that allows to create: sheets, documents, drawing, charting, database, presentations, etc. It's free and an open source software - main advantages when compared to other software available.

In the other words, LibreOffice is free because the user does not need to pay any license. Also, it is an open source software because your code can manipulate for any developer.

Read more about Open Source Software here:

brainly.com/question/4593389

3 0
3 years ago
While conducting a vulnerability assessment, you're given a set of documents representing the network's intended security config
Sophie [7]

Answer:

The baseline review

Explanation:

Solution:

The baseline review: this can be defined as the gap analysis or the beginning environmental review (IER). it is an assess study to get information about an organisation's present activities and associated environmental impacts,  impacts and legal requirements.

This review issues an overview of the quality and weaknesses of an organisation’s environmental execution and opportunities for improvement.

6 0
3 years ago
Logical are functions used when looking for an entry or value in the spreadsheet. what is it?
Mila [183]

Explanation:

Logical functions provide decision-making tools for information in a spreadsheet. They allow you to look at the contents of a cell, or to perform a calculation, and then test that result against a required figure or value.

5 0
3 years ago
Find the double word-length 2's complement representation of each of the following decimal numbers:a. 3874
miss Akunina [59]

Answer:

-3874₁₀ = 1111 1111 1111 1111 1111 1111 1101 1110₂

Explanation:

2's complement is a way for us to represent negative numbers in binary.

To get 2's complement:

1. Invert all the bits

2. Add 1 to the inverted bits

Summary: 2's complement = -N = ~N + 1

1. Inverting the number

3874₁₀ = 1111 0010 0010₂

~3874₁₀ = 0000 1101 1101₂

2. Add 1 to your inverted bits

~3874₁₀ + 1 = 0000 1101 1101₂ + 1

= 0000 1101 1110₂

You can pad the most signigicant bits with 1's if you're planning on using more bits.

so,

12 bits                          16 bits

0000 1101 1110₂  = 1111 0000 1101 1110₂

They asked for double word-length (a fancy term for 32-bits), so pad the left-most side with 1s' until you get a total of 32 bits.

           32 bits

= 1111 1111 1111 1111 1111 1111 1101 1110

7 0
3 years ago
Your motherboard supports dual channeling and you currently have two slots populated with DIMMs; each module holds 2 GB. You wan
Olenka [21]
One 4-GB DIMM. Dont really have a explanation for it just comes from previous experience
6 0
4 years ago
Read 2 more answers
Other questions:
  • âwhat two log files are used by older versions of unix and newer version of linux to store log information
    10·2 answers
  • "the most common way to access the internet is through ________."
    5·1 answer
  • You want to multiply 50 in cell D3 by 8.90 in cell E3. Which formula should you use?
    11·1 answer
  • When protecting a worksheet all cells are locked by default.?
    10·1 answer
  • Andrew works for a company that develops for a company that develops optic-fiber cables for transmission of data. which layer of
    14·1 answer
  • What is Moodle in information communication and Technology?​
    5·1 answer
  • To cope with the uncertainty about how their pages will be viewed, many web page designers opt to use _________ units, which are
    13·1 answer
  • Ict quiz I attached a picture
    11·2 answers
  • 10. Site-to-Site VPN architecture is also known as
    6·1 answer
  • True or false: If you have a 32-bit CPU architecture, it's recommended to use a 64-bit operating system.
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!