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
podryga [215]
3 years ago
10

//Add you starting comment block public class BubbleBubbleStarter //Replace the word Starter with your initials { public static

void main (String[] args) { //Task 1: create an input double array list named mylist with some values pSystem.out.println("My list before sorting is: "); //Task 2: print the original list //Use println() to start and then replace with your printList() method after Task 4a is completed. p//Task 3: call the bubblesort method for mylist p//Task 4b: print the sorted list p} //Task 4a: create a method header named printlist to accept a formal parameter of a double array //create a method body to step through each array element println each element p//printList method header p//for loop p//println statement static void bubbleSort(double[] list) { boolean changed = true; do { changed = false; for (int j = 0; j < list.length - 1; j++) if (list[j] > list[j+1]) { //swap list[j] with list[j+1] double temp = list[j]; list[j] = list[j + 1]; list[j + 1] = temp; changed = true; } } while (changed); } }
Computers and Technology
1 answer:
spin [16.1K]3 years ago
8 0

Answer:

See explaination

Explanation:

import java.util.Scanner;

public class BubbleBubbleStarter {

public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

double arr[] = new double[10];

System.out.println("Enter 10 GPA values: ");

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

arr[i] = sc.nextDouble();

sc.close();

System.out.println("My list before sorting is: ");

printlist(arr);

bubbleSort(arr);

System.out.println("My list after sorting is: ");

printlist(arr);

}

static void bubbleSort(double[] list) {

boolean changed = true;

do {

changed = false;

for (int j = 0; j < list.length - 1; j++) {

if (list[j] > list[j + 1]) {

double temp = list[j];

list[j] = list[j + 1];

list[j + 1] = temp;

changed = true;

}

}

} while (changed);

}

static void printlist(double list[]) {

for (int j = 0; j < list.length; j++) {

System.out.println(list[j]);

}

}

}

You might be interested in
Consider the following class:
Pachacha [2.7K]

Answer:

c.return Integer.compare(value, otherTemp.value)

Explanation:

The compare() method as the name implies compares two integer values. If they are equal it returns 0, if the first number is smaller it returns -1, and if the first number is greater it returns 1.

It is an Integer class method that is why you need to type Integer.compare() to call the function.

For this example, the parameters that will be compared are <em>value</em>, and <em>otherTemp.value. </em>The type of compareTo method is an integer, we need to return the result.

3 0
3 years ago
The clock interrupt handler on a certain computer requires 2ms (including process switching overhead) per clock tick. The clock
salantis [7]

Considering the situation described above, the fraction of the CPU execution that is devoted to handling clock interrupts "<u>12 percent</u>."

<h3>CPU Execution process.</h3>

The process of CPU Execution involves the execution of an instruction which in life fetches an instruction from memory through its ALU to carry out an operation and then saves the result to memory.

To illustrate the fraction of the CPU execution that is devoted to handling clock interrupts, we have:

60 × 2 msec = 120 msec ÷ 1 sec = 12 percent.

Hence, in this case, it is concluded that the correct answer is <u>12 percent CPU</u> devoted to the clock.

Learn more about the CPU execution here: brainly.com/question/14400616

4 0
3 years ago
Plato I need answers asap will
Alja [10]

Answer:

Thanks for the points  

Explanation:

3 0
3 years ago
Some programming languages permit arbitrary flow of control from any place in a program to any other place in the program. Not J
liraira [26]
Besides portability, another of Java's key advantages is its set of security features which protect a PC running a Java program not only from problems caused by erroneous code but also from malicious programs (such as viruses). You can safely run a Java applet downloaded from the Internet, because Java's security features prevent these types of applets from accessing a PC's hard drive or network connections. An applet is typically a small Java program that is embedded within an HTML page.
4 0
3 years ago
School officials want to show the percentage of students who buy lunch from the school cafeteria compared to the percentage of t
Minchanka [31]

I would say it would be (A pie chart)

6 0
3 years ago
Other questions:
  • By apply styles, _____________ formats are being applied each time.
    6·1 answer
  • To close a tab, click the ____ button in the web page thumbnail on the tab switcher.
    9·1 answer
  • Write qbasic code for given pattern<br><br>NEPAL<br>. EPA<br>. P​
    12·1 answer
  • A strategy to solve a logic problem is to break it into steps. Using the drop-down menu, complete these sentences about solving
    15·2 answers
  • HELPPPP!!
    8·2 answers
  • What service in Windows Server 2016 authenticates remote users and computers to the Windows domain and its corporate network res
    9·1 answer
  • Which function in spreadsheet software can be used to predict future sales or inventory needs?
    5·2 answers
  • From few sometime I am unable to answer any question. Whenever I am clicking on Answer button it is taking me to logging page. B
    15·1 answer
  • Canada’s energy plan, named __________, makes three governmental agencies accountable for safeguarding Canada’s environment.
    5·1 answer
  • i installed windows 11 all looks ok except my ebay and some other sites are all white with black text no highlights or color???
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!