For this exercise, you are going to complete the printScope() method in the Scope class. Then you will create a Scope object in the ScopeTester and call the printScope.
The method will print the name of each variable in the Scope class, as well as its corresponding value. There are 5 total variables in the Scope class, some of which can be accessed directly as instance variable, others of which need to be accessed via their getter methods.
For any variable that can be accessed directly, use the variable name. Otherwise, use the getter method.
Sample Output:
The output of the printScope method should look like this:
a = 5
b = 10
c = 15
d = 20
e = 25
public class ScopeTester
{
public static void main(String[] args)
{
// Start here!
}
}
public class Scope
{
private int a;
private int b;
private int c;
public Scope(){
a = 5;
b = 10;
c = 15;
}
public void printScope(){
//Start here
}
public int getA() {
return a;
}
public int getB() {
return b;
}
public int getC() {
return c;
}
public int getD(){
int d = a + c;
return d;
}
public int getE() {
int e = b + c;
return e;
}
}

Answers

Answer 1

Answer:

Explanation:

The following is the entire running Java code for the requested program with the requested changes. This code runs perfectly without errors and outputs the exact Sample Output that is in the question...

public class ScopeTester

{

public static void main(String[] args)

{

       Scope scope = new Scope();

       scope.printScope();

}

}

public class Scope

{

private int a;

private int b;

private int c;

public Scope(){

a = 5;

b = 10;

c = 15;

}

public void printScope(){

       System.out.println("a = " + a);

       System.out.println("b = " + b);

       System.out.println("c = " + c);

       System.out.println("d = " + getD());

       System.out.println("e = " + getE());

}

public int getA() {

return a;

}

public int getB() {

return b;

}

public int getC() {

return c;

}

public int getD(){

int d = a + c;

return d;

}

public int getE() {

int e = b + c;

return e;

}

}


Related Questions

How many people has the largest cyber attack killed?

Answers

More that 1,000,000,000

Answer:

I think it's MyDoom?? I heard it's the most dangerous cyber attack in history since it caused 38 billion dollars.

pharmaceutical company is using blockchain to manage their supply chain. Some of their drugs must be stored at a lower temperature throughout transport so they installed RFID chips to record the temperature of the container. Which other technology combined with blockchain would help the company in this situation?

Answers

Answer:

Artificial Intelligence (AI)

Explanation:

Artificial Intelligence (AI)

In this question, the answer is "Artificial intelligence", it is used as the simulation of human intelligence processes by machines, especially computer systems, which is called artificial intelligence.

Expert systems, natural language, voice recognition, and object detection are just a few of the specific uses of AI.Its convergence of blockchain technologies such as AI can accelerate machine learning and allow AI to produce and exchange financial goods.The blockchain enables secure storage and data sharing or anything else of value. In this, the data is analyzed, and insights and derived from it to generate value.

Learn more:

Artificial intelligence: brainly.com/question/17146621

You are given an array of arrays a. Your task is to group the arrays a[i] by their mean values, so that arrays with equal mean values are in the same group, and arrays with different mean values are in different groups. Each group should contain a set of indices (i, j, etc), such that the corresponding arrays (a[i], a[j], etc) all have the same mean. Return the set of groups as an array of arrays, where the indices within each group are sorted in ascending order, and the groups are sorted in ascending order of their minimum element.

Example

For
a = [[3, 3, 4, 2],
[4, 4],
[4, 0, 3, 3],
[2, 3],
[3, 3, 3]]
the output should be

meanGroups(a) = [[0, 4],

[1],

[2, 3]]

mean(a[0]) = (3 + 3 + 4 + 2) / 4 = 3;
mean(a[1]) = (4 + 4) / 2 = 4;
mean(a[2]) = (4 + 0 + 3 + 3) / 4 = 2.5;
mean(a[3]) = (2 + 3) / 2 = 2.5;
mean(a[4]) = (3 + 3 + 3) / 3 = 3.
There are three groups of means: those with mean 2.5, 3, and 4. And they form the following groups:

Arrays with indices 0and 4 form a group with mean 3;
Array with index 1 forms a group with mean 4;
Arrays with indices 2and 3 form a group with mean 2.5.
Note that neither

meanGroups(a) = [[0, 4],

[2, 3],

[1]]

nor

meanGroups(a) = [[0, 4],

[1],

[3, 2]]

will be considered as a correct answer:

In the first case, the minimal element in the array at index 2 is 1, and it is less then the minimal element in the array at index 1, which is 2.
In the second case, the array at index 2 is not sorted in ascending order.
For
a = [[-5, 2, 3],
[0, 0],
[0],
[-100, 100]]
the output should be

meanGroups(a) = [[0, 1, 2, 3]]

The mean values of all of the arrays are 0, so all of them are in the same group.

Input/Output

Answers

Answer:

import numpy as np  

a = [[3, 3, 4, 2], [4, 4], [4, 0, 3, 3], [2, 3], [3, 3, 3]]

mean_holder = [np.array(i).mean() for i in a]

mean_groups= [[i for i,x in enumerate(mean_holder) if x==v] for v in mean_holder]

mean_g = []

for i in mean_groups:

   if i not in mean_g:

       mean_g.append(i)

print(mean_holder)

print(mean_g)

Explanation:

The python's Numpy package is used to convert the lists in the a-list into arrays and the means are taken and grouped by index

9. Which of the following is the
leading use of computer?​

Answers

Complete Question:

What is the leading use of computers?

Group of answer choices.

a. web surfing.

b. email, texting, and social networking.

c. e-shopping.

d. word processing.

e. management of finances.

Answer:

b. email, texting, and social networking.

Explanation:

Communication can be defined as a process which typically involves the transfer of information from one person (sender) to another (recipient), through the use of semiotics, symbols and signs that are mutually understood by both parties. One of the most widely used communication channel or medium is an e-mail (electronic mail).

An e-mail is an acronym for electronic mail and it is a software application or program designed to let users send texts and multimedia messages over the internet.

Also, social media platforms (social network) serves as an effective communication channel for the dissemination of information in real-time from one person to another person within or in a different location. Both email and social networking involves texting and are mainly done on computer.

Hence, the leading use of computer is email, texting, and social networking.

Design the program in the following way:

a. Prompt the user for the name of a boat and then for that boat's time (in seconds).
b. Continue to do this until the user presses enter without entering a name or enters a sentinel value.
c. At this point output the name of the race winner along with the time, the average time, the name the slowest boat along with its time.
d. Use a map structure to store the boat names and their associated times. You may use lists within the program as you see fit.

Answers

Answer:

d = {}

while True:

   name = input("Enter the name of the boat (Press Enter or q to stop): ")

   if name == "" or name == "q":

       break

   time = int(input("Enter the time (in seconds): "))

   d[name] = time

winner_name = min(d, key=d.get)

winner_time = min(d.values())

average_time = sum(d.values()) / len(d.values())

slowest_boat = max(d, key=d.get)

slowest_time = max(d.values())

print(f"Winner name: {winner_name} and its time: {winner_time}")

print(f"Average time: {average_time}")

print(f"Slowest boat: {slowest_boat} and its time: {slowest_time}")

Explanation:

*The code is in Python.

Create an empty map(dictionary) to hold the values

Create a while loop. Inside the loop:

Ask the user to enter the name of the boat. Check if the user presses Enter or q, using if and break

Ask the user to enter the time

Insert these values as key-value pair to the map

When the loop is done:

Find the winner_name, the min() function finds the minimum value in a list. In this case, the key=d.get creates a list of the values in the map. The min(d, key=d.get) returns the key of the minimum value

Find the winner_time, min(d.values()) returns the minimum time in our map

Find the average time, the sum() function, returns the sum of the values in a list. In this case, sums all the values in the map. The len() function finds the count of the values. If we divide the sum of times entered by the count of the times entered, we get the average time

Find the slowest_time, the max() function returns the max of the value in a list. In this case, the maximum value is the slowest time

Print the results

Explain why programming languages evolve?​

Answers

Answer:

Throughout the 20th century, research in compiler theory led to the creation of high-level programming languages, which use a more accessible syntax to communicate instructions. The first high-level programming language was Plankalkül, created by Konrad Zuse between 1942 and 1945.

please give brainliest

A rectangle indicates a single process.true or false​

Answers

Answer: False

Explanation: I just learned about this like 4 months ago lol

Answer:

false

Explanation:

Hope this helps

if the bleeding period of a woman is indicated by days of 1-5, then the days when the woman is highly fertile is between______,show how it is ?​

Answers

Drink the blood because it taste like candy and juice.

Select the correct answer.
18. Which principle of animation involves presenting an object prominently as the focus of a scene?
A.
anticipation
B.
staging
C.
timing
D.
arcs
E.
ease in and ease out

Answers

Answer:

It's either B or D

Explanation:

If it's not I'm sorry :(

Is there an alternative website of https://phantomtutors.com/ to get guidance in online classes?

Answers

Answer:

The website is

classroom

Explanation:

Which one of the following media is unguided media ?
A : fiber optic
B : Coaxial cable
C : Twisted pair
D : Satellite transmission

Answers

Answer:

Satellite transmission

ANSWER ASAP! 50 POINTS!!!!
If you would like to give another user permissions on your mailbox or to particular folders within your mailbox, which
role should you configure?
O Assignee
O Client
O Delegate
O Manager

Answers

Answer:

The first one/Assignee

Explanation:

Definition:

1.

a person to whom a right or liability is legally transferred.

2.

a person appointed to act for another.

The assignee peace’s it’s the role that works better when you configure about it

Which of the following activities do not involve Information Technology? *



A. Identification card theft

B.Dissemination of Information through social media

C. Listening to an mp3 device

D. Using a software to generate images​

Answers

Answer: B




hope it helps

What you need to know In this program, a roll string is a number, followed by a lowercase "d", followed by another number. The first number is the number of dice to roll. The second number is the number of sides on each die. For example, 1d6 means there is one die with six sides. The total output of the roll is a random whole number between one and six, inclusive. 2d8 means there are two dice, each with eight sides. The total output of the roll is a random whole number between two and 16, inclusive. Since we are using a computer, we can have an input like 500d1000 (meaning a 1000-sided die, rolled 500 times) which would not be possible in real life.
Function: get_roll(rollstring)
This function takes an input parameter as a string that looks like "1d3", "3d5", etc. The function should return an integer simulating those dice rolls. In the case of "3d5", for example, the function will generate a random number between one and five, three times, and return the total (sum) as an integer. This function should return the value back to get_damage().
Function: get_damage(attack, defense)
This function gets the value of damage based on roll strings. Player 1 (the first roll) is always on attack; Player 2 (the second roll) is always on defense. If the defense roll is greater than the attack roll, return 0. Otherwise, return attack minus defense, as an integer. This function should call get_roll() twice, once for each Player. This function should return the value back to main_main().
Function: main_menu()
In this function, ask the user how many rounds they want to play. Next, ask the user to input Player 1 and Player 2’s dice for roll one, roll two, etc., up to the number of rolls they entered. The rolls for each round must be entered on one line with no spaces. This function should call get_damage() for each round.

Answers

Answer:

import random

def get_damage(attack,defense):

   attack_roll = get_roll(attack)

   defense_roll = get_roll(defense)

   if defense_roll>attack_roll:

       return 0

   else:

       return attack_roll-defense_roll

def main_menu():

   rounds = int(input('Enter the number of rounds to play? '))

   for round in range(1,rounds+1):

       p1=  input('Player 1 enter rollstring: ')

       p2=  input('Player 1 enter rollstring: ')

       damage = get_damage(p1,p2)

       print('Round: #{}, Damage: {}'.format(round,damage))

def get_roll(rollstring):

   dices, sides = rollstring.split('d')

   total = 0

   for roll in range(int(dices)):

       total += random.randint(1, int(sides))  

   return total

main_menu()

Explanation:

The main_menu python function is the module dice game that prompts for user input to get the number of times a round is played to call the get_damage function which in turn calls the get_roll function to simulate the dice roll and return the accumulated total of the sum of the random dice value.

An administrator wants to restrict access to a particular database based upon a stringent set of requirements. The organization is using a discretionary access control model. The database cannot be written to during a specified period when transactions are being reconciled. What type of restriction might the administrator impose on access to the database

Answers

Answer:

Time of the day and object restrictions

Explanation:

From the question, we understand that the database is not allowed to be accessed at a certain period of time.  

Because this has to do with time (period), the administrator will need to set a time of the day object restriction on the database in order to prevent the users from accessing the database objects

Find the distance between the points.


(5,-2),(-6,-2)

Answers

Answer:

-24

Explanation:

because

3(-6 -2) then

3×(-8) > -24

Question 4 (7 points)
What is NOT a type of pricing?
0 0 0
Bait pricing
Distribution pricing
Value-in-use pricing
Prestige pricing

Answers

I think they’re all types of pricing ;-;

6
Where is the Text Highlight Color button located?
a. In the Font group on the Home tab
b. In the Text group on the Edit tab
C. In the Paragraph group on the Home tab
d. In the Font group on the Edit tab

Answers

Answer C in the paragraph group on the home tab

Consider the following code segment, which is intended to create and initialize the two-dimensional (2D) integer array num so that columns with an even index will contain only even integers and columns with an odd index will contain only odd integers.
int[][] num = /* missing code */;
Which of the following initializer lists could replace /* missing code */ so that the code segment will work as intended?
A. {{0, 1, 2}, {4, 5, 6}, {8, 3, 6}}
B. {{1, 2, 3}, {3, 4, 5}, {5, 6, 7}}
C. {{1, 3, 5}, {2, 4, 6}, {3, 5, 7}}
D. {{2, 1, 4}, {5, 2, 3}, {2, 7, 6}}
E. {{2, 4, 6}, {1, 3, 5}, {6, 4, 2}}

Answers

Answer:

A. {{0, 1, 2}, {4, 5, 6}, {8, 3, 6}}

Explanation:

From the options, we can see that the array is a 3 by 3 array and the array index (whether row or column) begins at 0.

So, the column index for this array is 0, 1 and 2.

Column number 0 and 2 will be treated as the even column while column number 1 will be treated as the odd columns.

Of all options (a) to (e), option (a) fits the requirement of the question; hence; (a) answers the question.

Answer:

A

Explanation:

because the index is even

List 3 clinical tools available in the EHR and discuss how those benefit the patient and/or the practice

Answers

Thor Odin and Aries the threes listed powerful

Print person1's kids, call the incNumKids() method, and print again, outputting text as below. End each line with a newline.
Sample output for below program with input 3:
Kids: 3
New baby, kids now: 4
// ===== Code from file PersonInfo.java =====
public class PersonInfo {
private int numKids;

public void setNumKids(int setPersonsKids) {
numKids = setPersonsKids;
}

public void incNumKids() {
numKids = numKids + 1;
}

public int getNumKids() {
return numKids;
}
}
// ===== end =====

// ===== Code from file CallPersonInfo.java =====
import java.util.Scanner;

public class CallPersonInfo {
public static void main(String [] args) {
Scanner scnr = new Scanner(System.in);
PersonInfo person1 = new PersonInfo();
int personsKid;

personsKid = scnr.nextInt();

person1.setNumKids(personsKid);

/* Your solution goes here */

}
}
// ===== end =====

Answers

Answer:

Explanation:

The following code was written in Java and modifies the code so that for the given input such as 3 it outputs the exact information shown in the sample output.

import java.util.Scanner;

class CallPersonInfo {

   public static void main(String [] args) {

       Scanner scnr = new Scanner(System.in);

       PersonInfo person1 = new PersonInfo();

       int personsKid;

       System.out.println("How many kids do you have:");

       personsKid = scnr.nextInt();

       person1.setNumKids(personsKid);

       /* Your solution goes here */

       System.out.println("Kids: " + person1.getNumKids());

       person1.incNumKids();

       System.out.println("New Baby, kids now: " + person1.getNumKids());

   }

}

class PersonInfo {

   private int numKids;

   public void setNumKids(int setPersonsKids) {

       numKids = setPersonsKids;

   }

   public void incNumKids() {

       numKids = numKids + 1;

   }

   public int getNumKids() {

       return numKids;

   }

}

If the maximum range of projectile is x. show that the maximum height reached by the same projectile is x/4.

Answers

Explanation:

Given that,

The maximum range of a projectile is x.

Maximum range occurs when the angle of projection is 45°. Using formula for maximum range.

[tex]R=\dfrac{v^2}{g}[/tex]

According to the question,

[tex]x=\dfrac{v^2}{g}[/tex] ...(1)

Maximum height,

[tex]h=\dfrac{v^2}{2g}[/tex]

From equation (1).

[tex]h=\dfrac{x}{2}[/tex]

Hence, this is the required solution.

EXTRA CREDIT - 1 point! Scenario: A small business has implemented the best way to handle the few Service Accounts they have in their AD: They use a random password generator to set Service Account passwords, have 1 Service Account per service, and policies are set so that the accounts do not expire. The current passwords are not even stored anywhere. The company rigorously documents this setup, and diligently deprovisions accounts when services configurations change. The company has also implemented Account Monitoring, and know when any of the Service Accounts is being attempted to be used without the correct password, indicating an attack attempt. Due to the security sensitivity of the data accessible via the Service Accounts, any attack attempts will cause the service account to be disabled and IT staff alerted. Finally, the company has implemented a script that can be used to update the existing passwords -- resetting them via the only account delegated this authority: the Enterprise Root account. To ensure none of the IT staff can use the Enterprise Root account to reset a Service Account without consent, the password for the Enterprise Root account is only known to the company's CIO (Chief Information Officer), and is not stored anywhere. Identify (1) one major problem that you can see with this setup, and describe why this is a problem. There are multiple correct answers possible for this EXTRA CREDIT question.

Answers

Answer:

A small business has implemented the best CIO:-

Though the setup is well planned but there is another drawback to that setup as the root password is with the company CIO. So, even in case of critical situation, if the CIO is somehow unavailable, the entire business will be inactive as users can't able to logon into the system as it is mentioned the service accounts can only be reset using the ROOT account. There should be other alternatives to this failure.

Explanation:

differentiate between a university and a TVET college in terms of what each offers and explain the stigma associated with TVET colleges​

Answers

Answer: See explanation

Explanation:

The main focus of a Technical Vocational Education and Training (TVET) college is to prepare the students and train them so that they'll be functional in a skilled trade. It focuses on vocational training and education. University isn't really concerned about transfer of skills but rather more concerned with the transfer of knowledge to the students

The Technical Vocational Education and Training (TVET) qualification is also faster, cheaper and easier to get than the university certificate which is costlier and takes longer period to get.

The stigma associated with TVET colleges has been created by both the society and the government. Firstly, people believed that only those from poor backgrounds or those that couldn't gain university admisson go to TVET colleges.

Also, the government isn't helping matters as public funding for education are allocated more to universities and not really allocated to TVET colleges. These has brought about the stigma to the TVET.

The difference between a university and a TVET college in terms of what each offers is university impact knowledge while TVET college is more of practical.

University and TVET college

The major difference is University provide students with knowledge the need based on the course they are studying while TVET colleges is more of practical as they provide the students with practical skills they need because they render technical and vocational education and training.

The stigma associated with TVET colleges​ is because people think that University student has higher opportunities when in labor market than TVET colleges student.

Inconclusion the difference between a university and a TVET college in terms of what each offers is university impact knowledge while TVET college is more of practical.

Learn more about University and TVET college here:https://brainly.com/question/26696444

what is memory? explain types of memory?​

Answers

Memory is the electronic holding place for the instructions and data a computer needs to reach quickly. It's where information is stored for immediate use. Memory is one of the basic functions of a computer, because without it, a computer would not be able to function properly. Memory is also used by a computer's operating system, hardware and software.

Answer:

Memory is the taking personal record of computer of past experience. The types of memory are 1)Read Only Memory 2)Random Access memory

In Subtractive empathy, the counselor responses gives back less (or distorts) than what the client has said. slightly add something to what the client has said. add a link to something the client has said earlier. interchangeable with client experience.

Answers

Answer:

gives back less (or distorts) than what the client has said.

Explanation:

Emotional intelligence can be defined as the cognitive ability of an individual or person to be able to recognize his or her emotions, have an understanding of the message being conveyed and knowing how these emotions affect the people around him or her.

Basically, there are five (5) main characteristics or features of emotional intelligence and these are;

I. Motivation.

II. Self-awareness.

III. Social skills.

IV. Self-regulation.

V. Empathy.

Empathy simply means putting yourself in a person's position, depicting how you will feel if you were in his or her situation. Also, empathy depicts getting the perspective of a thing through another person's lens, eyes or ears.

There are three (3) main types of empathy and these includes;

I. Basic (interchangeable empathy).

II. Additive empathy.

III. Subtractive empathy.

In Subtractive empathy, the counselor responses gives back less (or distorts) than what the client has said.

This ultimately implies that, subtractive empathy requires the counselor using an inappropriate listening or influencing skills.


The process of saving information to a secondary storage device is called...

Answers

Answer:

The process of saving information to a secondary storage device is referred to as embedding.

Explanation:

The process of saving information to a secondary storage device is called embedding.

What is embedding?

One technique a writer or speaker could use to lengthen a sentence is embedding. When two clauses fall into the same category, they can frequently be nested inside of one another. For illustration: The baked product was presented by Norman. My sister didn't know about it.

Her thumb had the thorn embedded in the surface there, locked onto something. A person or thing is said to be embedded when it is a highly important or powerful part of that person, item, etc. Guilt was deeply engrained in my conscience.

The embedding strategy modifies each video frame slightly in an attempt to try covert or undetectable data concealing.

Thus, it is embedding.

For more information about embedding, click here:

https://brainly.com/question/16911950

#SPJ6

Company A’s IT department has a hosting platform specifically for systems used by the company’s large marketing department. This platform provides critical, high-availability hosted IT resources and services. However, the IT department has started to receive complaints about the time it takes to start new marketing campaigns, primarily due to how long it takes to provision new servers within this platform. Also, as a result of a recent set of mergers and acquisitions, the consumers of the services hosted by this platform have become more distributed, with service consumers accessing services from a large variety of locations, and with increasingly different types of devices. In response to these complaints, Company A is considering using a cloud-based hosting platform. Which specific characteristics of a cloud will be helpful for Company A to address its problems?

Answers

Answer:

cloud has the On demand and ubiquitous access characteristics

Explanation:

The specific characteristics of cloud that would be helpful for his problem to be addressed is the fact that cloud offers on demand usage and ubiquitous access.

What is meant by on demand access is that the cloud customer can pay for cloud services and use them whenever they are needed. As long as the cloud service is authorized.  

By Ubiquitous access it means that the cloud customer has reliable access without the presence of any form of disturbances or issues and it can be accessed from anywhere. Different range of devices are supported on the cloud platform and with the presence of internet lots of services can be accessed.

Based on the issues being faced by customers, this characteristics of cloud will be useful to address the problems.

Tyrone Shoelaces has invested a huge amount of money into the stock market and doesnât trust just anyone to give him buying and selling information. Before he will buy a certain stock, he must get input from three sources. His first source is Pain Webster, a famous stock broker. His second source is Meg A. Cash, a self-made millionaire in the stock market, and his third source is Madame LaZora, world-famous psychic. After several months of receiving advice from all three, he has come to the following conclusions:

a) Buy if Pain and Meg both say yes and the psychic says no.

b) Buy if the psychic says yes.

c) Donât buy otherwise.

Construct a truth table and find the minimized Boolean function to implement the logic telling Tyrone when to buy.

Answers

Solution :

The truth table is :

Pain      Meg       Psych     Buy

   [tex]$0$[/tex]           [tex]$0$[/tex]                [tex]$0$[/tex]            [tex]$0$[/tex]

   [tex]$0$[/tex]           [tex]$0$[/tex]                [tex]$1$[/tex]            [tex]$1$[/tex]

   [tex]$0$[/tex]           [tex]$1$[/tex]                [tex]$0$[/tex]           [tex]$0$[/tex]

   [tex]$0$[/tex]           [tex]$1$[/tex]                 [tex]$1$[/tex]             [tex]$1$[/tex]

   [tex]$1$[/tex]            [tex]$0$[/tex]               [tex]$0$[/tex]            [tex]$0$[/tex]

   [tex]$1$[/tex]            [tex]$0$[/tex]               [tex]$1$[/tex]             [tex]$1$[/tex]

   [tex]$1$[/tex]            [tex]$1$[/tex]                [tex]$0$[/tex]            [tex]$1$[/tex]

   [tex]$1$[/tex]           [tex]$1$[/tex]                  [tex]$1$[/tex]              [tex]$1$[/tex]

The Boolean function :

[tex]$\text{F(Pain, \ Meg, \ Psych)}$[/tex] = [tex]$\overline {\text{PainMeg}}\text{Psych}+\overline{\text{Pain}}\text{MegPsych}+\text{Pain}\overline{\text{Meg}}\text{Psych}+\text{PainMeg}\overline{\text{Psych}}$[/tex][tex]$+\text{PainMegPsych}$[/tex]

                              Meg and Psych

                           [tex]$00$[/tex]     01     [tex]$11$[/tex]       10

  Pain         0                 1        1

                   [tex]$1$[/tex]                 [tex]$1$[/tex]        1        [tex]$1$[/tex]

Therefore,

[tex]$\text{F(Pain, \ Meg, \ Psych)}$[/tex]  = Psych + PainMeg

In the QuickSort algorithm, the partition method we developed in class chose the start position for the pivot. We saw that this leads to worst case performance, O(n2), when the list is initially sorted. Try to improve your QuickSort by choosing the value at the middle, instead of the value at the start, for the pivot. Test your solution with the Driver you used for homework. Upload the output produced by the Driver, and your modified QuickSort source file.

====================================================

ORIGINAL

public class QuickSort> implements Sorter

{

List list;

public void sort(List list)

{

this.list = list;

qSort(0, list.size() -1);

}

public void qSort(int start, int end)

{

if(start >= end)

return;

int p = partition(start,end);

qSort(start, p-1);

qSort(p+1,end);

}

public int partition(int start,int end)

{

int p = start;

E pivot = list.get(p);

for(int i = start+1; i <= end; i++)

if(pivot.compareTo(list.get(i)) > 0)

{

list.set(p, list.get(i));

p++;

list.set(i,list.get(p));

}

list.set(p,pivot);

return p;

}

}

====================================================

Driver

public class DriverQuicksort

{ static final int MAX = 20;



public static void main(String[] args)

{

Random rand = new Random(); // random number generator

List numbers = new ArrayList ();

Sorter sorter;

sorter = new QuickSort ();



// Test QuickSort with random input

System.out.println ("Testing Quicksort");

for (int i=0; i
numbers.add (rand.nextInt(50)); // random int in [0..49]

System.out.println ("Before sorting:");

System.out.println (numbers);

sorter.sort (numbers );

System.out.println ("After sorting:");

System.out.println (numbers);

System.out.println ();





// Test QuickSort with ascending input

numbers.clear();

for (int i=0; i
numbers.add (i * 10); // initially in ascending order

System.out.println ("Before sorting:");

System.out.println (numbers);

sorter.sort ( numbers);

System.out.println ("After sorting:");

System.out.println (numbers);

System.out.println ();



// Test QuickSort with descendng input

numbers.clear();

for (int i=0; i
numbers.add (MAX-i); // initially in ascending order

System.out.println ("Before sorting:");

System.out.println (numbers);

sorter.sort ( numbers);

System.out.println ("After sorting:");

System.out.println (numbers);

System.out.println ();



numbers.clear();

numbers.add(75);

numbers.add(93);

numbers.add(35);

numbers.add(0);

numbers.add(75);

numbers.add(-2);

numbers.add(93);

numbers.add(4);

numbers.add(6);

numbers.add(76);

System.out.println ("Before sorting:");

System.out.println (numbers);

sorter.sort(numbers);

System.out.println ("After sorting:");

System.out.println (numbers);

System.out.println ();

}

}

Answers

this is everywhere i don’t understand i’m sorry
Other Questions
I need help with this as fast as possible thanks bye Sugar levels in the cells of a horse have dropped. Predict what will happen. A. The horse will drink some water. B. The horse will die. C. The horse will eat something. D. The horse will breathe faster. Sine divided by Cosine is equal to Tangent. True or false? 3. Multiply: 7(-12) help im bord so how are u to day say any thing u whant be free During a hurricane, what effect can the ocean have on the beach? A. Only the wind from a hurricane affects the land. B. Only the rain from a hurricane affects the land. C. The ocean can wash away much of the beach in a short time. D. The ocean always cleans litter from the beach during a hurricane. During a sale, all pillows are 14 off the regular price. Which expression shows the amount of money saved on a pillow that had a regular price of d dollars? The poem consists of how many verses The sea creeps to pillage she leaps on her prey A child of the village was murdered today The weights of newborn elephants are normally distributed with a mean of 225 pounds and a standard deviation of 45 pounds. Find the probability that a newborn elephant weighs more than 210 pounds. Need help i will give anybody brainest!!!!!! due in 30 minutes The diameter of a circle is 1.4 centimeters. Find its area. Use 3.14 Round to the nearesthundredth from the well stuffed 52 cards 2 cards are drawn randomly.find the probability of the first card is ace and the second card is Jack of heart( without replacement) by showing tree diagram The following information relates to Schmidt Sausage Co.'s defined benefit pension plan during the current reporting year: ($ in millions) Plan assets beginning of the year $ 400 Expected return on plan assets 40 Actual return on plan assets 32 Cash contributions 60 Amortization of net loss 8 Retiree benefits 9 Required: Determine the amount of pension plan assets at fair value on December 31. what is -6.77626358E-21 written in scientific notion with three significant digits mr joel borrowed $126000 from the bank for 5 years and paid $17000 calculate the rate percent per annum that he had to pay the bank. One seventh of a number is 12.What is the number? Which of the following statements about annuities are true? Check all that apply. An ordinary annuity of equal time earns less interest than an annuity due. Annuities are structured to provide fixed payments for a fixed period of time. When equal payments are made at the beginning of each period for a certain time period, they are treated as ordinary annuities. When equal payments are made at the beginning of each period for a certain time period, they are treated as an annuity due. WILL GIVE BRAINLIEST!! (Look at photo if confused)Find the value of the power by completing the statements. 9 4The base is ____ A. 4B. 9C. 36D. 94The exponent is ___A. 4B. 9C. 36D. 94Its expanded form is ____A. 4 x 9B. 4x4x4x4x4x4x4x4C. 9 x 4D. 9 x 9 x 9 x9The value of 9 4 is ____A. 36B. 94C. 6,561D. 262,144 PLEASE HELP!Note: Enter your answer and show all the steps that you use to solve this problem in the space provided.The polygons are similar, but not necessarily drawn to scale. Find the value of x. Jackie had a puzzle book that contains a total of 70 puzzles she has completed 2/5 of the puzzles in the book if Jackie completes 18 more puzzles what is the total number of puzzles that she will have completed in the book