Code a complete Java program to load and process a 1-dimensional array.

Create clear comments as you code to tell me what you are doing.
Import the Java libraries that you will need.
Create a single dimensional array that will hold 15 wages.
In the main, load an array with all of the records from a .txt file named Salary txt. The file has 15 records in it.
Sort the array in ascending order.
Write a method named increaseWages(). This method will add $500 to each of the 15 wages. In other words, you are giving each person a raise of $500.
Pass the array to the method from the main().
Increase the wage amounts in the array (as described above), in the method. In other words, in the end the array should hold the NEW, higher wages.
Output each new wage (use the console for this)
Calculate a total of the new wages in the method
Output the total of the new wages in the method (use a dialog box for this)
Return the array with the new wages to the main().
There is NO user interaction in this program.

Answers

Answer 1

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;

  }

}


Related Questions

Your program will be used by many departments at the university. Your comments will be important to their IT people. What would be a useful comment?

This was a really hard part to write, but it finally works.

I’m not sure what this does, but I don’t have time to troubleshoot it.

This segment returns a value that is used by the segment marked B.

Answers

Answer:

This segment returns a value that is used by the segment marked B.

Explanation:

just took assigment

Answer:

C

Explanation:

In the code snippet below, pick which instructions will have pipeline bubbles between them due to hazards.

a. lw $t5, 0($t0)
b. lw $t4, 4($t0)
c. add $t3, $t5, $t4
d. sw $t3, 12($t0)
e. lw $t2, 8($t0)
f. add $t1, $t5, $t2
g. sw $t1, 16($t0)

Answers

Answer:

b. lw $t4, 4($t0)

c. add $t3, $t5, $t4

Explanation:

Pipeline hazard prevents other instruction from execution while one instruction is already in process. There is pipeline bubbles through which there is break in the structural hazard which preclude data. It helps to stop fetching any new instruction during clock cycle.

Write an algorithm (pseudo-code) that takes an unsorted list of n integers and outputs a sorted list of all duplicate integers. There must be no duplicates in the output list, also the output list should be a sorted list. The algorithm must run in O(n) time. Show your analysis of the running time. Note: Assume that inputs are integer values from 0 to 255. (Hint: use the concept that being used in the separate chaining)

Answers

Answer:

brainliest if it did help you

Explanation:

Given array : A[0...n-1]Now, create a count array Cnt[0...n-1]then, initialize Cnt to zero

for(i=0...n-1)

Cnt[i]=0 ---------O(n) time

Linearly traverse the list and increment the count of respected number in count array.

for(i=0...n-1)

Cnt[A[i]]++; ---------O(n) time

Check in the count array if duplicates exist.

for(i=0...n-1){

if(C[i]>1)

output (i); -----------O(n) time

}

analysis of the above algorithm:

Algorithm takes = O(1 + n + n + n)

                           = O(n)          

//java code

public class SortIntegers {

  public static void sort(int[] arr) {

    int min = arr[0];

    int max = arr[0];

    for (int i = 0; i < arr.length; ++i) {

      if (arr[i] > max) {

        max = arr[i];

      }

      if (arr[i] < min) {

        min = arr[i];

      }

    }

    int counts[] = new int[max - min + 1];

    for (int i = 0; i < arr.length; ++i) {

      counts[arr[i] - min]++;

    }

    for (int i = 0; i < counts.length; ++i) {

      if (counts[i] > 1) {

        System.out.print((i + min) + " ");

      }

    }

    

    System.out.println();

  }

  public static void main(String[] args) {

    sort(new int[] { 5, 4, 10, 2, 4, 10, 5, 3, 1 });

  }

}

The Basic premise of____is that objects can be tagged, tracked, and monitored through a local network, or across the Internet.
The basic premise of
a. artificial intelligence
b. intelligent workspaces
c. the Internet of Things
d. the digital divide

Answers

Answer:

C.

Explanation:

Internet of things

The Basic premise of the Internet of Things is that objects can be tagged, tracked, and monitored through a local network, or across the Internet option (c) is correct.

What is IoT?

The term "Internet of things" refers to actual physical items that have sensors, computing power, software, and other innovations and can link to those other systems and gadgets via the Internet or other communication networks and share files with them.

As we know,

Using a local network or the Internet, things may be identified, tracked, and monitored is the fundamental tenet of the Internet of Things.

Thus, the Basic premise of the Internet of Things is that objects can be tagged, tracked, and monitored through a local network, or across the Internet option (c) is correct.

Learn more about the IoT here:

https://brainly.com/question/25703804

#SPJ2

12. What separated Grand turismo from other racing games was its focus on ______.
a) Your audiences and females in particular
b) Fantasy graphics and visuals
c) Pure simulation and ultrarealistic features
d) All of the above

Answers

Answer:

c) Pure simulation and ultrarealistic features

Explanation:

The main difference between Grand Turismo and other racing games was its focus on Pure simulation and ultrarealistic features. The Grand Turismo series has always been a racing simulation, which was made in order to give players the most realistic racing experience possible. This included hyperrealistic graphics, force feedback, realistic car mechanics, realistic weather, and wheel traction among other features. All of this while other racing games were focusing on the thrill of street racing and modifying cars. Therefore, it managed to set itself apart.

Need help with 9.2 Lesson Practice edhesive asap please

Answers

Answer:

Can you add an attachment please

In this exercise we have to use the computer language knowledge in python, so the code is described as:

This code can be found in the attached image.

So the code can be described more simply below, as:

height = []

height.append([16,17,14])

height.append([17,18,17])

height.append([15,17,14])

print(height)

See more about python at brainly.com/question/26104476

Which tab can be used to change the theme and background style of a presentation?
O Design
O Home
O Insert
O View

Answers

Answer:

Design

Explanation:

seems the most correct one..

I would say design as well.

Write a script called fact.sh that is located in your workspace directory to calculate the factorial of a number n; where n is a non-negative integer between 1 and 20 that is passed as a parameter from the command line (e.g. ./fact.sh 5). The result should be echoed to the screen as a single integer (e.g. 120).
NOTE: Do not include any other output, just output the single integer result.
Submit your code to the auto-grader by pressing Check-It!
NOTE: You can submit as many times as you want up until the due date.

Answers

Answer:

hope this helps

Explanation:

Two character strings may have many common substrings. Substrings are required to be contiguous in the original string. For example, photograph and tomography have several common substrings of length one (i.e., single letters), and common substrings ph, to, and ograph as well as all the substrings of ograph. The maximum common substring length is 6. Let X = X122 . Im and Y = yıy2 - - • Yn be two character strings. Using dynamic programming, design an algorithm to find the maximum common substring length for X and Y using dynamic programming. Please follow the general steps for designing a dynamic programming solution as in Q1 (other than the actual programming part).

Answers

Answer:

Explanation:

The following function is written in Java. It takes two strings as parameters and calculates the longest substring between both of them and returns that substring length.

import java.util.*;

class Test

{

   public static void main(String[] args)

   {

       String X = "photograph";

       String Y = "tomography";

       System.out.println(X + '\n' + Y);

       System.out.println("Longest common substring length: " + longestSub(X, Y));

   }

   static int longestSub(String X, String Y)

   {

       char[] word1 = X.toCharArray();

       char[] word2 = Y.toCharArray();

       

       int length1 = X.length();

       int length2 = Y.length();

       int substringArray[][] = new int[length1 + 1][length2 + 1];

       int longestSubstringLength = 0;

       

       for (int i = 0; i <= length1; i++)

       {

           for (int j = 0; j <= length2; j++)

           {

               if (i == 0 || j == 0)

                   substringArray[i][j] = 0;

               else if (word1[i - 1] == word2[j - 1])

               {

                   substringArray[i][j]

                           = substringArray[i - 1][j - 1] + 1;

                   longestSubstringLength = Integer.max(longestSubstringLength,

                           substringArray[i][j]);

               }

               else

                   substringArray[i][j] = 0;

           }

       }

       return longestSubstringLength;

   }

}

16. The Nintendo Entertainment System (NES) saw its sales skyrocket as a result of the launch of which of the following games?
a) Pac-Man
b) Super Mario Bros
c) The Legend of Zelda
d) Popeye

Answers

Answer:

Super Mario bros

Explanation:

What does getfenv() do?

Answers

Answer: getfenv() is a type of function. Particually a envirotment function. for a lua coding.

Explanation: What this does it goes thourgh  line of code in a particular order.

This means. getfenv is used to get the current environment of a function. It returns a table of all the things that function has access to. You can also set the environment of a function to another environment.

Forgot to include examples of where this could be used. Although not very common uses, there are some. In the past Script Builders used getfenv to get the environment of a script, and setfenv to set the environment of a created script’s environment to a fake environment, so they couldn’t affect the real one. They could also inject custom global functions.

Not entirely sure if this uses getfenv or setfenv, but the use in Crazyman32’s AeroGameFramework is making the environment of each module have access to other modules without having to require them, and having access to remotes without having to directly reference them.

Answer: ummm, who knows

Explanation:

Explain the five generations of computer

Answers

Answer:

1 First Generation

The period of first generation: 1946-1959. Vacuum tube based.

2 Second Generation

The period of second generation: 1959-1965. Transistor based.

3 Third Generation

The period of third generation: 1965-1971. Integrated Circuit based.

4 Fourth Generation

The period of fourth generation: 1971-1980. VLSI microprocessor based.

5 Fifth Generation

The period of fifth generation: 1980-onwards. ULSI microprocessor based.

The phrase "generation" refers to a shift in the technology that a computer is/was using. The term "generation" was initially used to describe different hardware advancements. These days, a computer system's generation involves both hardware and software.

Who invented the 5th generation of computers?

The Japan Ministry of International Trade and Industry (MITI) launched the Fifth Generation Computer Systems (FGCS) initiative in 1982 with the goal of developing computers that use massively parallel computing and logic programming.

The generation of computers is determined by when significant technological advancements, such as the use of vacuum tubes, transistors, and microprocessors, take place inside the computer. There will be five computer generations between now and 2020, with the first one starting around 1940.

Earlier models of computers (1940-1956)Computers of the Second Generation (1956-1963)Computers of the Third Generation (1964-1971)Computers of the fourth generation (1971-Present)Computers of the fifth generation

Learn more about generations of computers here:

https://brainly.com/question/9354047

#SPJ2

What should be the first tag in any HTML document? A. <head> B. <title> C. <html> D. <!DOCTYPE >​

Answers

Answer:

C.

Explanation:

Suppose the program counter is currently equal to 1700 and instr represents the instruction memory. What will be the access of the next instruction if:

instr[PC] = add $t0, $t1, $t2

Answers

Answer:

C

Explanation:

omputer chip

sorry btw

When it comes to having certain sales skills as a hotel manager, being able to really hear, learn about, and show customers that the products/services you offer will meet their needs is a vital skill to have. When you show customers that you truly hear their needs, what sales skill are you practicing?
active listening
product knowledge
communication
confidence

Answers

Answer:

Communication

Explanation:

The ability to communicate clearly when working with customers is a key skill because miscommunications can result in disappointment and frustration. The best customer service professionals know how to keep their communications with customers simple and leave nothing to doubt.

Mohammed needs to ensure that users can execute a query against a table but provide different values to the query each time it is run. Which option will achieve this goal?

parameter queries
dynamic queries
query joins
static queries

Answers

Answer:

the answer is B

Explanation:

The variable strFirst's scope is _____.

Answers

pretty sure it’s d, hope this helps

Answer:

- the usernameMaker function

Explanation:

When you look at the code, you can see it's located alongside the usernameMaker. It it only utilized then, therefore being it's scope. For reassurance, it's also correct on Edge.

I hope this helped!

Good luck <3

Taran is concerned with the security of his macros in a database. Which security option could he use to provide protection?

digital signatures
hide database objects
start-up options
secure VBA code

Answers

Answer:security VBA code

Explanation:

Other Questions
A seamstress charges 25$ for an initial visit and then 18$ per hour of work. Emma paid 88.00$ to make a dress. How long did it take to seamstress Emma's dress Without using the formula, work out the gradient of the graph shown. Give your answer in its simplest form. which of these figures has rotational symmetry? De cada parbola (y-2)^2=8 (x-3) In a closed economy, saving and investment must be equal, but this is not the case in an open economy. In the following problem, you will explore how saving and investment are connected to the international flow of capital and goods in an economy. Before delving into the relationship between these various components of an economy, you will be asked to recall some relationships between aggregate variables that will be useful in your analysis. Recall the components that makeup GDP. National income (Y) equals total expenditure on the economy's output of goods and services. Thus, where C= consumption, I= investment, G =government purchases, X=exports, M =imports, and NX= net exports.Y= _____Also, national saving is the income of the nation that is left after paying for _____. Therefore, national saving (S) equals:S=_____Rearranging the previous equation and solving for Y yields, Y= _____ Plugging this into the original equation showing the various components of GDP results in the following relationship:S=_____ what's 19.72308 rounded to the nearest hundredth Distribute 6 ( 0.4x + 5) Which two come together to form an ionic bond?a. a positive cation and a ngetaive cationb. a positive cation and a negative anionc. a positive cation and a positive aniond. a positive anion and a negative anion need answer quick please How many grams equal 4.3 x 1024 atoms of oxygen (O2)? plsss answer this for meeeee 6th grade history I mark as brainliest Find the slope of the line passing through thepoints (-6, 1) and (4, -4)A.1/2B. 2C. - 1/2 D. -2 Graph the piecewise function given below. What fraction in the simplest from represented by each point When Okonkwo gets his gun to go hunting, one of his wives teases him aboutthe fact that he never shoots anything when he hunts. How does he respond?In things falls apart What is the factorization of the trinomial below?2x2 - 16x + 30A. 2(x-3)(x-5)B. 2(x-3)(x-10)C. 2x(x-3)(x-10)D. 2x(x-3)(x-5) (100 POINTS)Please help if you know anything about this topic. In YOUR opinion, is Nathaniel Hawthorne's description of Goodman Brown's dream believable? Give reasons to support your answer. why is the order you use to name polygons important when writing a congruency statement? What is thecurrent focus of conservationbiologists worldwide?