1. Atestharnessprogramfortestingsortingmethodsisprovidedwiththeprogram iles.ItisintheileSorts.javainthech11.sortspackage.Theprogramincludes aswapmethodthatisusedbyallofthesortingmethodstoswaparrayelements. a. Describeanapproachtomodifyingtheprogramsothataftercallingasorting methodtheprogramprintsoutthenumberofswapsneededbythesorting method. b. Implementyourapproach. c. TestyournewprogrambyrunningtheselectionSortmethod.Yourprogram shouldreport49swaps.

Answers

Answer 1

Answer:

Following are the code to this question:

//import package

import java.util.*;

import java.text.*;

public class Main//defining a class

{

static final int t = 50;//defining an integer constant variable

static int[] ele = new int[t];//defining an array

static int tS = 0;//defining integer variable

static void initelements()//defining a static method

{

Random r= new Random();//creating Random class Object

for (int i = 0; i < t; i++)//use loop to add value in array

ele[i] = Math.abs(r.nextInt()) % 100;//add value in array

}

static public boolean isSorted()//defining a method isSorted

{

boolean x = true;//defining boolean variable

for (int i = 0; i < (t - 1); i++)//use for loop to count array values

if (ele[i] > ele[i + 1])//use if to compare array values

x = false;//use boolean variable to hold false value

return x;//return boolean value

}

static public void swap(int x1, int x2)//defining swap method

{

tS++;//increment variable value by 1

//performing swapping

int te = ele[x1];//defining te variable that holds array values

ele[x1] = ele[x2];//exchanging array values

ele[x2] = te;//holding te values

}

static public void disp()//defining a method disp

{

int v1;

DecimalFormat f = new DecimalFormat("00");//creating DecimalFormat class Object

System.out.println("The elements array is:");//print message

for (int i = 0; i <t; i++)//defining for loop  

{

v1 = ele[i];//holding array value in v1 variable

if (((i + 1) % 10) == 0)//use if to check i value

System.out.println(f.format(v1));//print value

else//else block

System.out.print(f.format(v1) + " ");//print value

}

System.out.println();//print space

}

static int getMinimum(int st, int en)//defining a method getMinimum

{

int iMi = st;//defining variable that holds parameter value

for (int i = st + 1; i <= en; i++)//use for loop compare array value

if (ele[i] < ele[iMi])//compare array value

iMi = i;//use iMi to hold loop value

return iMi;//return iMi value

}

static void selectionSort()//defining a selectionSort method

{

int e = t - 1;//defining e variable that holds total array count value

for (int i = 0; i < e; i++)//use for loop to call swap method  

swap(i, getMinimum(i, e));//calling the swap method

}

public static void main(String[] args)//defining main method  

{

initelements();//calling initelements method

disp();//calling disp method

System.out.println("elements is sorted: " + isSorted());//calling is isSorted method with the message

System.out.println();//for space

selectionSort();//calling selectionSort method

System.out.println("No of swaps :" + tS);//print totalswap value with the message

disp();//calling disp method

System.out.println("elements is sorted: " + isSorted());//calling is isSorted method with the message

System.out.println();//for space

}

}

Output:

Please find the attached file.

Explanation:

In this code inside the Main class, 5 static methods "initelements, isSorted, swap, disp, getMinimum and selectionSort" is declared, in which the first method holds random values in arrays, in second array it sorts its values, in the third method it swap the array, in the disp method it shows array values.

In the "getMinimum and selectionSort"  it sorts array values and inside the main method, it calls all methods and prints their values.

1. Atestharnessprogramfortestingsortingmethodsisprovidedwiththeprogram Iles.ItisintheileSorts.javainthech11.sortspackage.Theprogramincludes

Related Questions

did someone hang themself on the set of wizard of oz

Answers

No - it was a rumour that started when the film was having its 50th anniversary in 1989

excuse me i am going into my A levels and i need help in picking what further pure mathematic units i need to pick since i am studying ICT.

Answers

Answer:

i dont know bout math units but subjects for ict include

microcomputer technology, and systems resource management ,computer systems organization.

Explanation:

Question # 10
Multiple Choice
Why would a beginning photographer have had a more difficult time learning the art in the early 1900s than now?

Answers

Answer:

cameras were fully Manuel

Explain the operation of an electric circuit in terms of voltage, current, and charge.

Answers

If its open its broken if its closed electricity flows

Answer:

If its open its broken if its closed electricity flows

Explanation:

what is the term for software that is exclusively controlled by a company, and cannot be used or modified without permission?

Answers

Answer:

Proprietary Software

Explanation:

most file managers include a way to create a folder through the save dialog box. true or false?

Answers

Answer:

false because most of the file managers just keep Everything organized by dates, years, and everything like that

Explanation:

how to generate random numbers in excel without duplicates

Answers

Answer:

Generate Random Number List With No Duplicates in Excel:

1. Select cell B3 and click on it.

2. Insert the formula: =RANDBETWEEN(10,30)

3. Press enter.

4. Drag the formula down to the other cells in the column by clicking and dragging the little “+” icon at the bottom-right of the cell.

Explanation:

Hope it helps you..

Your welcome in advance..

(ㆁωㆁ)

what is the name of the method of problem solving that breaks a problem imto smaller problems​

Answers

Answer:

The first thing that came to mind was when my parents tell me "Take it one step at a time" I hope this helps

Explanation:

why is a fragmented disk slower than one that is defragmented?

Answers

Answer:

Explanation:

The fragmented program has parts stored all over the hard driven. The computer has to keep on checking for where the next fragment is. All if this takes time especially if the program that you are trying to load is very large.

If the sectors for a program are consecutive, that makes loading a whole lot easier.

Access your Practice Lab titles Access your exercise content Reports and files Access your settings Access help and support CompTIA Linux Customize or Write Simple Scripts Review Review Well done, you have completed the Customize or Write Simple Scripts Practice Lab. Lab Assessment Test your knowledge on the topics covered in this lab by completing the review questions below. 1 Question What is the extension of a shell script

Answers

Answer:

The extension for a shell script in windows ends with a .ps1 and for the extension for linux it is .sh, not quite sure for OSX.

Does anyone know how to write this right? This is for a coding class and I’m super confused on it.

First activity:

1. Declare three variables: firstSnack,
second Snack, and thirdSnack.
Assign the name of a snack (as a string)
to each variable.

2. Declare another variable and call it
bestSnack.
Assign a value to bestSnack USING THE
NAME OF ONE OF THE ABOVE VARIABLES.
Do not use a string directly.

3. Now, change your mind! Reassign the value
of bestSnack, again using the variable name,
not the string. (THIS SHOULD BE DONE ON
A NEW LINE)

Second activity:

4. Declare three variables and give them the names of three common grocery items. Assign to each variable a NUMBER value approximately its price. Don’t use $ sign, just the actual number.

5. Declare another variable, name it total, and assign to it the SUM of the three other variables, contain. Hint - you’ll need to use an arithmetic operator to do this.

Answers

Answer:

This is using c++ syntax, you might need to make slight adjustment for other languages.

First activity:

string firstSnack = "chips";

string secondSnack = "pizza";

string thirdSnack = "apples";

string bestSnack =  firstSnack;

bestSnack = secondSnack;

Second activity:

double apple = 0.5;

double banana = 0.75;

double orange = 1.43;

double total = apple + banana + orange;

Explanation:

When first declaring a variable, you want to specify the type (such as int, double, string, bool, etc.) and then the name. You can set the variable value in the declaration, or you can set it to a value later in the program by not having the equals sign and whatever comes next.

What types of games became popular in the 90s? List three games and how they had evolved from their successful 80s video game rivals.

Answers

Answer:

Doom (1993) Half Life (1998) Super Mario 64 (1997)

Explanation:

Doom and Half-Life were PC games.

Doom was an early 90s PC shooter that was "3d" it wasn't actually 3d but it used a unique rendering system to make it look 3d. It was a level to level shooter that also included secrets

Half-Life was a Actual 3D game and required quite a beefy Graphics card in your computer at the time to run it smoothly, It was a long story-driven game

Super Mario 64 was one of the first "True 3D" games on Home console because it was a launch title for the brand new N64 It utilized the hardware for a brand new experience for console players.

Most 80s games were even more primitive and were either Hosted in arcade cabinets at your local Arcade Such as Outrun (1986) (Btw great soundtrack!) or the NES that allowed you to play the Original few Mario games that were all 2D.

So one of the biggest Evolutions in 80s to 90s gaming is the introduction of 3D titles being able to run on good computers in the early 90s and home consoles could also run 3D titles at the end of the 90s

Pls, mark Brainliest I put my heart and soul into this. Very fun Question!!!

what is the difference between internal and external css?

Answers

Answer:

Internal CSS are the ones that we can write within the same file i.e the HTML code and CSS code are placed in the same file.

External CSS is that we can write in a separate file than the HTML code i.e the HTML file is separate like(index.html) the CSS file is separate like(style.css).

Explanation:

a _____ is a telecommunications network that connects users and their computers in a geographical area that spans a campus or a city.

Answers

Answer:

(WAN) a wide area network

what is output if the user types 13 click all that apply ABCD

Answers

Answer:

AD?

Explanation:

Answer:

A C D

Explanation:

youre welcome :)

an error occurred while loading a higher quality version of this video

Answers

Answer:?

Explanation:?

it refers to the kind of activity that you are going to perform or methods of training to used

A.type
B.frequency
C.intensity
D.time

Answers

I believe the correct answer is “type”

Which decimal number is equivalent to this hexadecimal number?
F8

A.
24
B.
143
C.
248
D.
264

Answers

Answer:

So, the number 248 is the decimal equivalent of hexadecimal number F8 (Answer).

(F8)16 = (248)10

Step by step solution

Step 1: Write down the hexadecimal number:

(F8)16

Show each digit place as an increasing power of 16:

Fx161 + 8x160

Convert each hexadecimal digits values to decimal values then perform the math:

15x16 + 8x1 = (248)10

So, the number 248 is the decimal equivalent of hexadecimal number F8 (Answer).

3.5.7: Rectangle, Part 2 its python coding

Answers

The program which calculates the area of a rectangle written in python 3 is given thus :

def calc_area_rectangle(length, width):

#initialize a function named calc_area_rectangle which takes in two arguments

area= length * width

#the products of the arguments which are the length and width of value of the rectangle is assigned to the variable named area

return round(area, 2)

#the function returns the value of area rounded to 2 decimal places.

print(calc_area_rectangle(10, 20))

#sample run of the program

Learn more :https://brainly.com/question/25162828

Help Digital photo class

Answers

Answer: i think the answer is c

Explanation:

Answer:

Here’s your answer!

Explanation:

I believe the answer to be D however if the camera still doesn’t work visit a camera shop for help.

Hope this helped

Brainliest please?

Dont forget to smash that heart at the bottom <3

Have a great day,you’re amazing!

At the top right of the first two pages
only (title page and abstract), insert
page numbers into the header using
lowercase Roman numerals (i, ii).
At the top right of the remaining
pages, insert default page numbering
(1, 2, 3) into the header, beginning
with the number 1 on page 3.

Answers

You don't have the pages. Try re-uploading the question with them.

You have just received a new laptop that you will use on your company network and at home. The company network uses dynamic addressing, and your home network uses static addressing. When you connect the laptop to the company network, everything works fine. When you take your laptop home, you cannot connect to devices on your home network or to the internet.

Required:
What could have been the reason for that?

Answers

Answer:

The network address can be the reason. You need to modify it so you can have access.

what are the differences between a keyboard and a pointing stick.​

Answers

Answer:

keyboard:

A keyboard is for putting information including letters, words and numbers into your computer. You press the individual buttons on the keyboard when you type. The number keys across the top of the keyboard are also found on the right of the keyboard. The letter keys are in the centre of the keyboard.

pointing stick:

A pointing stick is a small joystick used as a pointing device typically mounted centrally in a computer keyboard. Like other pointing devices such as mice, touchpads or trackballs, operating system software translates manipulation of the device into movements of the pointer or cursor on the monitor.

A laptop can be kept on palm to work. [true/false) ​

Answers

Answer:

Explanation:

false

which nims component includes the incident command system

Answers

Answer:

The NIMS Command and Management component

Explanation:

jessica has pinned her favorite applications as icons on her desktop .she always clicks on these icons to work them .which user interface is she using here?

Answers

Answer:

Graphical User Interface

Explanation:

please help

suppose you work for a large company create a short memo letting your coworker know that July 3 is also a paid holiday​

Answers

From: Tom Pearson, Manager, District Five

Regarding: New Incoming Manager, Geraldine Hines

Dear Comstock Staff: Beginning March 15, 2018, you will have a new District Five Regional Manager. After 35 years of continuous service, I am leaving all of you to pursue an exciting future.

It has been my pleasure to train my successor, Geraldine Hines, this past year. Geraldine has demonstrated that she shares the company vision to be the employer of choice here in the Valley of the Sun. I am confident that she will lead all of you into the stratosphere as we merge our call centers and expand our donor site availability.

Please give Geraldine the same level of excellence you have given to me, to our staff and to our donors.

Sincerely.

Tom Pearson, Outgoing Manager, District Five

the most important keyboard instrument of the romantic period was the

Answers

Answer:

piano

Explanation:

What appealed to people and especially kids of the 70s and 80s about gaming?
What parts of early gameplay, and which aspects of the games are still relevant today?
What are the major aspects in which gaming has improved since then?

Answers

question 1- it appealed as the ultimate playthings and competed to master them and set the high score, or the record for longest time playing.

question 2- Gameplay is arguably the most important aspect of a game. You can have breathtaking graphics and an enthralling storyline, but if the main game mechanics the player will be performing aren't fun, your project may as well have been a movie.

question 3- Gaming is really a workout for your mind disguised as fun. Studies have shown that playing video games regularly may increase gray matter in the brain and boost brain connectivity. (Gray matter is associated with muscle control, memories, perception, and spatial navigation.)

hope this helps :)

what does it mean when the save button on the quick access toolbar changes to a circular set of two arrows?

Answers

When the save button on the quick access toolbar changes to a circular set of two arrows, it means that workbook is saved in the cloud  (It means word is automatically syncing your changes back to OneDrive).

The Quick Access Toolbar (QAT) is simply known as small modifiable toolbar. It is often located at the top of the office application window that is, it can be seen next to the Microsoft Office button. It is known to have its own  set of independent commands and render quick access to commands like Save, Undo, Redo, etc. OneDrive is a renown Microsoft cloud service and a type of cloud services that helps individuals to link up oneself to all our files. It allows storage and protection of  files, sharing and get to them any time.

Conclusively, we can say that When the save button on the quick access toolbar changes to a circular set of two arrows, it means that workbook is saved in the cloud  (It means word is automatically syncing your changes back to OneDrive).

Learn more from:

https://brainly.com/question/17163678

Other Questions
SHOVELLING THE DRIVEWAY | DAY 23.Write a context and a related multiplication sentence that could be representedby this model. What do you think a trustbuster is what if the gold rush in California was kept secret elige el pretrito o el imperfecto para completar la historia. To isolate the variable in 1/4x multiply by _ or divide by _ May I please receive help? NEED HELP ASAP.................... Which are the coordinates of Jefferson High School's Parking Lot B?(-4, 3)(-4,-3)(-3,-4)(-3, 4) In the text, Beveridge states that future wars will be fought over-colonies-trade-The Panama CanalThe Text;The Philippines are ours forever, territory belonging to the United States And just beyond the Philippines are Chinas illimitable markets. We will not retreat from either We will not abandon our opportunity in the Orient The Philippines give us a base at the door of all the East [T]he Pacific is the ocean of the commerce of the future. Most future wars will be conflicts for commerce. The power that rules the Pacific, therefore, is the power that rules the world.-Senator Albert J. Beveridge, 1900 Which is true of credit unions?O They cannot pay interest on deposits.O They operate as non-profit organizations.O They do not provide traditional savings accounts.O They provide more services than large commercial ban This family faces a major dilemma. What do you think they should do? r 44 44444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444 Why is history in 11th grade different from middle school PLEASE HELP!!!! Question: What are the coordinates of E after a rotation 90 degree counterclockwise? Give your answer in the format (#,#) . What traditional idea did Enlightenment thinkers challenge to improve the lives and freedoms of ordinary people? government. medicine. religion. science. A sprinter travels a distance of 100 m in a time of 8.96 seconds.What is the sprinter's average speed rounded to 4 sf I need help on both of them pls help me... how does fast cars work? how do the make cars? How to find the frequency for temperature in Fahrenheit Multiples of 18 less than or equal to 216