Language/Type: Java ArrayList Collections
Author: Marty Stepp (on 2016/09/08)
Write a method swapPairs that switches the order of values in an ArrayList of Strings in a pairwise fashion. Your method should switch the order of the first two values, then switch the order of the next two, switch the order of the next two, and so on. For example, if the list initially stores these values: {"four", "score", "and", "seven", "years", "ago"} your method should switch the first pair, "four", "score", the second pair, "and", "seven", and the third pair, "years", "ago", to yield this list: {"score", "four", "seven", "and", "ago", "years"}
If there are an odd number of values in the list, the final element is not moved. For example, if the original list had been: {"to", "be", "or", "not", "to", "be", "hamlet"} It would again switch pairs of values, but the final value, "hamlet" would not be moved, yielding this list: {"be", "to", "not", "or", "be", "to", "hamlet"}
Language/Type: Java ArrayList Collections
Author: Marty Stepp (on 2016/09/08)
Write a method removeEvenLength that takes an ArrayList of Strings as a parameter and that removes all of the strings of even length from the list.
Type your solution here:
1. for (Iterator iterator = numbers.iterator(); iterator.hasNext();)
2. { Integer number = iterator.next();
3. if (number % 2 == 0) {
4. System.out.println("This is Even Number: " + number);
5. iterator.remove(); mtino
6
7
8 } This is a method problem.
Write a Java method as described. Do not write a complete program or class; just the method(s) above.
Language/Type: Java ArrayList Collections
Author: Marty Stepp (on 2016/09/08)
Write a method removeDuplicates that takes as a parameter a sorted ArrayList of Strings and that eliminates any duplicates from the list. For example, suppose that a variable called list contains the following values: {"be", "be", "is", "not", "or", "question", "that", "the", "to", "to"} After calling removeDuplicates (list); the list should store the following values: {"be", "is", "not", "or", "question", "that", "the", "to"}
Because the values will be sorted, all of the duplicates will be grouped together.
Type your solution here:
WN 600 O
This is a method problem. Write a Java method as described. Do not write a complete program or class; just the method(s) above.

Answers

Answer 1

Answer:

Answer a)

public void swapPairs(ArrayList<String> list) {

   for(int i = 0; i <= list.size() - 2; i += 2) {        

       String val= list.get(i + 1);

       list.set(i + 1, list.get(i));

       list.set(i, val);     }   }          

Answer b)

Using the Iterator interface to remove the strings of even length from the list:

public void removeEvenLength( ArrayList<String> list) {

   Iterator<String> iter= list.iterator();

   while( iter.hasNext() ) {

       String str= iter.next();

       if( str.length() % 2 == 0 ) {

           iter.remove();         }     }   }

Not using Iterator interface:

public static void removeEvenLength(ArrayList<String> list) {  

   for (int i = 0; i < list.size(); i++) {

       String str= list.get(i);

       if (str.length() % 2 == 0) {

           list.remove(i);

           i--;         }     }  }

Answer c)  

public static void removeDuplicates(ArrayList<String> list) {  

   for (int i = 0; i < list.size() - 1; i++) {

       if (list.get(i).equals(list.get(i + 1))) {

           list.remove(i + 1);

           i--;         }     }    }

Explanation:

a) The method swapPairs(ArrayList<String> list) ArrayList is used to store elements of String type. The for loop has a variable i that is initialized by 0. It moves through the list. This loop's body stops executing when the value of i exceeds the size-2 of the list. The size() method returns the size of the list. This means i stops moving through the list after the last pair of values is reached. In the loop body, get(i+1) method is used to obtain the element in the list at a index i+1. Lets say in the list {"four", "score", "and", "seven", "years", "ago"}, if i is at element "four" then i+1 is at "score". Then "score" is stored in val variable. Then set() method is used to set i-th element in an ArrayList object at the i+1 index position. The second set(i,val) method is used to set the value in val variable to i-th position/index. So this is how score and four are switched.

b) The method removeEvenLength( ArrayList<String> list) takes ArrayList of Strings as parameter. Iterator is an interface which is used to traverse or iterate through object elements and here it is used to remove the elements. The iterator() method is used to traverse through the array list. The while loop will keep executing till all the elements of the ArrayList are traversed. hasNext() method is used to return True if more elements in the ArrayList are to be traversed. next() method is used to return next element in the ArrayList and store that element in str variable. Then the if statement is used to check if the element in str variable is of even length. The length() function returns the length of the element in ArrayList and modulus is used to check if the length of the element is even. If the condition evaluates to true then the remove() method is used to remove that element of even length from the list.

c) The method removeDuplicates(ArrayList<String> list) takes ArrayList of Strings as parameter and eliminates any duplicates from the list. It has a for loop that moves through the list and it stops executing when the value of i exceeds the size - 1 of the list. The if condition has two method i.e. get() and equals(). The get() method is used to obtain the element at the specified index position and equals() function is used to compare the two string elements. Here these two strings are obtained using get() method. get(i) gets element at i-th index and get(i+1) gets element at i + 1 position of the list. If both these elements are equal, then the element at i+1 index is removed. This is how all duplicates will be removed.


Related Questions

Which relation is created with the primary key associated with the relationship or associative entity, plus any non-key attributes of the relationship or associative entity and the primary keys of the related entities (as foreign key attributes)?

Answers

Answer:

- Transform binary or unary M:N relationship or associative entity with its own key.

Explanation:

Transform binary relation is described as the method through which a decimal can easily be converted into binary while the unary relationship is described as a relationship in which both the two participants occurs from the same entity.

In the given case, 'transform binary or unary M:N relationship' can be created using 'the primary key linked with the relationship plus any non-key aspects of the relationship and the primary keys of the related entities' as it displays the existence of a relationship between the occurrences of a similar set of the entity i.e. associative entity here.

If i wanted to change my phones simcard, does anything need transferring, or is it an easy swap?

Answers

Most likely not but I think you’ll have to log in your account like if you have an Apple phone . You’ll have to log into your Apple ID


where must data be in
order to be processed by an
executing program. *
O A. Read Only Memory
O B. secondary storage device
O C. Random Access Memory
O D. hard disk​

Answers

Answer:

C Random access memory

Design and implement a program (name it Youth) that reads from the user an integer values repressing age (say, age). The program prints out the entered values followed by a message as follows: If age is less or equal to 21, the message is "Age is a state of mind.". Finally, the program always prints out the message "Age is a state of mind." Format the outputs following the sample runs below.
Sample run 1:
You entered: 20
Youth is a wonderful thing. Enjoy.
Age is a state of mind.

Answers

Answer:

The programming language is not stated; I'll answer this question using C++ programming language;

Another thing to note is that; the sample run is quite different from the illustration in the question; So, I'll assume the program to print "Youth is a wonderful thing. Enjoy.", if and only if age is less than or equal to 21

The program is as follows

#include<iostream>

using namespace std;

int main()  {

int age;

int i =1;

start:

cout<<"Sample run: "<<i<<endl;

cout<<"You entered: ";

cin>>age;

if(age<=21)  {

 cout<<"Youth is a wonderful thing. Enjoy."<<endl; }

cout<<"Age is a state of mind"<<endl;

i++;

cout<<"Run another? (Y/N): ";

char resp;

cin>>resp;

if(resp=='Y')

{

 goto start;

}

return 0;

}

Explanation:

Line 4 of the program declares age as integer

Line 5 declares and initializes a counter variable, i to 1

Line 6 is used as a label to start another sample run

Line 7 prints the Sample run in the following format;

        Sample run 1, during the first iteration

        Sample run 2, during the second iteration; and so on...

Line 8 prompts the user to supply details for age

Line 9 stores user input in variable age

Line 10 checks if age is less than or equal to 21

If true, the program outputs Youth is a wonderful thing. Enjoy., then it continues execution on line 23

Otherwise, it jumps directly to line 23 and outputs Age is a state of mind

The counter is increased by 1 on line 24

The program asks if the user wants to take another sample run on line 25

The response is saved in a char variable on line 27

If the user response is Y, the program goes to the label on line 6 to begin another iteration

Otherwise, the program is terminated.

See attachment for source file

Your company's offshore office has determined that the foreign government keeps a copy of everything that leaves or enters the country. Your management perceives this as a possibility of trade secrets being stolen. As a preventive measure, you are asked to implement for your company a strict practice that all information to and from this office must be encrypted using 128-bit AES standard. This is an example of the company using:

a. Integrity measure against a possible tampering of information.
b. Availability measure to make data available to only the right party and not to other parties.
c. Digital Signatures to make sure that the information sent by its offshore office can be certified to be sent by that office.
d. Confidentiality measure to hide information from unwanted parties even if they can have access to data.

Answers

I’m guessing b. I hope this helps !

After discovering a security incident and removing the affected files, an administrator disabled an unneeded service that led to the breach. Which of the following steps in the incident response process has the administrator just completed?
A. Containment
B. Eradication
C. Recovery
D. Identification

Answers

Answer:

A. Containment

Explanation:

This Containment is important before an incident or damage to resources. Most events require control, so it is important when handling each event. Containment provides time to develop a solution strategy that is prevalent. Decisions Making decisions to facilitate an event is much easier if the decision is involved in predetermined strategies and processes. Organizations must define acceptable risks in dealing with events and develop strategies accordingly. Network prevention is a fast and powerful tool designed to give security administrators the power they need to detect and prevent threats.

B) Use an Excel function to find: Note: No need to use Excel TABLES to answer these questions! 6. The average viewer rating of all shows watched. 7. Out of all of the shows watched, what is the earliest airing year

Answers

Answer:

Use the average function for viewer ratings

Use the min function for the earliest airing year

Explanation:

The average function gives the minimum value in a set of data

The min function gives the lowest value in a set of data

Write a python program that asks the user to enter a student's name and 8 numeric tests scores (out of 100 for each test). The name will be a local variable. The program should display a letter grade for each score, and the average test score, along with the student's name. There are 12 students in the class.
Write the following functions in the program:
calc_average - this function should accept 8 test scores as arguments and return the average of the scores per student
determine_grade - this function should accept a test score average as an argument and return a letter grade for the score based on the following grading scale:
90-100 A
80-89 B
70-79 C
60-69 D
Below 60 F

Answers

Answer:

The program doesn't make use of comments (See Explanation)

Also the source code is attached as image to enable you see the proper format and indexing of the source code

The program using python is as follows

def calc_average(name):

   score = []

   sum = 0

   for j in range(8):

       inp = int(input("Test Score"+str(j+1)+": "))

       score.append(inp)

       sum = sum + inp

       if inp>=90 and inp<=100:

           print("A")

       elif inp>=80 and inp<90:

           print("B")

       elif inp>=70 and inp<80:

           print("C")

       elif inp>=60 and inp<70:

           print("D")

       else:

           print("F")

   avg = sum/8

   print("Result Details of "+name)

   print("Average Score: "+str(avg))

   return avg

def determine_grade(result):

   if float(result) >= 90.0 and float(result) <= 100.0:

       print("Letter Grade: A")

   elif float(result) >= 80.0 and float(result) <90.0:

       print("Letter Grade: B")

   elif float(result) >= 70.0 and float(result) < 80.0:

       print("Letter Grade: C")

   elif float(result) >= 60.0 and float(result) < 70.0:

       print("Letter Grade: D")

   else:

       print("Letter Grade: F")

   print(" ")

for i in range(2):

   name = input("Student Name: ")

   result = calc_average(name)

   determine_grade(result)

Explanation:

def calc_average(name):  -> Declares the function calc_average(name); It accepts local variable name from the main function

   score = []

-> Initialize an empty list to hold test scores

   sum = 0

-> Initialize sum of scores to 0

   for j in range(8):

-> Iterate from test score 1 to 8

       inp = int(input("Test Score"+str(j+1)+": "))

-> This line accepts test score from the user

       score.append(inp)

-> The user input is then saved in a lisy

       sum = sum + inp

-> Add test scores

The following lines determine the letter grade of each test score      

if inp>=90 and inp<=100:

           print("A")

---

      else:

           print("F")

   avg = sum/8  -> Calculate average of the test score

The next two lines prints the name and average test score of the student

   print("Result Details of "+name)

   print("Average Score: "+str(avg))

   return avg

-> This line returns average to the main method

The following is the determine_grade method; it takes it parameter from the main method and it determines the letter grade depending on the calculated average

def determine_grade(result):

   if float(result) >= 90.0 and float(result) <= 100.0:

       print("Letter Grade: A")

   elif float(result) >= 80.0 and float(result) <90.0:

       print("Letter Grade: B")

   elif float(result) >= 70.0 and float(result) < 80.0:

       print("Letter Grade: C")

   elif float(result) >= 60.0 and float(result) < 70.0:

       print("Letter Grade: D")

   else:

       print("Letter Grade: F")

   print(" ")

for i in range(2):

-> This is the main method

   name = input("Student Name: ")  -> A local variable stores name of the student

   result = calc_average(name)  -> store average of scores in variable results

   determine_grade(result)-> Call the determine_grade function

In this exercise we have to use the computer language knowledge in python to write the code as:

the code is in the attached image.

In a more easy way we have that the code will be:

def calc_average(name):

  score = []

  sum = 0

  for j in range(8):

      inp = int(input("Test Score"+str(j+1)+": "))

      score.append(inp)

      sum = sum + inp

      if inp>=90 and inp<=100:

          print("A")

      elif inp>=80 and inp<90:

          print("B")

      elif inp>=70 and inp<80:

          print("C")

      elif inp>=60 and inp<70:

          print("D")

      else:

          print("F")

  avg = sum/8

  print("Result Details of "+name)

  print("Average Score: "+str(avg))

  return avg

def determine_grade(result):

  if float(result) >= 90.0 and float(result) <= 100.0:

      print("Letter Grade: A")

  elif float(result) >= 80.0 and float(result) <90.0:

      print("Letter Grade: B")

  elif float(result) >= 70.0 and float(result) < 80.0:

      print("Letter Grade: C")

  elif float(result) >= 60.0 and float(result) < 70.0:

      print("Letter Grade: D")

  else:

      print("Letter Grade: F")

  print(" ")

for i in range(2):

  name = input("Student Name: ")

  result = calc_average(name)

  determine_grade(result)

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

A participant in a usability test completes one of the tasks and then starts to tell a story about a problem the participant had with a similar product. After about 1 minute, the moderator interrupts the participant and says "Your story is interesting, but it is now time to move to the next task. There will be more time at the end of the session for you to continue your story."
This provide an example of which role of a moderator?
1. Recruiter
2. Gracious Host
3. Neutral Observer4. Leader

Answers

Answer:

4. Leader.

Explanation:

A moderator is an individual who presides over a discussion and regulates how the sessions go.

In the case of usability test, a moderator is expected to be in charge of the session, neutral and unbiased with respect to the product being tested, and approachable by the participants.

In this scenario, the moderator interrupts a participant from telling a story about a problem the participant had with a similar product and said "Your story is interesting, but it is now time to move to the next task. There will be more time at the end of the session for you to continue your story."

Hence, the moderator was acting as a leader in his role.

This simply means that, the moderator was being in charge of the session and thus in full control of the pace or timing. As a leader, the moderator ensures a smooth running of the usability test and the participants.

What is an optimal Hup?man code for the following set of frequencies, based on the first 8 Fibonacci numbers? a:1 b:1 c:2 d:3 e:5 f:8 g:13 h:21 Can you generalize your answer to find the optimal code when the frequencies are the first n Fibonacci numbers?

Answers

Answer:

Optimal Huffman code is an encoding algorithm which encodes different symbols using priority queuing

Explanation:

To explain how the Optimal Huffman code works we draw the Huffman tree for the set of symbols and the leaves of the tree are symbols

Note; the right and left moves on the tree starting from the root of the tree to the leaves contain 1 and 1

Also each letter in the tree has a code word from the the root to each letter and the code is called ; Huffman codes.

h : 0

g : 10

f  : 110

e : 1110

d : 11110

c : 111110

b : 1111110

a : 11111110

attached is the Huffman tree

Two friends are eating dinner at a restaurant. The bill comes in the amount of 47.28 dollars. The friends decide to split the bill evenly between them, after adding 15% tip for the service. Calculate the tip, the total amount to pay, and each friend's share, then output a message saying "Each person needs to pay: " followed by the resulting number.

Answers

Answer:

bill = 47.28

tip = bill * 0.15

total_pay = bill + tip

each_share = total_pay / 2

print("Each person needs to pay: " + str(each_share))

Explanation:

*The code is in Python.

Set the bill

Calculate the tip, multiply the bill by 0.15

Calculate the total_pay, add bill and tip

Calculate each friend's share, divide the total_pay by 2. Then, print it in required format.

In Java.Use a single for loop to output odd numbers, even numbers, and an arithmetic function of an odd and even number. Use the numbers in the range [ 0, 173 ]. Note that the square brackets indicate inclusion of the endpoints. 0 (zero) is considered an even number. Format your output to 4 decimal places.Do not use any branching statements (if, if-else, switch, ... )Your output should be professional in appearance and formatted. Use at least one control character in your output other than '\n'.Document your code.Using your loop, display the following in a single line on the console:Odd number even number sqrt( odd number + even number)Your output should look like this (this is a partial example for the numbers [0, 173].1.0000 3.0000 5.0000 7.00000.0000 2.0000 4.0000 6.00001.0000 2.2361 3.0000 3.6051

Answers

Answer:

This program is written using java programming language

Difficult lines are explained using comments (See Attachment for Source file)

Program starts here

import java.util.*;

import java.lang.Math;

public class oddeven{

public static void main(String [] args)

{

 double even,odd;//Declare variables even and odd as double

 //The next iteration prints odd numbers

 for(int i = 1;i<=173;i+=2)

 {

  odd = i;

  System.out.format("%.4f",odd);//Round to 4 decimal places and print

System.out.print("\t");

 }

 System.out.print('\n');//Start printing on a new line

 //The next iteration prints even numbers

 for(int i = 0;i<=173;i+=2)

 {

  even=i;

  System.out.format("%.4f",even);//Round to 4 decimal places and print

System.out.print("\t");

 }

 System.out.print('\n');//Start printing on a new line

 double  ssqrt;//Declare ssqrt to calculate the square root of sum of even and odd numbers

 for(int i = 0;i<=173;i+=2)

 {

  ssqrt = Math.sqrt(2*i+1);//Calculate square root here

  System.out.format("%.4f",ssqrt); //Round to 4 decimal places and print

System.out.print("\t");

 }

}

}

Explanation:

Libraries are imported into the program

import java.util.*;

import java.lang.Math;

The following line declares variables even and odd as double

double even,odd;

The following iteration is used to print odd numbers  with in the range of 0 to 173

for(int i = 1;i<=173;i+=2)  {

odd = i;

System.out.format("%.4f",odd); This particular line rounds up each odd numbers to 4 decimal places before printing them

System.out.print("\t"); This line prints a tab

}

The following code is used to start printing on a new line

System.out.print('\n');

The following iteration is used to print even numbers  with in the range of 0 to 173

for(int i = 0;i<=173;i+=2)

{

even=i;

System.out.format("%.4f",even); This particular line rounds up each even numbers to 4 decimal places before printing them

System.out.print("\t"); This line prints a tab

}

The following code is used to start printing on a new line

System.out.print('\n');

The next statement declares ssqrt as double to calculate the square root of the sum of even and odd numbers

double  ssqrt;

for(int i = 0;i<=173;i+=2)

{

ssqrt = Math.sqrt(2*i+1);This line calculates the square root of sum of even and odd numbers

System.out.format("%.4f",ssqrt); This particular line rounds up each even numbers to 4 decimal places before printing them

System.out.print("\t"); This line prints a tab

}

A deliberate, politically or religiously motivated attack against data compilations, computer programs, and/or information systems which is intended to disrupt and/or deny service or acquire information which disrupts the social, physical, or political infrastructure of a target. This is known as:

a. cyberterrorism.
b. salami technique.
c. cyberstalking.
d. cyberbullying.

Answers

Answer:

a. cyberterrorism.

Explanation:

Cyberterrorism can be defined as an illegal attack against the information stored in a data based done so as to intimidate a target. This is done to coerce a  target to action or to frustrate and destabilize a target.

In this act, the data compilations or information systems is deliberately attacked to disrupt the psychology of a target. It is one of the major tactics used in politics to frustrate the effort of a political system by an opposition.

For this assignment you will write a class called Dog that has the following member variables:
birthyear. An int that holds the dog’s birth year.
breed. A string that holds the breed of dog.
vaccines. A Boolean holding a yes/no value indicating whether the dog is currently on vaccinations. In addition, the class should have the following member functions:
Constructor. The constructor should accept the dog’s birthyear, breed and vaccines as arguments and assign these values to the object’s birthyear, breed and vaccines member variables.
Accessors. Appropriate accessor functions should be created to allow values to be retrieved from an object’s birthyear, breed and vaccines member variables.
Demonstrate the class in a program that creates a Dog object. The user should enter all input. Be sure to include comments throughout your code where appropriate.

Answers

Answer:

import java.util.Scanner;

public class Dog {

   private int birthYear;

   private String breed;

   private boolean isVaccinated;

   // The constructor

  public Dog(int birthYear, String breed, boolean isVaccinated) {

       this.birthYear = birthYear;

       this.breed = breed;

       this.isVaccinated = isVaccinated;

   }

   // The Accesor Methods

   public int getBirthYear() {

       return birthYear;

   }

   public void setBirthYear(int birthYear) {

       this.birthYear = birthYear;

   }

   public String getBreed() {

       return breed;

   }

   public void setBreed(String breed) {

       this.breed = breed;

   }

   public boolean isVaccinated() {

       return isVaccinated;

   }

   public void setVaccinated(boolean vaccinated) {

       isVaccinated = vaccinated;

   }

}

//A program that creates the Dog Object

class DogTest{

   public static void main(String[] args) {

       //Requesting details of the Dog from User

       System.out.println("Enter Dog year of birth");

       Scanner in = new Scanner(System.in);

       int year = in.nextInt();

       System.out.println("Enter Dog breed");

       String breed = in.next();

       System.out.println("Is Dog vaccinated");

       boolean isVaccinated = in.nextBoolean();

       //Creating an Object of the Dog class

       Dog DogOne = new Dog(year, breed, isVaccinated);

       System.out.println("The Dog's Breed is is "+DogOne.getBreed());

   }

}

Explanation:

Create two class Dog and DogTest

Define all the class members in the Dog class (The three variables, constructor and accessor methods)

Create the main method in the DogTest class, create an instance of the Dog class.

Use scanner class to request the attributes of a new Dog

Assume there is a variable, h that has already been assigned a positive integer value. Write the code necessary to compute the sum of the perfect squares whose value is less than h, starting with 1. (A perfect square is an integer like 9, 16, 25, 36 that is equal to the square of another integer (in this case 3*3, 4*4, 5*5, 6*6 respectively). Assign the sum you compute to the variable q. For example, if h is 19, you would assign 30 to q because the perfect squares (starting with 1) that are less than h are: 1, 4, 9, 16 and 30==1+4+9+16.

Answers

Answer:

import math

h = 19

total = 0

for i in range(1, h):

   if math.sqrt(i) - int(math.sqrt(i)) == 0:

       total += i

print(total)

Explanation:

*The code is in Python.

Initialize the h and total

Create a for loop that iterates from 1 to h. Inside the loop, check if the difference between the square root of a number and the integer part of the square root of that number is equal to 0 (This means the number is a perfect square. For example, if the number is 3, the square root is 1.73 and the integer part of this is 1, the difference is 0.73, not 0. However, if the number is 4, the square root is 2.0 and the integer part is 2, the difference is 0), add that number to the total

When the loop is done, print the total.

Assign True to the variable is_ascending if the list numbers is in ascending order (that is, if each element of the list is greater than or equal to the previous element in the list). Otherwise, assign False with is_ascending.

Answers

Answer:

The question seem incomplete as the list is not given and the programming language is not stated;

To answer this question, I'll answer this question using Python programming language and the program will allow user input.

Input will stop until user enters 0

The program is as follows

newlist = []

print("Input into the list; Press 0 to stop")

userinput = int(input("User Input:"))

while not userinput == 0:

     newlist.append(userinput)

     userinput = int(input("User Input:"))

is_ascending = "True"

i = 1

while i < len(newlist):  

     if(newlist[i] < newlist[i - 1]):  

           is_ascending = "False"

     i += 1

print(newlist)

print(is_ascending)

Explanation:

This line declares an empty list

newlist = []

This line prompts gives instruction to user on how to stop input

print("Input into the list; Press 0 to stop")

This line prompts user for input

userinput = int(input("User Input:"))

This next three lines takes input from the user until the user enters 0

while not userinput == 0:

     newlist.append(userinput)

     userinput = int(input("User Input:"))

The next line initialized "True" to variable is_ascending

is_ascending = "True"

The next 5 line iterates from the index element of the list till the last to check if the list is sorted

i = 1

while i < len(newlist):  

     if(newlist[i] < newlist[i - 1]):  

           is_ascending = "False"

     i += 1

The next line prints the list

print(newlist)

The next line prints the value of is_ascending

print(is_ascending)

You learn that in a previous security breach at GearUp, a disgruntled employee destroyed the encryption key that had been used to protect data. How will you prevent a similar data safeguard problem at GearOn

Answers

Answer:

The data can be safeguarded using key escrow procedure.

Explanation:

Key escrow basically means to store the cryptographic key in an "escrow" by a reputable trusted third party. The copy of the encryption key is kept with the third party. In case the cryptographic key gets lost or destroyed, then the key escrow service helps to access the encrypted data. It also manages the access control to the key in case the key gets lost. So this way in case of security breach at GearOn the key escrow service can be used to re-implement or access the key easily.

JAVA

Write a program that prompts the user to enter a year and the first three letters of a month name (with the first letter in uppercase) and displays the number of days in the month.

If the input for month is incorrect, display a message as shown in the following sample run.


SAMPLE RUN 1:

Enter a year: 2001
Enter a month: Jan
Jan 2001 has 31 days

SAMPLE RUN 2:

Enter a year: 2016
Enter a month: Feb
Feb 2016 has 29 days

SAMPLE RUN 3:

Enter a year: 2016

Enter a month: jan

jan is not a correct month name


Class Name: Exercise04_17

Answers

Answer:

Following are the code to this question:

import java.util.*;//import package for user input

public class Exercise04_17 //defining class Exercise04_17

{

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

{

int y,d=0; //defining integer variable

String m;//defining String variable

Scanner oxc=new Scanner(System.in);//creating scanner class object oxc

System.out.print("Enter a year: ");//print message

y=oxc.nextInt();//input year value which store in y variable

System.out.print("Enter a month: ");//print message

m=oxc.next();//input month value which store in m variable

if(m.equals("Jan")||m.equals("Mar")||m.equals("May")||m.equals("Jul")||m.equals("Aug")||m.equals("Oct")||m.equals("Dec"))//defining if block to check Month value

{

d=31;//assign value in d variable

}

if(m.equals("Apr")||m.equals("Jun")||m.equals("Sep")||m.equals("Nov"))//definingif block to check month value

{

d=30;//assign value in d variable

}

if(m.equals("Feb"))//defining if block to check month value is Feb

{

if(y%4==0||y%400==0)//defining if blook to check leap year

{

d=29;//assign value in d variable

}

else//else block

{  

d=28;//assign value in d variable

}

}

if(d!=0)//defining if block that check d variable value not equal to 0

{

System.out.println(m+" "+y+" has "+d+" days");//print inserted value with message

}

else//else block

{

System.out.println(m+" is not a correct month name");//print message

}

}

}

Output:

please find the attachment.

Explanation:

Description of the code:

In the above code, two integer variable  "d and y" and one string variable "m" are declared, in which the "y and m" variable is used to input the value from the user end. In the y variable, we simply input the value and print its value, but in the m variable, we input the value and used to check its value by using multiple if blocks and in this, we also check leap year value, and then assign value in "d" variable. In the last step, we print input values with the "d" variable value.

Write a class Student() such that it has an attribute 'score' (that is initialized with 10) and three methods: add_score(): adds 10 to the score decrease_score(): decreases score by 10 __str__(): returns the current score (should return a string) Example:

Answers

Answer:

I am writing the Python program. Let me know if you want the program in some other programming language. Here is the Python code:

class Student(object):

   def __init__(a,score=10):

       a.score=score

   def add_score(a,score):

       a.score += 10

       return (score)

   def decrease_score(a,score):

       a.score -=10

       return (score)

   def __str__(a):

       current_score="{}".format(a.score)

       return current_score

Explanation:

The program has a Student() class with attribute score.

It has the following methods:

__init__(): This method works as a constructor and enables to initialize score attribute of Student class. The value of score is initialized to 10. I have used a as the instance of Student class. However self keyword can also be used as an instance of the object to access the attributes and methods of Student class.

add_score() This method is used to add 10 to the score.

decrease_score() This method is used to decrease the score by 10.

__str__() This method is used to return the current score. format() is used here to return a string. current_score holds the value of the current score.

If you want the check the working of the program, then you can use the following statements to see the results on the output screen:

p = Student()

print(p)

p.add_score(p)

print(p)

This will create an object p of Student class and calls the above methods to display the values of the score according to the methods.

The program along with its output is attached.

Classes in Python are used as a layout to create objects.

The Student() class in Python, where comments are used to explain each line is as follows:

#This defines the Student class

class Student(object):

   #The following function initializes score to 10

   def __init__(scr,score=10):

       scr.score=score

   #The following function increases score by 10

   def add_score(scr,score):

       scr.score += 10

       return scr

   #The following function decreases score by 10    

   def decrease_score(scr,score):

       scr.score -=10

       return scr

   #The following function returns the current score as a string    

   def __str__(scr):

       current_score = scr.score

       return current_score

Read more about Python classes at:

https://brainly.com/question/20728426

Write a program whose input is a character and a string, and whose output indicates the number of times the character appears in the string. You may assume that the string does not contain spaces and will always contain less than 50 characters.Ex: If the input is:n Mondaythe output is:1Ex: If the input is:z TodayisMondaythe output is:0Ex: If the input is:n It'ssunnytodaythe output is:2Case matters.Ex: If the input is:n Nobodythe output is:0n is different than N.C++ Code:#include #include int main(void) {/* Type your code here. */return 0;}

Answers

Answer:

Here is the C++ program:

#include <iostream> // to include input output functions

using namespace std; // to identify objects like cin cout

int counter(string userString, char character) { //function counter

   int count = 0;   // counts the no of times a character appears in the string

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

// loop to move through the string to find the occurrence of the character

       if (userString[i] == character) //if characters is found in the string

           count++;   //counts the occurrence of the character in the string

   return count; }   //returns the no of times character occurs in the string

int main() { //start of the main() function body

   string s; // stores the string entered by the user

   cout<<"Enter a string: "; //prompts user to enter the string

   cin>>s; //reads the string from user

   char ch; //stores the character entered by the user

   cout<<"Enter a character: "; //prompts user to enter a character

   cin>>ch; //reads the character from user

   cout << counter(s, ch) << endl; }  

//calls counter function to find the number of times a character occurs in the //string

Explanation:

The counter function works as following:

It has a count variable which stores the number of occurrences of a character in the userString.

It uses a for loop which loops through the entire string.

It has i position variable which starts with the first character of the string and checks if the first character of userString matches with the required character.

If it matches the character then count variable counts the first occurrence of the character and in the userString and is incremented to 1.

If the character does not match with the first character of the userString then the loops keeps traversing through the userString until the end of the userString is reached which is specified by the length() function which returns the length of the string.

After the loop ends the return count statement is used to return the number of occurrences of the character in the userString.

The main() function prompts the user to enter a string and a character. It then calls counter() function passing string s and character ch arguments to it in order to get the number of times ch appears in s.

The output is attached in a screenshot.

10. Which of these is not an HTTP verb? PUT AJAX GET DELETE

Answers

Answer:

Brainliest!

Explanation:

The primary or most-commonly-used HTTP verbs (or methods, as they are properly called) are POST, GET, PUT, PATCH, and DELETE. These correspond to create, read, update, and delete (or CRUD) operations, respectively. There are a number of other verbs, too, but are utilized less frequently.

-

restapitutorial

.

com

AJAX

The word that is not an HTTP verb is AJAX.

But PUT, GET, and DELETE are HTTP verbs.

A HTTP verb is a word or method (it can also be a noun) for retrieving information (documents) in a web-based environment.  There are other HTTP verbs used for various purposes.  The most common include PUT, GET, DELETE, and POST.

HTTP is a computer-based abbreviation that means Hypertext Transfer Protocol.  It is the protocol for transferring data over the web using a client's home computer, laptop, or mobile device.

AJAX, which means Asynchronous Javascript and XML, is mainly used as a technique for creating fast and dynamic web pages using small amounts of data.

There is no suitable reference of HTTP verbs at brainly.com.

The common field cricket chirps in direct proportion to the current tem­perature. Adding 40 to the number of times a cricket chirps in a minute, then dividing by 4, gives us the temperature (in Fahrenheit degrees). Write a program that accepts as input the number of cricket chirps in fifteen seconds, then outputs the current temperature.

Answers

Answer:

chirps = int(input("Enter the number of cricket chirps in fifteen seconds: "))

temperature = chirps + 40

print("The temperature is: " + str(temperature))

Explanation:

*The code is in Python.

Ask the user to enter the number of cricket chirps in fifteen seconds

Use the given formula to calculate the temperature (Note that since the user enters the number of cricket chirps in fifteen seconds, I did not divide the sum by 4)

Print the temperature

In this lab, you declare and initialize constants in a C++ program. The program, which is saved in a file named NewAge2.cpp, calculates your age in the year 2050.

Answers

Answer:

#include <iostream>

using namespace std;

int main()

{

   const int YEAR = 2050;

   int currentYear = 2020;

   int currentAge = 38;

   

   cout<<"You will be " << currentAge + (YEAR - currentYear) << " years old in " << YEAR;

   return 0;

}

Explanation:

Initialize the YEAR as a constant and set it to 2050

Initialize the currentYear as 2020, and currentAge as 38

Calculate and print the age in 2050 (Subtract the currentYear from the YEAR and add it to the currentAge)

python (Business: check ISBN-10) An ISBN-10 (International Standard Book Number) consists of 10 digits: d1d2d3d4d5d6d7d8d9d10. The last digit, d10, is a checksum, which is calculated from the other nine digits using the following formula: (d1 * 1 d2 * 2 d3 * 3 d4 * 4 d5 * 5 d6 * 6 d7 * 7 d8 * 8 d9 * 9) % 11 If the checksum is 10, the last digit is denoted as X according to the ISBN-10 convention. Write a program that prompts the user to enter the first 9 digits and displays the 10-digit ISBN (including leading zeros). Sample Run 1 Enter the first 9 digits of an ISBN as a string: 3601267 Incorrect input. It must have exact 9 digits Sample Run 2 Enter the first 9 digits of an ISBN as a string: 013601267 The ISBN-10 number is 0136012671 Sample Run 3 Enter the first 9 digits of an ISBN as a string: 013031997 The ISBN-10 number is 013031997X

Answers

Answer:

The programming language is not stated;

However, I'll answer this question using C++ programming language

The program uses few comments; See explanation section for more detail

Also, the program assumes that all input will always be an integer

#include<iostream>

#include<sstream>

#include<string>

using namespace std;

int main()

{

string input;

cout<<"Enter the first 9 digits of an ISBN as a string: ";

cin>>input;

//Check length

if(input.length() != 9)

{

 cout<<"Invalid input\nLength must be exact 9";

}

else

{

 int num = 0;

//Calculate sum of products

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

{

 num += (input[i]-'0') * (i+1);    

}

//Determine checksum

if(num%11==10)

{

 input += "X";

 cout<<"The ISBN-10 number is "<<input;

}

else

{

 ostringstream ss;

 ss<<num%11;

 string dig = ss.str();

 cout<<"The ISBN-10 number is "<<input+dig;

}

}  

 return 0;

}

Explanation:

string input;  -> This line declares user input as string

cout<<"Enter the first 9 digits of an ISBN as a string: ";  -> This line prompts the user for input

cin>>input;  -> The user input is stored here

if(input.length() != 9)  { cout<<"Invalid input\nLength must be exact 9";  }  -> Here, the length of input string is checked; If it's not equal to then, a message will be displayed to the screen

If otherwise, the following code segment is executed

else  {

int num = 0; -> The sum of products  of individual digit is initialized to 0

The sum of products  of individual digit is calculated as follows

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

{

num += (input[i]-'0') * (i+1);

}

The next lines of code checks if the remainder of the above calculations divided by 11 is 10;

If Yes, X is added as a suffix to the user input

Otherwise, the remainder number is added as a suffix to the user input

if(num%11==10)  {  input += "X";  cout<<"The ISBN-10 number is "<<input; }

else

{

ostringstream ss;

ss<<num%11;

string dig = ss.str();

cout<<"The ISBN-10 number is "<<input+dig;

}

}  

Create a class ProblemSolution with following characteristics Two private member variables name & designation of string type. Parameterized constructor which takes 2 parameters to initialized name & designation. Method solution with no input parameter and void return type. A method should print the member variable values in new lines.

Answers

Answer:

Please see the attachment for the solution

Explanation:

Type a statement using srand() to seed random number generation using variable seedVal. Then type two statements using rand() to print two random integers between (and including) 0 and 9. End with a newline. Ex: #include < iostream > #include < cstdlib > // Enables use of rand() #include < ctime > // Enables use of time() using namespace std: int main() { int seedVal = 0 /* Your solution goes here */ return 0: }

Answers

Answer:

Replace /* Your solution goes here */ with the following code segment

srand(seedVal);

cout<<rand()%(int)(9 - 0 + 1) + 0<<endl;

cout<<rand()%(int)(9 - 0 + 1) + 0<<endl;

Explanation:

From the code segment, the seedVal has already been declared and initialized to 0; The next step is to seed it as random number using srand.

The first line of the code segment in the Answer section "srand(seedVal); " is used to achieve that task.

Having done that, the next step is to write statements to generate the two random numbers using rand();

When generating random numbers, two things are to be noted;

The lower bound; LThe upper bound; U

Here, the lower bound is 0 and the upper bound is 9;

C rand() function uses the following syntax to generate random numbers

rand()%(int)(U - L + 1) + L

Where U = 9 and L = 0

Replacing U and L with there respective values; the syntax becomes

rand()%(int)(9 - 0 + 1) + 0

So, the two print statements will be written as

cout<<rand()%(int)(9 - 0 + 1) + 0;

Also, the question states that, each print statement be ended with a new line;

So, the print statements will be

cout<<rand()%(int)(9 - 0 + 1) + 0<<endl;

Alternatively, by solving (9 - 0 + 1) + 0; the statements can be written as

cout<<rand()%(int)(10)<<endl;

Conclusively, the complete statements is as follows;

srand(seedVal);

cout<<rand()%(int)(9 - 0 + 1) + 0<<endl;

cout<<rand()%(int)(9 - 0 + 1) + 0<<endl;

or

srand(seedVal);

cout<<rand()%(int)(10)<<endl;

cout<<rand()%(int)(10)<<endl;

if you want to exclude a portion of an image which option should be chosen?? A. Arrange B. Position C. Crop D. Delete

Answers

It would be C- crop. This allows you to specifically delete parts of the image using drag and drop features. Hope this helps!

During a traceroute, which action does a router perform to the value in the Time To Live (TTL) field?

Answers

Answer:

During a traceroute, the router decreases the Time To Live values of the packet sent from the traceroute by one during routing, discards the packets whose Time To Live values have reached zero, returning the ICMP error message ICMP time exceeded.

Explanation:

Traceroute performs a route tracing function in a network. It is a network diagnostic commands that shows the path followed, and measures the transit delays of packets across an Internet Protocol (IP) network, from the source to the destination, and also reports the IP address of all the routers it pinged along its path. During this process, the traceroute sends packets with Time To Live values that increases steadily from packet to packet; the process is started with Time To Live value of one. At the routers, the Time To Live values of the packets is gradually decreased by one during routing, and the packets whose Time To Live values have reached zero are discarded, returning the ICMP error message ICMP Time Exceeded

DEF is a small consulting firm with ten on-site employees and 10 to 12 part-time (off-site) software consultants. Currently, the network consists of 2 servers for internal business processes, 1 server that handles the call-in connections; 10 on-site wireless workstations/devices, and 2 printers. Respond to the following in a minimum of 175 words: Identify one network security strategy that would help this organization. Why did you choose this strategy over others

Answers

Answer:

What i would suggest for the organization is to use the Testing Infrastructure strategy. it is good for your consulting firm because it is less costly and provide security.

Explanation:

Solution

There are different network security strategy which is listed below:

Segment the network:

Segmentation in network is very useful for providing security.If any threat is occur only one segment is effected remaining are safe and it is less cost process. very useful for small organizations.

Test your infrastructure :

Testing infrastructure also very good technique.

Always we have to test our infrastructure whether threat is occur or not.

If any threat is happen we can detect that easily by testing our infrastructure.

Regularly update anti-virus software :

This is very useful for small organizations and it is less cost.with less cost we can provide security for all devices like computer,server,modems etc.

Frequently backup your critical data :

This is very good technique for crucial data.If we backup important data any time that will be useful if any attack is happen.

This is less costs and simple.

Change router default security settings :

Changing router password and settings also helpful for providing security.If we maintain same password and same settings for a long time that may lead to data hacking.It is cost less process very useful for small organizations.

Most programming languages provide loop statements that help users iteratively process code. In Coral you can write loops that handle many situations. What is the logic behind using a loop statement

Answers

Answer:

Explanation:

When programming loop statements are essential as they allow you to repeat a certain action various times without having to rewrite the same code over and over again for the number of times you want it to repeat. This drastically simplifies the code and saves on computer memory. Loop statements are written so that the same code repeats itself until a pre-set condition is met.

Other Questions
PLEASE HELP ASAP!!Determine the value of k that would make these two functions inverses. The cost of each white tile was 2 the cost of each blue tile was 4 pounds work out the ratio of the total cost of the white tiles to the total of the blue tiles Sociology is the study of plz and thank youWhich file type is used when forwarding a contact as a business card to another user to share their information?O PSTO CSVO XMLO VCF Leleti believes that her friend spilled soda all over her backpack in order to get revenge for a remark Leleti made a few days ago, even though her friend claims that the incident was an accident. Leleti is making a: Jake paid $40.50 per solar panel for eight panels and an additional installation fee for a total of $338.50. Jen paid $42.99 per panel for eight panels and an additional installation fee for a total of $354.42. Find the difference between the installation fees Jake and Jen paid. Triangle JKL is similar to triangle TUV. Find the missing side length of triangle TUV. A. 10.6 B. 6C. 6.2 D. 5.8 use the squared identities to simplify 2sin^2xsin^2x A cart of mass 350 g is placed on a frictionless horizontal air track. A spring having a spring constant of 7.5 N/m is attached between the cart and the left end of the track. The cart is displaced 3.8 cm from its equilibrium position. (a) Find the period at which it oscillates. s (b) Find its maximum speed. m/s (c) Find its speed when it is located 2.0 cm from its equilibrium position. The null hypothesis for this ANOVA F test is: the population mean load failures for the three etch times are all different the population mean load failure is lowest for the 15second condition and highest for 60second condition at least one population mean load failure differs the sample mean load failure is lowest for the 15second condition and highest for 60second condition the sample mean load failures for the three etch times are all different the population mean load failures for the three etch times are all equal I'd greatly appreciate the help- to compare the way two different texts present similar ideas. similarities and differences between jim hawkins and long jhon silver. all each amendment with the substantive right it protects.First Amendmentfreedom from housing soldiersSecond Amendmentthe right to own a weaponThird Amendmentfreedom of expression Use the following Window Breeze Company income statement to answer the question. Window Breeze Company is a small manufacturer of window air conditioners and reported the following: Window Breeze Company Full Costing Income Statement For the Year Ending December 31, 2011 Sales ($150 per unit) $120,000 Less cost of goods sold 35,000 Gross margin 85,000 Less selling and administrative expenses: Selling expense $15,000 Administrative expense 15,000 30,000 Net income $55,000 Annual FMOH was $25,000 and 1,000 units were produced. All administrative costs were fixed. Included in the $15,000 selling expense was $10,000 of fixed selling. The following questions will test your knowledge of comma usage. Identify the comma error(s) in the following sentences and choose the best revision.1. Although you may not have received the e-mail we have been informed that the division head of the Finance Department is leaving at the end of the month. A. Although you may not have received the e-mail, we have been informed, that the division head of the Finance Department is leaving, at the end of the month. B. Although you may not have received the e-mail, we have been informed that the division head of the Finance Department is leaving at the end of the month. C. Although you may not have received the e-mail we have been informed, that the division head of the Finance Department, is leaving at the end of the month.2. The young project manager lacked communication skills but he was intelligent well-spoken and precise.A. The young project manager lacked communication skills; but he was intelligent, well-spoken and precise.B. The young project manager lacked communication skills, but he was intelligent well-spoken and precise.C. The young project manager lacked communication skills, but he was intelligent, well-spoken, and precise.3. The invoice should be sent to Ventura Communications 58 Jackrabbit Avenue Suite 10 Phoenix AZ 85745 no later than March 4 2008.A. The invoice should be sent to Ventura Communications 58 Jackrabbit Avenue Suite 10 Phoenix AZ 85745, no later than March 4, 2008.B. The invoice should be sent to Ventura Communications, 58 Jackrabbit Avenue, Suite 10, Phoenix, AZ 85745, no later than March 4, 2008. C. The invoice should be sent to Ventura Communications 58 Jackrabbit Avenue Suite 10, Phoenix, AZ 85745 no later than March, 4 2008.4. Which of the following sentences are correctly punctuated? A. All participants must sign in register their vehicles and report to their assigned locations before 7:30 am.B. Not one employee was willing to sit at the desk, that had belonged to the man who turned out to be a serial killer. C. Maurice listened to the team's proposals and then he promptly turned them down. D. When she returned to work after maternity leave, she learned that her office had been relocated to the second floor.E. Please submit your expense report proposal before October 15, 2008 In database transaction concurrency, the lost update anomaly is said to occur if a transaction Tj reads a data item, then another transaction Tk writes the data item (possibly based on a previous read), after which Tj writes the data item. The update performed by Tk has been lost, since the update done by Tj ignored the value written by Tk a. Give an example of a sequence showing the lost update anomaly b. Give an example sequence to show that the lost update anomaly is possible with the read committed isolation level. c. Explain why the lost update anomaly is not possible with the repeatable read isolation level. 100 PointsRead the following excerpt from the article "Vision, Voice and the Power of Creation: An Author Speaks Out," by T. A. Barron and answer the question that follows:Right now, I am spending a lot of time listening to the voice of a particularly compelling character: the young Merlin. In the end, I finally heard the voice of Merlin thanks to a surprising source: the haunting, mysterious hooting of a great horned owl outside the window of my Colorado home. As I listened to that owl's resonant [echoing] call in the pre-dawn hours one morning, something about it gave me a whole new cadence [rhythm], a whole new sound. And then, a whole new voice.In this paragraph, what is the author's explicit message about his inspiration for Merlin's voice? He had difficulty finding Merlin's voice. His inspiration was the owl outside his window. His old ideas were not working for Merlin's voice. He spent a lot of time thinking about Merlin's voice. What primary sources can I use for the great gatsby? I have to write an analyical essay and can't find a primary source. I already know about the great depression and can't use the novel as a primary source. A bank is earning 6 percent on its $150 million in earning assets and is paying 4.75 percent on its liabilities. The bank's interest rate spread is __________. Multiple Choice 1.25 percent 1.26 percent 4.75 percent 6.00 percent 10.75 percent