answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Black_prince [1.1K]
2 years ago
13

Write an application that allows a user to enter the names and birthdates of up to 10 friends. Continue to prompt the user for n

ames and birthdates until the user enters the sentinel value ZZZ for a name or has entered 10 names, whichever comes first. When the user is finished entering names, produce a count of how many names were entered, and then display the names. In a loop, continuously ask the user to type one of the names and display the corresponding birthdate or "Sorry, no entry for name" if the name has not been previously entered. The loop continues until the user enters ZZZ for a name.
Computers and Technology
1 answer:
baherus [9]2 years ago
7 0

Answer:

<em>Written in Python</em>

names= []

birthday = []

name = input("Name: ")

bday = input("Birthday: ")

for i in range(1,11):

    names.append(name)

    birthday.append(bday)

    if name == "ZZZ":

         break;

    else:

         name = input("Name: ")

         bday = input("Birthday: ")

print("Length: ", end='')

print(len(names))

checknm = input("Check Name: ")

while checknm != "ZZZ":

    if checknm in names:

         ind = names.index(checknm)

         print(birthday[ind])

    else:

         print("Sorry, no entry for name")

    checknm = input("Check Name: ")

Explanation:

<em>The program is written in Python and I've added the full source code as an attachment where I used comments to explain difficult lines</em>

<em />

Download txt
You might be interested in
The birthday paradox says that the probability that two people in a room will have the same birthday is more than half, provided
poizon [28]

Answer:

The Java code is given below with appropriate comments for explanation

Explanation:

// java code to contradict birth day paradox

import java.util.Random;

public class BirthDayParadox

{

public static void main(String[] args)

{

   Random randNum = new Random();

   int people = 5;

   int[] birth_Day = new int[365+1];

   // setting up birthsdays

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

       birth_Day[i] = i + 1;

 

   int iteration;

   // varying number n

   while (people <= 100)

   {

       System.out.println("Number of people: " + people);

       // creating new birth day array

       int[] newbirth_Day = new int[people];

       int count = 0;

       iteration = 100000;

       while(iteration != 0)

       {

           count = 0;

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

           {

               // generating random birth day

               int day = randNum.nextInt(365);

               newbirth_Day[i] = birth_Day[day];

           }

           // check for same birthdays

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

           {

               int bday = newbirth_Day[i];

               for (int j = i+1; j < newbirth_Day.length; j++)

               {

                   if (bday == newbirth_Day[j])

                   {

                       count++;

                       break;

                   }

               }

           }

           iteration = iteration - 1;

       }

       System.out.println("Probability: " + count + "/" + 100000);

       System.out.println();

       people += 5;

   }

}

}

4 0
2 years ago
Use the ________ method to write text to a web page.
Nastasia [14]
Document.write()

I'm not sure that this is a method, but I think this is right. 
3 0
2 years ago
You are asked to check your company’s configurations to determine if any filters should be built to stop certain ICMPv6 traffic.
DedPeter [7]

ICMPv6 is used by IPv6 nodes to report errors encountered in processing packets, and to perform other internet-layer functions, such as diagnostics.  An Internet Control Message Protocol (ICMP) flood attack, also known as a Ping flood attack, is a common Denial-of-Service (DoS) attack in which an attacker attempts to overwhelm a targeted device with ICMP echo-requests.

Explanation:

Issues that are of concern which could be a problem include :

Denial-of-Service Attacks  

  • ICMPv6 can be used to cause a denial of service (DoS) in a number of  ways, including simply sending excessive numbers of ICMPv6 packets to destinations in the site and sending error messages that disrupt  established communications by causing sessions to be dropped.

Probing

  • A major security consideration is preventing attackers from probing  the site to determine the topology and identify hosts that might be vulnerable to attack.  Carefully crafted but, often, malformed  messages can be used to provoke ICMPv6 responses from hosts thereby  informing attackers of potential targets for future attacks.  However, the very large address space of IPv6 makes probing a less effective weapon as compared with IPv4 . Redirection Attacks

Redirection Attacks

  • A redirection attack could be used by a malicious sender to perform  man-in-the-middle attacks or divert packets either to a malicious  monitor or to cause DoS by blackholing the packets.  These attacks would normally have to be carried out locally on a link using the Redirect message.  Administrators need to decide if the improvement  in efficiency from using Redirect messages is worth the risk of  malicious use.  Factors to consider include the physical security of   the link and the complexity of addressing on the link

Renumbering Attacks

  • Spurious Renumbering messages can lead to the disruption of a site.  Although Renumbering messages are required to be authenticated with  IPsec, so that it is difficult to carry out such attacks in practice,  they should not be allowed through a site boundary firewall.  On the  other hand, a site may employ multiple "layers" of firewalls.

Problems Resulting from ICMPv6 Transparency

  • Because some ICMPv6 error packets need to be passed through a  firewall in both directions, malicious users can potentially use  these messages to communicate between inside and outside, bypassing  administrative inspection.

Packet types or specific circumstances in which ICMPv6 traffic could compromise network security :

Ping sweep — A type of attack that uses ICMP echo request messages to enumerate live hosts on a network.

Ping flood — Utilized to launch a denial of service attack (DoS), where the attacker sends ICMP requests in a rapid succession without waiting for the targeted system to respond.

ICMP tunneling — A method used to establish a covert communication channel between remote systems, most times between a client and a proxy. All communications are sent via ICMP requests and replies

Forged ICMP redirects —  The attacker would send a ICMP redirect message, which informs a host of a direct path to a destination, to the victim that contains the IP addresses of the attacker’s system. This allows an attacker to compromise network traffic via a man-in-the-middle attack or cause a DoS.

8 0
2 years ago
Your employer, yPlum Corporation is manufacturing two types of products: Mirabelle smartphone, and Blackamber laptop. The compan
Sever21 [200]

Answer:

See explaination

Explanation:

No of Mobiles=x1

No of Work stations=x2

Constraints:

50x1+70x2<=1,60,000

250x1+700x2 <= 1,20,00,000

x1>=0 x2>=0

Objective function N(x1,x2)= 7800000000 x1+ 7200000000 x2

Excel formulae:

G17 =D9*E7+F9*G7

G18= D10*E7*F10*G7

G19=E7

G20=G7

G21= I17*E7+I18*G7 (This will be Maximum)

And E7 and G7 will be solution.

Prepare sheet as shown in diagram and set the formulae.

Go to tool and select solver. Solver dialog will open, select ‘Assume Linear model’ and ‘assume non-negative’. Click solve model and click keep solution.

See attachment.

7 0
2 years ago
g 18.6 [Contest 6 - 07/10] Reverse an array Reversing an array is a common task. One approach copies to a second array in revers
Blababa [14]

Answer:

I am writing C++ program. Let me know if you want the program in some other programming language.  

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

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

void reverse(int array[], int size){ //method to reverse an array  

int i, j, temp; //declare variables  

for (i = 0; i < size / 2; i++) { /* the loop swaps the first and last elements, then swap the second and second-to-last elements and so on until the middle of the array is reached */  

temp = array[i];  

array[i] = array[size - i - 1];  

array[size - i - 1] = temp; }  

cout<<"Reversed array: "; //prints the resultant reversed array after swapping process  

for (j = 0; j < size; j++) { //loop to print the reversed array elements  

cout<<array[j]<<" "; } }    

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

cout<<"Enter the length of array: "; //prompts user to enter the length of the array

       int n; //stores the value of size of array

       cin>>n; //reads the input size of array

       int A[n]; //declare array A of size n

       cout<<"Enter the elements: "; //prompts user to enter array elements

       for(int i=0;i<n;i++){ //loop for reading the elements of array

           cin >> A[i];        }

         reverse(A,n); } //calls reverse function to reverse the elements of the input array A by passing array A and its length n to function reverse

Explanation:  

The reverse function takes an array and its length as parameter. In the body of reverse function three integer type variables i,j and temp are declared.

for (i = 0; i < size / 2; i++) The for loop has a variable to iterate through the array. The for loop checks if the value of i is less than the array length. Lets say we have an array of elements 1, 2, 3, 4. As i=0 and size/2 = 4/2= 2. So the condition checked in for loop is true as 0<2 which means the body of for loop will be executed.

In the body of the loop there are three swap statements.

temp = array[i] This statement stores the element of array at i-th index to temp variable.

array[i] = array[size - i - 1] statement stores the element of array at size-i-1 to array index i.  

array[size - i - 1] = temp statement stores the the value in temp variable to the array index size-i-1

In simple words first, the first and last elements of array are swapped, then the second and second last elements are swapped. This process keeps repeating and for loop keeps executing these swap statements until the middle of the array is reached. In this program no extra array is used for reversing procedure but just a variable temp is used to hold the array elements temporarily.

array[4] = { 1 , 2 , 3 , 4}  

At first iteration  

i < size/2 is true as 0<2  

So the program control moves in the body of the loop where three swap statement works as following:  

temp = array[i]  

temp = array[0]  

As element at 0-th index which is the first element of array is 1 so

temp= 1  

array[i] = array[size - i - 1];  

array[0] = array[4-0-1]  

           = array[3]  

As the element at 3rd index of array is 4 which is the last element of the array so

array[0] = 4

This means that 4 becomes the first element of array now.

array[size - i - 1] = temp  

As the value in temp was set to 1 so  

array[4-0-1] = 1  

array[3] = 1  

This means 1 is assigned to the 3rd index of array. Which means 1 becomes the last element of the array now.

This is how the first and last elements of array are swapped.  

2nd iteration: value of i is incremented to 1 and now i = 1  

Again for loop condition is checked which evaluates to true as 1<2

temp = array[i]  

temp = array[1]  

As element at 1st index which is the second element of array is 2 so

temp= 2  

array[i] = array[size - i - 1];  

array[1] = array[4-1-1]  

           = array[2]  

As the element at second index of array is 3 which is the last element of the array so

array[1] = 3  

This means that 3 becomes the second element of array now.

array[size - i - 1] = temp  

As the value in temp was set to 2 so  

array[4-1-1] = 2  

This means 2 is assigned to the 2nd index of array. Which means 2 becomes the second last element of the array now.

This is how the second and second to last elements of array are swapped.  

3rd iteration: value of i=2 The for loop body will not execute now as the for loop condition i<size-2 evaluates to false because 2=2. So the loop stops and next for (j = 0; j < size; j++) loop iterates through array[] which has now been reversed and print the elements of this reversed array.

Next the main() method passes length of the array and the array elements to the   reverse function and prints these elements in reverse.  

The output is:

4  3 2  1  

The program and output according to the example 2,5,9,7 given in the question is attached as a screenshot.

3 0
2 years ago
Other questions:
  • Which description of the plain text file format is most accurate?
    11·2 answers
  • A remediation liaison makes sure all personnel are aware of and comply with an organization's policies.
    9·1 answer
  • Write a program that asks the user to input an integer that is a perfect square. A perfect square is an integer that is equal to
    14·1 answer
  • Write a class called Counter that represents a simple tally counter, which might be used to count people as they enter a room. T
    9·1 answer
  • Define a function CoordTransform() that transforms its first two input parameters xVal and yVal into two output parameters xValN
    6·2 answers
  • You are a technical consultant for many businesses in your community. One of your clients, a small law firm, has a single Active
    14·1 answer
  • For any element in keysList with a value greater than 50, print the corresponding value in itemsList, followed by a space. Ex: I
    8·1 answer
  • A distribution of software that simplifies administration by identifying dependencies, automatically updating configuration file
    11·1 answer
  • Terry came into work and turned on his computer. During the boot process, the computer shut down. When he tried again, the compu
    10·1 answer
  • Which statement accurately describes the clutter feature in outlook 2016
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!