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
A menu that drops into the work area of the display screen is called a(n) _______ menu.
Klio2033 [76]
The answer is D) pull down menu

Also called a drop-down menu, this is a menu that remains invisible until you click or hover over it, pulling up the menu options. This is useful for reducing clutter in the work area of an application, such as Excel, while keeping the tools included in the menu readily available. 
5 0
2 years ago
Ming's computer crashed suddenly the other day. Ming kept trying the solution that worked last few times it had crashed, even th
Nesterboy [21]

Answer:

A mental set is the correct answer of this question.

Explanation:

Ming's computer crashed abruptly the next day. Ming has continued to try the workaround the last couple of times it's crashed, though it's clear that it's not going to fix his computer now. The inability of Ming to overcome this issue is most likely due to a collection of mentalities.Because of his mental set he fails to solve the problem.

It means it is directly related to the mind set of the computer system the main objective of mental set in computer to solve the problem is mental set in computer is not crashed then computer system is not working.

3 0
3 years ago
I have a real struggle when it comes to working with strings, whether they're arrays or pointers to strings, and I'm lost cause
neonofarm [45]
In C, you deal with a string always via a pointer. The pointer by itself will not allocate memory for you, so you'll have to take care of that.

When you write char* s = "Hello world"; s will point to a "Hello world" buffer compiled into your code, called a string literal.

If you want to make a copy of that string, you'll have to provide a buffer, either through a char array or a malloc'ed bit of memory:

char myCopy[100];
strcpy(myCopy, s);

or 

char *myCopy;
myCopy = (char*)malloc( strlen(s) + 1 );
strcpy(myCopy, s);

The malloc'ed memory will have to be returned to the runtime at some point, otherwise you have a memory leak. The char array will live on the stack, and will be automatically discarded.

Not sure what else to write here to help you...
6 0
3 years ago
What is one way that Accenture helps clients ensure fairness when applying AI solutions?
telo118 [61]

Answer: Accenture is developing a tool to help businesses detect gender, racial and ethnic bias in artificial intelligence software. 5 It lets users define the data fields they consider sensitive—such as race, gender or age—and then see the extent to which these factors are correlated with other data fields.

Explanation:

5 0
2 years ago
FTP services were recently added to a client's SOHO network in order for the marketing team to copy large files to a storage ser
svetlana [45]

Answer:

Option(d) is the correct answer to the given question .

Explanation:

The UPnP is known as  universal plug and play is a collection of computing protocols that's main objective to allow the virtual networks like desktop computers , wireless traffic, Wi-Fi access stations and smart applications to seamlessly explore one another's existence on the system and to built time series sharing internet services.

  • When we enabling the UPnP  it will improve the efficiency of the video streaming service while retaining marketing capability to copy big files to the cloud storage .
  • All the other options are not suitable for improve the efficiency of the video streaming service that's why they are incorrect options .

So Enable UPnP is the right answer

6 0
3 years ago
Other questions:
  • My computer keeps shutting down I've tried to completely wipe the memory but it didn't work do you have any ideas how to fix it
    7·1 answer
  • if you want to present slides to fellow students and co-workers which productivity software should you use to create them?
    13·1 answer
  • During the troubleshooting of a pc that will not boot, it is suspected that the problem is with the ram modules. the ram modules
    14·1 answer
  • Write an original idiom that uses the word dog or dogs im in 4th
    5·2 answers
  • The main devices in a rectifier are:
    14·2 answers
  • Lukas entered the date 9-17-2013 in an Excel workbook. He wants the date to appears as “Tuesday, September 17, 2013.” Instead of
    12·1 answer
  • This Command to insert copied text anywhere in your document
    13·2 answers
  • Write a program that inputs numbers and keeps a
    8·1 answer
  • What is output?
    10·1 answer
  • John wants to know the amount of ram memory installed on his computer. in which category of the windows 7 control panel can this
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!