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
The class ________ is the portion of a class that is visible to the application's programmer.
Lady_Fox [76]

The correct option to this question is class interface.

The class interface is the portion of a class that is visible to the application’s programmer. Class interfaces mean implementation of public methods of the class. These class interfaces of the class are easily visible to the application’s program either the one who is developing the application program or the one who is reading the application’s code.

Class interface can be seen by the other classes as its public face. Class interfaces separate the class’s implementation and its interaction with other classes. That way the implementation of the class can be modified easily without being known by other classes. Basically, the programmer who is developing the program, all the portions of the programm is visible to that programmer.

For example, the class is written below:

class class-name

{

private members;

public method()

{

//method defination

}

}

when the class object is created, the code of the object to the programmer is visible.

<u>While the other options are incorrect:</u>

  • Form: the form is used to collect information from the user. It can be build using front-end development tools
  • Design: Design is a term used in computer or software engineering to make something from scratch or beginning. It can be  methodologies, standards, or techniques etc.
  • Control: Control is the mechanism or a term used in software development to control the program or execution of the program.

You can learn more about class interface at

brainly.com/question/13089781

#SPJ4

The complete question is found while searching over internet:

"

<em>The class ________ is the portion of a class that is visible to the application's programmer.</em>

  • <em>Interface</em>
  • <em>Form</em>
  • <em>Design</em>
  • <em>Control </em>

"

7 0
1 year ago
The engine that runs the computer. Small computers have one, while larger computers may
Dmitrij [34]

Answer:

CPU.

Explanation:

A processor, also known as a Central Processing Unit, is a piece of hardware in a computer that performs basic operations and control when executing program code.

Processors are usually made as integrated circuits closed in a hermetic casing, often with gold-plated leads (used for resistance to oxidation) and in this form they are called microprocessors - in common speech the terms processor and microprocessor are used interchangeably. The heart of the processor is a single crystal of silicon, on which a series of semiconductor layers have been applied by means of photolithography, forming, depending on the application, a network of several thousand to several billion transistors. Its circuits are made of metals with good electrical conductivity, such as aluminum and copper.

7 0
2 years ago
What is the job title of someone who works with video and/or film?
boyakko [2]
Producer, videographer
4 0
3 years ago
webrooming is when consumers physically inspect a product in a store to get a look and feel for it—and then buy it from an onlin
azamat

The statement that webrooming is when consumers physically inspect a product in a store to get a look and feel for it—and then buy it from an online store because it is cheaper to do so is false.

<h3>What is webrooming?</h3>

It should be noted that webrooming simply means the consumer practice for researching products online before buying theme in stores.

In this case, the main idea of webrooming isn't to buy it at stores because it's cheaper. Therefore, it's false.

Learn more about webrooming on:

brainly.com/question/14988432

#SPJ12

3 0
2 years ago
Which of the following can you do under the fair use exceptions?
anzhelika [568]
What fair use exceptions are you talking about? There are thousands on fair use exceptions.
8 0
3 years ago
Other questions:
  • Write a program that accepts as input the mass, in grams, and density, in grams per cubic centimeters, and outputs the volume of
    14·1 answer
  • What is the most consistent item regardless of the software used in BI?
    5·1 answer
  • 3 Points
    9·2 answers
  • (I made this up teehee) what anime is katski bakugo from
    15·2 answers
  • g Define memory hierarchy. A. The rate at which information can be transferred from one place to another. B. Ordering storage sy
    8·1 answer
  • You want to substitute one word with another throughout your document. What tool(s) should you use?
    9·1 answer
  • Pleeeese help me for these questions
    8·1 answer
  • Which command do you use to save a document with a new name? Choose the answer.
    10·2 answers
  • Why do my airpods keep disconnecting from my laptop
    8·2 answers
  • CODEHS: WHY is it important to know the difference between div and span?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!