Create a Time Conversion application that prompts the user for a time in minutes and then displays the time in hours and minutes. Be sure to consider times whether the number of minutes left over is less than 10. For example, 184 minutes in hour:minute format is 3:04 (Hint: use the modulus operator). The application output should look similar to:

Answers

Answer 1

Answer:

The following are the program in the Java Programming Language.

//import the following class

import java.util.Scanner;

//define class

public class TimeConversion  

{

 //define main function

 public static void main(String[] args)  

 {

   //create the object of the scanner class

   Scanner s = new Scanner(System.in);

   //print message

   System.out.println("Enter the minutes: ");

   //get input in the variable

   int t=s.nextInt();

   //initialize in the variable

   int hr=t/60;

   //initialize in the variable    

   int min=t%60;

   //declare the string type variable

   String result;

   //initialize in the variable

   result=""+hr;

   //check that the variable is less than 10

   if(min<10)

     //then, initialize this

     result=result +":0"+min;

   //otherwise

   else

     //initialize this

     result=result +":"+min;

   //print the result

   System.out.println(result);

 }

}

Output:

Enter the minutes:

184

3:04

Explanation:

The following are the description in the program.

Firstly, import the scanner class and define the class 'TimeConversion', inside the class, we define the main method and inside the main method. Create the object of the scanner class 'c' and then get input from the user in the variable 't' through the scanner class object. Then, declare the variable 'hr' and initialize the value input divided by 60. Declare the variable 'min' and initialize the value input mod by 60. Declare the string data type variable 'result' then, check that the variable 'min' is less than 10 then, initialize the following format in the variable 'result' and otherwise the initialize the other formate in the variable 'result'. Finally, we print the variable 'result'.
Answer 2
Final answer:

To create a Time Conversion application that prompts the user for a time in minutes and displays the time in hours and minutes, you can use the modulus operator and format the output using String.format().

Explanation:

To create a Time Conversion application, you can use the modulus operator to calculate the number of hours and minutes. Here is an example of how you can do this:


import java.util.Scanner;

public class TimeConversion {
   public static void main(String[] args) {
       Scanner scanner = new Scanner(System.in);

       System.out.print("Enter time in minutes: ");
       int totalMinutes = scanner.nextInt();

       int hours = totalMinutes / 60;
       int minutes = totalMinutes % 60;

       System.out.println("Time in hour:minute format is " + hours + ":" + String.format("%02d", minutes));
   }
}

In this example, the total number of minutes entered by the user is divided by 60 to get the number of hours. The modulus operator (%) is used to find the remaining number of minutes. The String.format("%02d", minutes) is used to ensure that the minutes are displayed with two digits if it is less than 10.

Learn more about Time Conversion Application here:

https://brainly.com/question/35896621

#SPJ3


Related Questions

A Layer 2 firewall is also called a(n) _____. Group of answer choices

packet-filtering router
bastion host
packet-filtering bridge
application-level gateway
circuit-level gateway

Answers

Answer:

packet-filtering bridge

Explanation:

A Layer 2 transparent firewall operates on bridged packets and is enabled on a pair of locally-switched Ethernet ports. Embedded IP packets forwarded through these ports are inspected similar to normal IP packets in a routing network.

The following data fragment occurs in the middle of a data stream for which the byte-stuffing algorithm is used: A B ESC C ESC FLAG FLAG D. What is the output after stuffing?

Answers

Byte-stuffing is applied to the data stream 'A B ESC C ESC FLAG FLAG D', resulting in the stuffed output 'A B ESC ESC C ESC ESC ESC FLAG ESC FLAG ESC FLAG D'.

The question is about byte-stuffing which is a technique used in data transmission to distinguish data from control information. In byte-stuffing, special bytes like ESC (escape) and FLAG are inserted into the data stream to encode occurrences of these bytes in the data. Considering the data fragment 'A B ESC C ESC FLAG FLAG D' and assuming ESC is used to escape control bytes, and FLAG is a control byte, the output after stuffing would be 'A B ESC ESC C ESC ESC ESC FLAG ESC FLAG ESC FLAG D'. This ensures that the receiver can differentiate between actual data and control bytes.

When you need to discipline employees, it is important to discipline different employees differently for the same policy violation in order to prevent them from becoming complacent. It is necessary to work independently from the human resources department and create your own procedures.

Answers

Answer: False

Explanation:

Employees should be discipline same way for same policy violations. This will give the employees the impression that no one was cheated or given preferential treatment. Everyone gets same stroke for same offence. The human resources department can't be do away with. They are the ones in charge of employees.

Final answer:

Disciplining employees should be consistent and fair, in line with established company policies and procedures in collaboration with the human resources department. Formal sanctions are part of disciplinary actions, while maintaining open communication and problem-solving focus. It is also critical to handle serious infractions with urgency and proper protocol.

Explanation:

Disciplining Employees and Workplace Policies

When it comes to disciplining employees, consistency and fairness are key principles. It is a misconception that disciplining different employees differently for the same policy violation prevents complacency; instead, it may create perceptions of unfairness and preferential treatment, which can demoralize staff and lead to bigger issues within the workplace. All disciplinary actions should adhere to the established procedures, working in concert with the human resources department, to ensure that the actions are legally defensible and align with company values and policies.

Employees must understand the expectations set for them and the potential consequences of failing to meet those standards. Formal sanctions such as termination or suspension are tools that can be used to enforce norms and deter rule-breaking behavior. Additionally, it is crucial to focus on problem-solving and open communication when addressing issues; this encourages a culture of accountability and improvement. Demonstrating respect for authority and offering exceptional customer service are behaviors that should be modeled and encouraged within the workplace.

It is also important to recognize the impact of personal relationships in small groups, where informal checks and balances often operate alongside formal mechanisms to regulate behavior. Nonetheless, serious infractions that endanger others, such as workplace violence, need immediate attention and should be handled with the appropriate urgency and procedure, often involving supervisors or security personnel.

What subnet mask or CIDR notation would be required to maximize the host counts while still meeting the following requirements: 192.168.228.0 255.255.255.128 Required Networks: 2 Required Hosts: 20

Answers

Answer:

192.168.228.0 255.255.255.224

Explanation:

192.168.228.0 255.255.255.128

subnet mask: defines the host and the network part of a ip

CIDR notation : is the shortened form for subnet mask that uses the number of host bits for defining the host and the network part of a ip

For example: 192.168.228.0 255.255.255.128 has CIDR equivalent of 192.168.228.0\25

To have atleast 20 hosts

20 ≤ (2^x) -2

x ≈5

with 5 host bits, we have 2^5-2 = 30 hosts per subnet

and 2^3 = 8 subnets

To get the subnet mask, we have 3 network bits

1110000 to base 10 = 2^7 + 2^6 +2^5= 224

192.168.228.0 255.255.255.224

The purpose of this programming project is to demonstrate a significant culmination of most constructs learned thus far in the course. This includes Lists, Classes, accessors, mutators, constructors, implementation of Comparable, Comparator, use of Collections sort, iterators, properly accessing fields of complex objects, and fundamental File I/O.

You will create a LinkedList of Word objects using all the words found in the input file words.txt. A Word object contains 2 String fields; 1 to store a word in its normal form and the other to store a word in its canonical form. The canonical form stores a word with its letters in alphabetical order, e.g. bob would be bbo, cat would be act, program would be agmoprr, and so on. The class Word constructor has the responsibility of storing the normal form of the word in the normal form field and converting the normal form into the canonical form which is stored in the canonical form field (you should call a separate method for this conversion purpose).

Once all the words from the input file have been properly stored in a LinkedList of Word, you should use Collections to sort this list ascending alphabetically based on the canonical words by making the Word class Comparable.

Using an Iterator on the LinkedList of Word, create a 2nd list (new LinkedList) consisting of objects of a new class named AnagramFamily. AnagramFamily should contain at least 2 fields; 1 to hold a list of "Word" words that are all anagrams of each other (these should all be grouped together in the original canonical sorted list), and the 2nd field to store an integer value of how many items are in the current list. (Keep in mind, because the original list contains both the normal and canonical forms, as the AnagramFamily List will also have, a family of anagrams will all have the same canonical form with different normal forms stored in the normalForm field of the Word class). Each AnagramFamily List of Word should be sorted Descending by normal form using a Comparator of Word (if you insert Word(s) into a family one at a time, this presents an issue on how to get this list sorted as each Word insertion will require a new sort to be performed to guarantee the list is always sorted. For this reason it is best to form a list, sort it, and then create an AnagramFamily by passing the sorted list to it).

Sort the AnagramFamily LinkedList in descending order based on family size by use of a Comparator to be passed to the Collections sort method.

Next, output the top five largest families then, all families of length 8, and lastly, the very last family stored in the list to a file named "out6.txt." Be sure to format the output to be very clear and meaningful.

Finally, the first 4 people to complete the assignment should post their output results to the Canvas discussion forum for the remaining students to see the correct answer.

Be sure to instantiate new objects whenever transferring data from one object to another. Also, be sure to include various methods for manipulation and access of fields as well as helper methods to reduce code in main, such as the input/output of file data (like all other assignments, you will be graded on decomposition, i.e. main should not contain too many lines of code).

Part of your grade will depend on time. If written correctly (use of iterators and care taken when creating the anagram families), the running time should be less than 3 seconds. Programs that take longer will lose points based on the time. As encouragement to consider all options for speed, programs taking 1 minute will receive a 40 point deduction. Any longer than 3 minutes will receive only minimal points (10) for effort.

Though the basic algorithms involved are straight forward enough, there is a great deal of complexity involved with various levels of access to specific data. As mentioned before and never so importantly as with this assignment, start early and set a goal for completion by this weekend. Trust me, this is sound advice.

As a reminder, you will create at least 5 files: the driver, Word class, AnagramFamily class, and 2 comparators: 1 to compare Word objects for sorting descending based on the normal form of Word objects and 1 to compare AnagramFamily sizes for a descending sort.

Answers

Answer:

Java program explained below

Explanation:

here is your files : ----------------------

Word.java : --------------

import java.util.*;

public class Word implements Comparable<Word>{

private String normal;

private String canonical;

public Word(){

 normal = "";

 canonical = "";

}

public Word(String norm){

 setNormal(norm);

}

public void setNormal(String norm){

 normal = norm;

 char[] arr = norm.toCharArray();

 Arrays.sort(arr);

 canonical = new String(arr);

}

public String getNormal(){

 return normal;

}

public String getCanonical(){

 return canonical;

}

public int compareTo(Word word){

 return canonical.compareTo(word.getCanonical());

}

public String toString(){

 return "("+normal+", "+canonical+")";

}

}

AnagramFamily.java : ------------------------------

import java.util.*;

public class AnagramFamily implements Comparable<AnagramFamily>{

private LinkedList<Word> words;

private int size;

private class WordComp implements Comparator{

 public int compare(Object o1,Object o2){

  Word w1 = (Word)o1;

  Word w2 = (Word)o2;

  return w2.getNormal().compareTo(w1.getNormal());

 }

}

public AnagramFamily(){

 words = new LinkedList<>();

 size = 0;

}

public LinkedList<Word> getAnagrams(){

 return words;

}

public void addAnagram(Word word){

 words.add(word);

 size++;

}

public void sort(){

 Collections.sort(words,new WordComp());

}

public int getSize(){

 return size;

}

public int compareTo(AnagramFamily anag){

 Integer i1 = new Integer(size);

 Integer i2 = new Integer(anag.getSize());

 return i2.compareTo(i1);

}

public String toString(){

 return "{ Anagrams Family Size : "+size+" "+words.toString()+"}";

}

}

WordMain.java : ------------------------------

import java.util.*;

import java.io.File;

import java.io.PrintWriter;

public class WordMain{

public static void readFile(LinkedList<Word> words){

 try{

  Scanner sc = new Scanner(new File("words.txt"));

  while(sc.hasNext()){

   words.add(new Word(sc.next()));

  }

  sc.close();

 }catch(Exception e){

  e.printStackTrace();

  System.exit(-1);

 }

}

public static void findAnagrams(LinkedList<AnagramFamily> anagrams,LinkedList<Word> words){

 Iterator<Word> itr = words.iterator();

 while(itr.hasNext()){

  Iterator<AnagramFamily> aitr = anagrams.iterator();

  Word temp = itr.next();

  System.out.println(temp);

  boolean st = true;

  while(aitr.hasNext()){

   AnagramFamily anag = aitr.next();

   Iterator<Word> anags = anag.getAnagrams().iterator();

   while(anags.hasNext()){

    Word t1 = anags.next();

    if(t1.compareTo(temp) == 0 && !t1.getNormal().equals(temp.getNormal())){

     anag.addAnagram(temp);

     st = false;

     break;

    }

   }

   anag.sort();

  }

  if(st){

   AnagramFamily anag = new AnagramFamily();

   anag.addAnagram(temp);

   anagrams.add(anag);

   System.out.println(anag);

  }

 }

}

public static void writeOutput(LinkedList<AnagramFamily> anagrams){

 try{

  PrintWriter pw = new PrintWriter(new File("out6.txt"));

  Collections.sort(anagrams);

  int i = 0;

  Iterator<AnagramFamily> aitr = anagrams.iterator();

  while(i < 5 && aitr.hasNext()){

   AnagramFamily anag = aitr.next();

   anag.sort();

   pw.println(anag);

   i++;

  }

  aitr = anagrams.iterator();

  pw.println("\n\nAnagramsFamily size 8 datas : ");

  while(aitr.hasNext()){

   AnagramFamily anag = aitr.next();

   anag.sort();

   if(anag.getSize() == 8){

    pw.println(anag);

   }

  }

  pw.close();

 }catch(Exception e){

  e.printStackTrace();

  System.exit(-1);

 }

}

public static void main(String[] args) {

 LinkedList<Word> words = new LinkedList<>();

 readFile(words);

 Collections.sort(words);

 //System.out.println(words.toString());

 LinkedList<AnagramFamily> anagrams = new LinkedList<>();

 findAnagrams(anagrams,words);

 //System.out.println(anagrams.toString());

 writeOutput(anagrams);

}

}

The birthday problem is as follows: given a group of n people in a room, what is the probability that two or more of them have the same birthday? It is possible to determine the answer to this question via simulation. Using the starting template provided to you, complete the function called calc birthday probability that takes as input n and returns the probability that two or more of the n people will have the same birthday. To do this, the function should create a list of size n and generate n birthdays in the range 1 to 365 randomly, inclusive of the end-points 1 and 365. It should then check to see if any of the n birthdays are identical. The function should perform this experiment 106 times and calculate the fraction of time during which two or more people had the same birthday. The function will be called as follows from your main program:

IN PYTHON PLEASE

import random

def calc_birthday_probability (num_people):

random.seed (2020) # Don't change this value

num_trials = 1000

probability = 0
""" FIXME: Complete this function to return the probability of two or more people in the room having the same birthday. """

return probability

Answers

Answer:

He had a nearly 71% chance that 2 or more of us would share a birthday.

Explanation:

In a ring-based system, procedure p is executing and needs to invoke procedure q. Procedure q's access bracket is (5,6,9). In which ring(s) must p execute for the following to happen?

Answers

Complete Question:

Consider Multics procedures p and q. Procedure p is executing and needs to invoke procedure q. Procedure q's access bracket is (5, 6) and its call bracket is (6, 9). Assume that q's access control list gives p full (read, write, append, and execute) rights to q. In which ring(s) must p execute for the following to happen?

A) p can invoke q, but a ring-crossing fault occurs.

B) p can invoke q provided that a valid gate is used as an entry point.

C) p cannot invoke q.

D) p can invoke q without any ring-crossing fault occurring, but not necessarily through a valid gate

Answer:

If we suppose the access bracket as (a, b) and call bracket as (b, c), for q we have (a, b) = (5, 6) and (b, c) = (6, 9). Let the ring be denoted by r.

A) p can invoke q, but a ring-crossing fault occurs.

p must execute in rings where r < a., in r < 5, p must execute.

B) p can invoke q provided that a valid gate is used as an entry point.

p must execute in the rings between 6 and 9. r must be between a and b.

C) p cannot invoke q.

When r > c, then p cannot invoke q. That means, for this condition to happen p must execute in rings > 9

D) p can invoke q without any ring-crossing fault occurring, but not necessarily through a valid gate

When r is between a and b then the condition can be satisfied. That means p must execute in rings between 5 and 6.

Explanation:

Answer:

A.Rings 0 through 4

B. Rings 7 through 9

C.Ring number greater than 9

D.Riing 5 or 6

Explanation

(a)p can invoke q, but a ring-crossing fault occurs. R< a1 for access permitted but ring crossing fault occurs. Therefore, go through - rings 0 through 4.

(b)p can invoke q provided a valid gate is used as an entry point.

A2 < r <= a3 for access allowed if make through a valid gate. Therefore, go through - rings 7 through 9.

(c)p cannot invoke q.

a3 < r for all access denied. Hence, proceed through - ring with number greater than 9.

(d)p can invoke q without any ring-crossing fault occurring, but not through a valid gate.proceed through – ring 5 or 6.

Consider each of the following possible recovery strategies and discuss the merits and drawback of each one with your classmates, specifically focusing on their appropriateness for limited, average, and substantial budget:  Weekly full server backups with daily incremental backups  Daily full server backups  Daily full server backups with hourly incremental backups  Redundant array of independent (or inexpensive) disks (RAID) storage devices with periodic full backups  Storage area network (SAN) devices for multiple servers  Replicated databases and folders on high-availability alternate servers

Answers

Answer:

The advantages and disadvantages of recovery strategies are described.

Explanation:

1. Weekly full server backups with daily incremental backups: It is recommended to run full copies periodically for example weekly and between copy and full copy make incremental or differential copies. Daily full server backups: It is not recommended to make copies on the same server where the information is located. Disadvantage larger storage space.

2. Daily full server backups with hourly incremental backups: Less storage space than full or differential copy. Minor copy window. Disadvantage - if any dependent copy fails, the copy cannot be restored.

3. Redundant array of independent (or inexpensive) disks (RAID) storage devices with periodic full backups: RAID allows you to store the same data redundantly (in multiple paces) in a balanced way to improve overall performance. RAID disk drives are used frequently on servers but aren't generally necessary for personal computers.

4. Replicated databases and folders on high-availability alternate servers: Easy recovery. You have all the data copied.

What layer in the Transmission Control Protocol/Internet Protocol (TCP/IP) model is responsible for defining a way to interpret signals so network devices can communicate?

Answers

Answer:

The data-link layer

Explanation:

The physical layer and data-link layer are often confused a lot especially in terms of what they do in the TCP/IP 7 layer protocol. The physical layer as the name suggests represents the physical devices like the cables and the connectors that join or interconnect computers together. This layer is also responsible for sending the signals over to other connections of a network. The data-link, on the other hand, translates and interprets these sent binary signals so that network devices can communicate. This layer is responsible in adding mac addresses to data packets and encapsulating these packets into frames before being placed on the media for transmission. Since it resides in between the network layer and the physical layer, it connects the upper layers of the TCP/IP model to the physical layer.

• Write a program that asks the user to enter a number of seconds. • If there are less than 60 seconds input, then the program should display the number of seconds that was input. • There are 60 seconds in a minute. If the number of seconds entered by the user is greater than or equal to 60, the program should display the number of minutes in that many seconds (note that ther

Answers

Answer:

The solution code is written in Python:

sec = int(input("Enter number of seconds: ")) if(sec >=60):    min = sec // 60    sec = sec % 60 else:    min = 0 print(str(min) + " minutes " + str(sec) + " seconds")

Explanation:

Firstly, use input function to prompt user to enter number of seconds and assign the input value to variable sec (Line 1).

Next, create an if statement to check if the sec is bigger or equal to 60 (Line 3). If so, we user // operator to get minutes and use % operator to get the seconds (Line 4 - 5).

Then we use print function to print the minutes and seconds (Line 9).

Answer:

Here is the program in C++. Let me know if you want this program in some other programming language.

#include <iostream> //for input output functions

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

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

{  int seconds; // stores the value of seconds

   int time;    // stores value to compute minutes hours and days

   cout << "Enter a number of seconds: ";

//prompts user to enter number of seconds

   cin >> seconds; // reads the value of seconds input by user

   if (seconds <= 59) //if the value of seconds is less than or equal to 59

   { cout << seconds<<" seconds\n";    } //displays seconds

   else if (seconds >= 60 && seconds < 3600)

//if value of seconds is greater than or equal to 60 and less than 3600

   {  time = seconds / 60; //computes minutes

       cout << time << " minutes in "<<seconds<<" seconds \n ";    }

//displays time in minutes

   else if (seconds >= 3600 && seconds < 86400)    {

//if input value of secs is greater than or equal to 3600 and less than 85400

       time = seconds / 3600; //calculate hours in input seconds

       cout << time << " hours in "<<seconds<<" seconds \n";   }

//displays the time in hours

   else if (seconds >= 86400)    { //if seconds is greater or equal to 86400

       time = seconds / 86400; //compute the days

       cout << time << " days in  "<<seconds<<" seconds \n";   } }

//displays the number of days in input number of seconds

Explanation:

This program first prompts the user to enter the time in seconds and computes the number of minutes, hour or days according to the conditions specified in the program. If the value of seconds entered by the user is less than or equal to 59, the number of seconds are displayed as output, otherwise the if and else if conditions are checked if the input value of seconds is greater than 60 to compute the corresponding minutes, hours or days. Everything is explained within the comments in the program.You can change the data type of time variable from int to float to get the value floating point numbers. Here i am using int to round the time values. The screenshot of the output is attached.

Consider a satellite orbiting the earth. Its position above the earth is specified in polar coordinates. Find a model-view matrix that keeps the viewer looking at the earth. Such a matrix could be used to show the earth as it rotates.

Answers

Answer:

[1 0 0 0]

[0 1 0 0]

[0 0 1 -d]

[0 0 0 1]

Explanation:

I claim that in most situations if you can solve the decision problem in polynomial time then you can solve the optimization problem in polynomial time. Prove that this is true for the CLIQUE problem.

Answers

Answer:

Yes CLIQUE has decision problem as

Input: G (V.E.) and number k

Output : There is set of vertices in U and edge in E

The clique decision problem is NP - complete where clique is a fixed parameter and hard to approximate. In clique, all maximal clique listed.

Explanation:

In the computer, the CLIQUE is the computational problem of finding the cliques in subsets of vertices, all sides in a graph. It depending on cliques in which information should be found.

A clique has an edge in connecting the vertices; An edge connects only two vertices. For example, if you want to connect two vertices, then two edges need if you want three, then three edges need.

The clique problem is finding the clique in adjacent to each other in a graph. Its decision problem is NP-complete.

In computer science, a decision problem is a problem that posed yes or no of the input values. In computational and computability theory. it is a method used for solving a decision problem that is called the decision procedure of the problem.

A critical activity is________________.a. an activity that consumes no time but shows precedence between events. b. a milestone accomplishment within the project. c. an activity with zero slack. d/ the beginning of an event.

Answers

Answer:

C

Explanation:

Critical activity is the sequential activities from beginning to the end of a project. A lot of projects have a single critical path, although some projects may have more than one critical activity which depends on the flow logic utilized in the project.

Write a program that prints the day number of the year, given the date in the form month-day-year. For example, if the input is 1-1-2006, the day number is 1; if the input is 12-25-2006, the day number is 359. The program should check for a leap year. A year is a leap year if it is divisible by 4, but not divisible by 100. For example, 1992 and 2008 are divisible by 4, but not by 100. A year that is divisible by 100 is a leap year if it is also divisible by 400. For example, 1600 and 2000 are divisible by 400. However, 1800 is not a leap year because 1800 is not divisible by 400.

Answers

Answer:

C++:

C++ Code:

#include <iostream>

#include <string>

using namespace std;

struct date

{

  int d,m,y;

};

int isLeap(int y)

{

  if(y%100==0)

  {

      if(y%400==0)

      return 1;

      return 0;

  }

  if(y%4==0)

  return 1;

  return 0;

}

int day_no(date D)

{

  int m = D.m;

  int y = D.y;

  int d = D.d;

  int i;

  int mn[13] = {0,31,28,31,30,31,30,31,31,30,31,30,31};

  for(i=0;i<m;i++)

  {

      d += mn[i];

  }

  if(isLeap(y))

  {

      if(m>2)

      d++;

  }

  return d;

}

date get_info(string s)

{

  date D;

  int i,p1,p2,l = s.length();

  for(i=0;i<l;i++)

  {

      if(s[i] == '-')

      {

      p1 = i;

      break ;

      }

  }

  for(i=p1+1;i<l;i++)

  {

      if(s[i] == '-')

      {

      p2 = i;

      break ;

      }

  }

 

  D.m = 0;

  for(i=0;i<p1;i++)

  D.m = (D.m)*10 + (s[i]-'0');

 

  D.d = 0;

  for(i=p1+1;i<p2;i++)

  D.d = (D.d)*10 + (s[i]-'0');

 

  D.y = 0;

  for(i=p2+1;i<l;i++)

  D.y = (D.y)*10 + (s[i]-'0');

 

  return D;

 

}

int main()

{

  string s1 = "4-5-2008";

  string s2 = "12-30-1995";

  string s3 = "6-21-2000";

  string s4 = "1-31-1500";

  string s5 = "7-19-1983";

  string s6 = "2-29-1976";

 

  cout<<"Date\t\tDay no\n\n";

  cout<<s1<<"\t"<<day_no(get_info(s1))<<endl;

  cout<<s2<<"\t"<<day_no(get_info(s2))<<endl;

  cout<<s3<<"\t"<<day_no(get_info(s3))<<endl;

  cout<<s4<<"\t"<<day_no(get_info(s4))<<endl;

  cout<<s5<<"\t"<<day_no(get_info(s5))<<endl;

  cout<<s6<<"\t"<<day_no(get_info(s6))<<endl;

 

 

  return 0;

}

Explanation:

The computer program that prints the day number of the year, given the date in the form month-day-year is; written below

How to write computer programs?

#include <iostream>

using namespace std;

bool isLeapYear(int year);

bool isLeapYear(int year)

{  

   if ((year  % 4 == 0) && (year % 100 != 0))

       ((year % 100 == 0) &&(year % 400 == 0));

   {

       cout << year << " is a leap year";

       return true;

}

   return false;

}

   int main ()

   {

       int day, month, year, dayNumber;

       char ch;

       cout << "\n\n\tEnter a date(mm-dd-yyyy) : ";

       cin >> month;

       cin >> ch;

       cin >> day;

       cin >> ch;

       cin >> year;

      dayNumber = 0;

       

       if ((month >= 1 && month <= 12) && (day >=1 && day <= 31))

       {

           while (month > 1 && month <= 12)

               {

                       switch (month - 1)

                       {

                           case 1:

                           case 3:

                           case 5:

                           case 7:

                           case 8:

                           case 10:

                           case 12:

                               dayNumber += 31;

                               break;

                           case 4:

                           case 6:

                           case 9:

                           case 11:

                               dayNumber += 30;

                               break;

                           case 2:

                               dayNumber += 28;

                               if (isLeapYear(year))

                                   dayNumber++;

                               break;

                       }

      month--;

        }

           }

           else {

               cout << "Enter Correct month or day";

               return 0;

           }

           dayNumber += day;

           cout << "\n\n\tThe day number is " << dayNumber;

           return 0;

       }

Read more about computer programming at; https://brainly.com/question/23275071

Write a public static method called getPIDs that has a parameter of type Map called nameToPID (keys are student names and values are student PIDs). It should return a HashSet containing all PIDs in nameToPID.

Answers

Answer:

Java program is explained below

Explanation:

import java.util.HashSet;

import java.util.Map;

import java.util.TreeMap;

public class TruckRace1 {

   public static HashSet<String> getPIDs (Map<String,String>nameToPID ){

       HashSet<String> pidSet = new HashSet<>();

       for(String ids: nameToPID.values()){

           pidSet.add(ids);

       }

       return pidSet;

   }

   public static void main(String[] args) {

       Map<String,String> pids = new TreeMap<>();

       pids.put("John","123");

       pids.put("Jason","124");

       pids.put("Peter","125");

       pids.put("Alice","126");

       pids.put("Peny","129");

       HashSet<String> ids = getPIDs(pids);

       for(String id:ids){

           System.out.println(id);

       }

   }

}

Which of the following statement is true for Service Request Floods A. An attacker or group of zombies attempts to exhaust server resources by setting up and tearing down TCP connections B. It attacks the servers with a high rate of connections from a valid source C. It initiates a request for a single connection

Answers

Answer:

"Option A and Option B" is the correct answer.

Explanation:

It is a form of attack, that is usually used by breaching huge amounts of transport, that open up the network instead of a service. It is a large- server through the valid source, that tries to steal server resources of a group of cyborgs by establishing and disconnecting the link. That's why options A and B are correct.

In option C, It doesn't initiate a single call, if the intruder must first create and delete TCP connections as the servers become underfunded for authorized source links.

How many bits does it take to store a 3-minute song using an audio encoding method that samples at the rate of 40,000 bits/second, has a bit depth of 16, and does not use compression

Answers

Answer:

115200000 bits

Explanation:

Given Data:

Total Time = 3 minute = 3 x 60 sec = 180 sec

Sampling rate = 40,000 bits / sample

Each sample contain bits = 16 bits /sample

Total bits of song = ?

Solution

Total bits of song = Total Time x Sampling rate x Each sample contain bits

                             = 180 sec x 40,000 bits / sec x 16 bits /sample

                             = 115200000 bits

                             =  115200000/8 bits

                             = 14400000 bytes

                             = 144 MB

There are total samples in one second are 40000. Total time of the song is 180 seconds and one sample contains 16 bits. so the total bits in the song are 144 MB.

Print "userNum1 is negative." if userNum1 is less than O. End with newline Convert userNum2 to 0 if userNum2 is greater than 8. Otherwise, print "userNum2 is less than or equal to 8.. End with newline. 1 public class UserNums 2public static void main (String args) int userNum1; int userNum2 userNumt - -1; userNum2 7; Your solution goes here / 10 System.out.printin("userNum2 is "userNum2);

Answers

Answer:

import java.util.Scanner;

public class num1 {

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       System.out.println("Enter User name 1 and 2");

       int userNum1 = in.nextInt();

       int userNum2= in.nextInt();

       if(userNum1<0){

           System.out.println("userNum1 is negative.");

       }

       else if(userNum2>8){

           userNum2 =0;

       }

       else{

           System.out.println("userNum2 is less than or equal to 8..");

       }

   }

}

Explanation:

This is implemented in Java programming language

Using the scanner class, the user is prompted to enter two numbers

These are saved in the variable userNum1 and userNum2 respectively.

If, else if and else statements are then used according to the specifications given in the question.

Final answer:

The question involves implementing conditional logic in Java to check if one number is negative and to modify or print a message about another number based on its value. The solution includes an if-else structure to address the requirements and corrects any typos in the code provided by the student.

Explanation:

The logic needed to fulfill the requirements described in the question can be implemented within a Java program. Specifically, the provided code snippet appears to be in Java. Let's address each requirement one at a time, following a step-by-step approach based on the given code structure:

Check if userNum1 is negative and print the specified message, making sure to terminate the output with a newline.Determine if userNum2 is greater than 8, and if so, set its value to 0. Otherwise, print a message indicating that userNum2 is less than or equal to 8 followed by a newline.

Here is the corrected and completed code based on the requirements:

public class UserNums {
  public static void main (String[] args) {
     int userNum1;
     int userNum2;
     userNum1 = -1;
     userNum2 = 7;
     if (userNum1 < 0) {
        System.out.println("userNum1 is negative.");
     }
     if (userNum2 > 8) {
        userNum2 = 0;
     } else {
        System.out.println("userNum2 is less than or equal to 8.");
     }
     System.out.println("userNum2 is " + userNum2);
  }
}

2. Imagine that the user at computer A wants to open a file that is on computer C's hard disk, in a peer-to-peer fashion. What path do you think data would take between these two computers?

Answers

Answer:

Since there is no server in a peer-to-peer network, both computers will share resources through the network component used in linking them together such as a cable or a switch.

Explanation:

In its simplest form, a peer-to-peer (P2P) network is created when two or more computers (in this case computer A and C) are connected and share resources without going through a separate server computer. A P2P network can be an ad hoc connection—a couple of computers connected via a Universal Serial Bus to transfer files or through an Ethernet cable. A P2P network also can be a permanent infrastructure that links a half-dozen computers in a small office over copper wires using switches as a central connector. Or a P2P network can be a network on a much grander scale in which special protocols and applications set up direct relationships among users over the Internet.

Please find attached the diagram of the peer-to-peer network of the two computers, computer A and computer. We have two network connections in the diagram.

The first one was implemented using a crossover Ethernet cable to connect both computers through the RJ45 LAN port on their network interface card.

In this network configuration, that will go through the NIC card from Computer C, through the cable to the NIC on computer A and vice versa.

In the second implementation, we used a switch to connect both computers using a straight Ethernet cable.

In this connection, data will go through the NIC card in computer C, through the cable connecting Computer C to the switch, through the switch, then through the cable connecting the switch to computer A and finally through the NIC card on computer A and vice versa

4. Write an interactive program CountOddDigits that accepts an integer as its inputs and prints the number of even-valued digits in that number. An even-valued digit is either 1, 3, 5, 7, or 9. For example, the number 8546587 has four even digits (the two 5s, and a 7). So the program CountOddDigits(8546587) should return "The number of Odd Digits in 8546587 is 3".

Answers

Answer:

Program :

number=int(input("Enter the number: "))#take the input from the user.

number1=number

count=0#take a variable for count.

while(number>0):#loop which check every number to be odd or not.

   value=number%10 #it is used to take the every number from integer value.

   number=int(number/10)#it is used to cut the number which is in the use.

   if(value%2!=0):#It is used to check the number to be odd.

       count=count+1#It is used to increase the value.

print("The number of Odd Digits in "+str(number1)+" is "+str(count))#It is used to print the count value of odd digit.

Output:

If the user inputs is '1234567890', it will prints "5".If the user inputs is "8546587", it will prints "3".

Explanation:

The above program is in python language, which takes the integer value from the user.Then The number will be distributed into many individual units with the help of a while loop.The while loop runs when the number is greater than 0.There is a two operation, one is used to take the number by the help of modulo operator because it gives the remainder.The second operation is used to divide the number to let the number 0.

Write a function to check for balancing { and } in C programming language. (Assume that the entire program to be checked is given as a null-terminated string).

Answers

Answer:

Balanced

Explanation:

// CPP program to check for balanced parenthesis.  

#include<bits/stdc++.h>  

using namespace std;  

 

// function to check if paranthesis are balanced  

bool areParanthesisBalanced(string expr)  

{  

   stack<char> s;  

   char x;  

 

   // Traversing the Expression  

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

   {  

       if (expr[i]=='('||expr[i]=='['||expr[i]=='{')  

       {  

           // Push the element in the stack  

           s.push(expr[i]);  

           continue;  

       }  

 

       // IF current current character is not opening  

       // bracket, then it must be closing. So stack  

       // cannot be empty at this point.  

       if (s.empty())  

          return false;  

 

       switch (expr[i])  

       {  

       case ')':  

 

           // Store the top element in a  

           x = s.top();  

           s.pop();  

           if (x=='{' || x=='[')  

               return false;  

           break;  

 

       case '}':  

 

           // Store the top element in b  

           x = s.top();  

           s.pop();  

           if (x=='(' || x=='[')  

               return false;  

           break;  

 

       case ']':  

 

           // Store the top element in c  

           x = s.top();  

           s.pop();  

           if (x =='(' || x == '{')  

               return false;  

           break;  

       }  

   }  

 

   // Check Empty Stack  

   return (s.empty());  

}  

 

// Driver program to test above function  

int main()  

{  

   string expr = "{()}[]";  

 

   if (areParanthesisBalanced(expr))  

       cout << "Balanced";  

   else

       cout << "Not Balanced";  

   return 0;  

}

"Using the printf method, print the values of the integer variables bottles and cans so that the output looks like this: Bottles: 8 Cans: 24 The numbers to the right should line up. (You may assume that the numbers have at most 8 digits.)"

Answers

Use printf with format specifiers %-8d to print the integer variables bottles and cans left-justified in a field of 8 characters, to align the numbers as requested.

To print the values of the integer variables bottles and cans with the output aligned as specified using printf, you can use the following printf statement in your code:

printf("Bottles: %-8d Cans: %-8d\n", bottles, cans);

The %-8d format specifier is used for both integers. This means the integer will be left-justified in a field of at least 8 characters wide, which ensures that the numbers will be aligned. The hyphen (-) is used for left-justification, and the number 8 specifies the minimum width of the field.

Write code that prints: Ready! numVal ... 2 1 Start! Your code should contain a for loop. Print a newline after each number and after each line of text Ex: numVal = 3 outputs: Ready! 3 2 1 Start!

Answers

Answer:

Code to this question can be described as follows:

Program:

#include <iostream> //defining header file

using namespace std;

int main() //defining main method

{

int n1,j,x1=0; //defining integer variable

cout<<"Enter a number: "; //print message

cin>>n1; //input value from the user

cout<<n1<<endl; //print input value

for(j=1;j<n1;j++)  //loop to count reverse number

{

x1=n1-j; //calculate value

cout<<x1<<endl;  //print value

}

return 0;

}

Output:

Enter a number: 3

3

2

1

Explanation:

In the above C++ language program, three integer variable "n1,j and x1" is declared, in which variable n1 take input from the user end and the variable j and x1 are used in the loop to calculate the value in the reverse order. In the next step, a for loop is declared, in which the variable x1 calculates the value in reverse order and uses a print method to print its value.  

Write a while loop that prints userNum divided by 4 (integer division) until reaching 2. Follow each number by a space. Example output for userNum = 160:

40 10 2

Note: These activities may test code with different test values. This activity will perform four tests, with userNum = 160, then with userNum = 8, then with userNum = 0, then with userNum = -1. See "How to Use zyBooks".

Also note: If the submitted code has an infinite loop, the system will stop running the code after a few seconds, and report "Programend never reached." The system doesn't print the test case that caused the reported message.

#include
using namespace std;

int main() {
int userNum;

cin >> userNum;

/* Your solution goes here */

cout << endl;

return 0;
}

Answers

Final answer:

The solution requires creating a while loop in C++ that divides a number by 4 using integer division and prints each result until the number is less than or equal to 2.

Explanation:

To write a while loop in C++ that prints userNum divided by 4 until reaching 2, you can follow the given instructions to modify the provided code snippet. The loop should include integer division and check the condition if the current userNum is greater than 2. Here's the complete detailed code inside the main function:

#include
using namespace std;

int main() {
 int userNum;
 cin >> userNum;
 while (userNum > 2) { // Loop continues as long as userNum is greater than 2
   userNum = userNum / 4; // Integer division by 4
   cout << userNum << " "; // Printing the result followed by a space
 }
 cout << endl;
 return 0;
}

This loop will continue to execute, reducing userNum with integer division by 4, until userNum becomes less than or equal to 2. After the loop, the program will print a newline character and terminate.

Final answer:

A while loop in C++ is used to perform integer division of a user input by 4 until the value drops below or equal to 2, only printing values above 2.

Explanation:

You have been asked to write a while loop in C++ that continues to print the variable userNum divided by 4, using integer division, until the result reaches 2. Below is an example code snippet that accomplishes this task:

#include
using namespace std;
int main() {
   int userNum;
   cin >> userNum;
   while (userNum > 2) {
       userNum = userNum / 4;
       if (userNum < 2) {
           break;
       }
       cout << userNum << " ";
   }
   cout << endl;
   return 0;
}

Please note that the loop includes a check to prevent printing numbers less than 2 and ends the loop using a break statement if userNum becomes less than 2 after the division.

This program will output a right triangle based on user-specified height triangleHeight and symbol triangleChar.
(1) The given program outputs a fixed-height triangle using a * character. Modify the given program to output a right triangle that instead uses the user-specified triangleChar character.
(2) Modify the program to use a nested loop to output a right triangle of height triangleHeight. The first line will have one user-specified character, such as % or *. Each subsequent line will have one additional user-specified character until the number in the triangle's base reaches triangleHeight. Output a space after each user-specified character, including a line's last user-specified character.
Example output for triangleChar = % and triangleHeight = 5:
Enter a character: %
Enter triangle height: 5

%
% %
% % %
% % % %
% % % % %

#include
usingnamespacestd;
intmain()
{
char triangleChar='-';
inttriangleHeight=0;
cout<<"Enter a character: "< cin>>triangleChar;

cout<<"Enter triangle height: "<>triangleHeight;
cout<<"@"<<" "< cout<<"@"<<" "<<"@"<<" "< cout<<"@"<<" "<<"@"<<" "<<"@"<<" "<
return0;
}

Answers

Answer:

The above program is not correct, the correct program in c++ langauge is as follows:

#include <iostream>//header file.

using namespace std; //package name.

int main() //main function.

{

  char char_input;//variable to take charater.

  int size,i,j;//variable to take size.

  cout<<"Enter the size and charter to print the traingle: ";//user message.

  cin>>size>>char_input; //take input from the user.

  for(i=0;i<size;i++)//first for loop.

  {

     for(j=0;j<=i;j++)//second for loop to print the series.

       cout<<char_input<<" ";//print the charater.

     cout<<"\n";//change the line.

  }

  return 0; //returned statement.

}

Output:

If the user inputs 5 for the size and '%' for the charater, then it will prints the above series example.

Explanation:

The above program is written in C++ language, in which there are two for loop which prints the series.The first for loop runs n time, where n is the size given by the user.The second loop is run for every iteration value of the first for loop.For example, if the first for loop runs for the 2 times, then the second for loop runs 1 time for the first iteration of the first loop and 2 times for the second iteration of the first loop.

You have enabled IPv6 on two of your routers, but on the interfaces you have not assigned IPv6 addresses yet. You are surprised to learn that these two machines are exchanging information over those interfaces. How is this possible?a. Due to anycast addressingb. Due to ICMPv6c. Due to the NATv6 capabilityd. Due to the link-local IPv6 addresses

Answers

Answer:

You have enabled IPv6 on two of your routers, but on the interfaces you have not assigned IPv6 addresses yet. You are surprised to learn that these two machines are exchanging information over those interfaces. How is this possible?

a. Due to anycast addressing

b. Due to ICMPv6

c. Due to the NATv6 capability

d. Due to the link-local IPv6 addresses

The correct answer is D. Due to the link-local addresses

Explanation:

LINK-LOCAL ADDRESS

Link-local addresses are addresses that can be used for unicast communications on a confined LAN segment.  The requirement with these addresses is that they are only locally-significant (i.e., restricted to a single LAN broadcast domain) and are never used to source or receive communications across a layer-3 gateway.

Typically, link-local IPv6 addresses have “FE80” as the hexadecimal representation of the first 10 bits of the 128-bit IPv6 address, then the least-significant 64-bits of the address are the Interface Identifier (IID).  Depending on the IID algorithm the node’s operating system is using, the IID may use either modified EUI-64 with SLAAC, the privacy addressing method (RFC 4941)), or the newly published Stable SLAAC IID method(RFC 8064).

When a host boots up, it automatically assigns an FE80::/10 IPv6 address to its interface.  You can see the format of the link-local address below. It starts with FE80 and is followed by 54 bits of zeros. Lastly, the final 64-bits provide the unique Interface Identifier.

FE80:0000:0000:0000:abcd:abcd:abcd:abcd

Link-local IPv6 addresses are present on every interface of IPv6-enabled host and router.  They are vital for LAN-based Neighbor Discovery communication.  After the host has gone through the Duplicate Address Detection (DAD) process ensuring that its link-local address (and associated IID) is unique on the LAN segment, it then proceeds to sending an ICMPv6 Router Solicitation (RS) message sourced from that address.

IPv6 nodes send NS messages so that the link-layer address of a specific neighbor can be found. There are three operations in which this message is used:

▪   For detecting duplicate address

▪   Verification of neighbor reachability

▪   Layer 3 to Layer 2 address resolution (for ARP replacement)  ARP is not included in IPv6 as a protocol but rather the same functionality is integrated into ICMP as part of neighbor discovery. NA message is the response to an NS message.  From the figure the enabling of interaction or communication between neighbor discoveries between two IPv6 hosts can be clearly seen.

Create a program called InsertionSort.java that implements the Insertion Sort algorithm. The program should be able to do the following:
-accepts two command line parameters, the first one is an integer specifying how many strings to be sorted, and the second one is the path to a text file containing the values of these strings, one per line.
-reads the strings from the text file into an array of strings. sorts the strings using InsertionSort, and then print out a sorted version of those input strings with one string per line.
The implementation should follow the given pseudo code/algorithm description.

Answers

Answer:

import java.io.File;

import java.io.FileNotFoundException;

import java.util.Scanner;

public class InsertionSort {

   public static void insertionSort(String[] array) {

       int n = array.length;

       for (int i = 1; i < n; i++)

       {

           String temp = array[i];

           int j = i - 1;

           while (j >= 0 && temp.compareTo(array[j]) < 0)

           {

               array[j + 1] = array[j];

               j--;

           }

           array[j+1] = temp;

       }

   }

   public static void main(String[] args) {

       if (args.length == 2) {

           int n = Integer.parseInt(args[0]);

           File file = new File(args[1]);

           try {

               Scanner fin = new Scanner(file);

               String[] strings = new String[n];

               for (int i = 0; i < n; i++) {

                   strings[i] = fin.nextLine();

               }

               insertionSort(strings);

               for (int i = 0; i < n; i++) {

                   System.out.println(strings[i]);

               }

               fin.close();

           } catch (FileNotFoundException e) {

               System.out.println(file.getAbsolutePath() + " is not found!");

           }

       } else {

           System.out.println("Please provide n and filename as command line arguments");

       }

   }

}

Explanation:

Write a program that determines the commission for a sales person's weekly sales. The program will first ask for a sales person's name and then for sales for each day of the week (M-Su)! Then the total will be printed along with the commission. The commission is set at 10%.

Answers

Answer:

# The user is prompt to enter name

name = str(input("Enter the name: "))

# the user is prompt to enter monday sale

mon = int(input("Enter Monday sales: "))

# the user is prompt to enter tuesday sale

tue = int(input("Enter Tuesday sales: "))

# the user is prompt to enter wednesday sales

wed = int(input("Enter Wednesday sales: "))

# the user is prompt to enter thursday sales

thurs = int(input("Enter Thursday sales: "))

# the user is prompt to enter friday sales

fri = int(input("Enter Friday sales: "))

# the user is prompt to enter saturday sales

sat = int(input("Enter Saturday sales: "))

# the user is prompt to enter sunday sales

sun = int(input("Enter Sunday sales: "))

# the total is calculated

total = mon + tue + wed + thurs + fri + sat + sun

# the commission is calculated

commission = (10 * total) / 100

# the total is displayed

print(name, "your total is: ", total)

# the commission is displayed

print(name, "your commission is: ", commission)

Explanation:

The program is written in Python. And the program is well-commented.

Answer:

Find the python script below. Copy and paste directly into your python interpreter. Attached is  also the formatting

Explanation:

def check_number(a):    

   flag = True

   try:

       int(a)

   except ValueError:

       try:

           float(a)

       except ValueError:

           flag = False

           print("wrong input!")

           

   return(flag)

print("Welcome To Weekly Commission Calculator")

name = input("Input your name please and press enter:  ")

check = False

while(check==False):

   day1 = input ("Enter the sales for day 1 and press enter: ")

   check = check_number(day1)  

   continue

check = False

while(check==False):

   day2 = input ("Enter the sales for day 2 and press enter: ")

   check = check_number(day2)  

   continue

check = False

while(check==False):

   day3 = input ("Enter the sales for day 3 and press enter: ")

   check = check_number(day3)  

   continue

check = False

while(check==False):

   day4 = input ("Enter the sales for day 4 and press enter: ")

   check = check_number(day4)  

   continue

check = False

while(check==False):

   day5 = input ("Enter the sales for day 5 and press enter: ")

   check = check_number(day5)  

   continue

check = False

while(check==False):

   day6 = input ("Enter the sales for day 6 and press enter: ")

   check = check_number(day6)  

   continue

check = False

while(check==False):

   day7 = input ("Enter the sales for day 7 and press enter: ")

   check = check_number(day7)  

   continue

Total_sales = float(day1)+float(day2)+float(day3)+float(day4)+float(day5)+float(day6)+float(day7)

#rate = 10%  

rate = 0.1

#commission = rate * Total sales

Commission = rate * Total_sales

print("Total sales is " ,Total_sales)

#print("%s is %d years old." % (name, age))

print("Total sales for %s is $%d and the commission is $%e." % (name, Total_sales,Commission))

Define an iterative function named alternate_i; it is passed two linked lists (ll1 and ll2) as arguments. It returns a reference to the front of a linked list that alternates the LNs from ll1 and ll2,

Answers

Answer:

answer is attached

The problem requires the definition of an iterative function called alternate_i that takes two linked lists, ll1 and ll2, as arguments. This function should return a reference to the front of a linked list that alternates the elements from ll1 and ll2.

The problem requires the definition of an iterative function called alternate_i that takes two linked lists, ll1 and ll2, as arguments. This function should return a reference to the front of a linked list that alternates the elements from ll1 and ll2.

To solve this problem, you can create a new linked list and iterate through both ll1 and ll2 simultaneously, adding elements alternately. If either linked list becomes empty, you can append the remaining elements from the other linked list.

Here is a possible implementation:

def alternate_i(ll1, ll2):
   result = None
   current = None
   
   while ll1 is not None and ll2 is not None:
       if result is None:
           result = current = LN(ll1.value)
       else:
           current.next = LN(ll1.value)
           current = current.next
       
       current.next = LN(ll2.value)
       current = current.next
       
       ll1 = ll1.next
       ll2 = ll2.next
   
   if ll1 is not None:
       current.next = ll1
   elif ll2 is not None:
       current.next = ll2
   
   return resultThe Question is:Define an iterative function named alternate_i;it is passed two linked lists (ll1 and ll2) as arguments. It returns a reference to the front of a linked list that alternates the LNs from ll1 and ll2, starting with ll1;if either linked list becomes empty, the rest of the LNs come from the other linked list. So, all LNs in ll1 and ll2 appear in the returned result (in the same relative order, possibly separated by values from the other linked list).The original linked lists are mutated by this function (the .nexts are changed; create no new LN objects).For example, if we defined a = list_to_ll(['a', 'b', 'c',]) and b = list_to_ll([1,2,3,4,5]) alternate_i(a,b) returns a->1->b->2->c->3->4->5->None and alternate_i(b,a) returns 1->a->2->b->3- >c->4->5->None. You may not create/use any Python data structures in your code: use linked list processing only. Change only .next attributes (not .value attributes).class LN:def __init__(self,value,next=None):self.value = valueself.next = nextdef list_to_ll(l):if l == []:return Nonefront = rear = LN(l[0])for v in l[1:]:rear.next = LN(v)rear = rear.nextreturn frontdef str_ll(ll):answer = ''while ll != None:answer += str(ll.value)+'->'ll = ll.nextreturn answer + 'None'

Alice and Bob agree upon using Lamport one-time password algorithm with an original password PO, a counter 6, and a hash function h. What will be the third password generated by this algorithm and used by Alice and Bob? a.PO b.Oh3(p0) c.h(h(h(h(po)))) d.h(h(h(po)) e.h(h(po))

Answers

Answer:

The correct answer to the following question will be Option C (h(h(h(h(po))))).

Explanation:

As we recognize, the individual and device generate a linearly modified password that used a hash feature at the Lamport one-time code or password.

hn(x) = h(hn-1(x)) hn-1(x) = h(hn-2(x)) ........ h2(x) = h(h(x)) h1x = h(x)

Suppose that Bob and Alice accept an initial P0 password as well as a counter 6.

The counter would be 6-1 that is 5 throughout the next step, as well as the password should be h5(P0). Which implies the third code created over the next step would be h4(P0).

So, Option C is the right answer.

Other Questions
Ethyl alcohol is produced by the fermentation of glucose, C6H12O6. C6H12O6 (s) 2 C2H5OH (l) + 2 CO2 (g) H = 69.1 kJ Given that the enthalpy of formation is 277.7 kJ/mol for C2H5OH ( l) and 393.5 kJ/mol for CO2 (g), find the enthalpy of formation for C6H12O6. You are the head of the Health Information Management department at Grady Health System. An FBI agent has arrived at your office with a search warrant in hand. He asks to speak with you about the hospitals health records and HIPAA violations. You start your response with some examples of HIPAA violations. What would you say? Provide a reference to support your thoughts. Which of the following best defines a nation's labor force? the total number of persons who are willing and able to work but cannot find a job the total number of persons between the ages of 16 and 65 the total number of employed and unemployed persons the total number of persons working full time and part time For a normally distributed population, according to the empirical rule Group of answer choices ~95% of the populations lies in the tails, beyond ~2 standard deviations from the mean ~5% of the population lies in the tails, beyond ~2 standard deviations from the mean ~68% of the population is within 1 standard deviation of the mean ~68% of the population lies within 2 standard deviations above the mean ~98% of the population lies within 3 standard deviations of the mean 3. In the text, we described a multithreaded file server, showing why it is better than a single-threaded server and a finite-state machine server. Are there any circumstances in which a single-threaded server might be better Eliza bought a meal that cost $12.00. She tipped the waiter 25%of that amount . How much was the tip ? Jorge is setting up his tent. He is using two nylon ropes to pull the tent taut and stabilize it at each end. If the tent is 5 feet tall, and Jorge stakes the ropes into the ground 3 feet from the tent. What is the total length of nylon rope he will use, Caroline Watts is an employee of Lavender Creek Farm. She has come to you, the payroll accountant, for advice about her health insurance premiums, specifically if she should have them deducted pre-tax or post-tax.Required:What reason(s) would you give her for having the medical premiums deducted on a pre-tax basis?Caroline Watts is an employee of Lavender Creek Farm. She has come to you, the payroll accountant, for advice about her health insurance premiums, specifically if she should have them deducted pre-tax or post-tax.Required:What reason(s) would you give her for having the medical premiums deducted on a pre-tax basis?All health insurance premiums must be deducted on a pre-tax basis.checkedThe premium amounts are reduced by deducting them on a pre-tax basis.checkedThe employees income that is subject to income tax(es) is reduced.checkedThe income subject to Social Security and Medicare taxes is reduced. Computing Revenues under Long-Term ContractsCamden Corporations agreed to build a warehouse for a client at an agreed contract price of $ 900,000. Expected (and actual) costs for the warehouse follow: 2016, $202,500; 2017, $337,500; and 2018, $135,000. The company completed the warehouse in 2015. Compute revenues, expenses, and income for each year 2016 through 2018, and for all three years combined, using the cost-to-cost method.Cost-to-Cost Method% of total Costs expected Revenue Year incurred costs recognized Income2016 $Answer Answer% $Answer $Answer2017 Answer Answer% Answer Answer2018 Answer Answer% Answer AnswerTotal $Answer $Answer $Answer Rhea is an employee at Diaz Inc. She specializes in graphic and web design, user interface design, and search engine optimization. She also knows how to interact with customers by asking them about their preferences and providing them with products that meet their needs. Which of the following statements is true about Rhea? A. She specializes in outsourcing. B. She is a part of the external labor market. C. She bases her work on the terms of a psychological contract. D. She is an on-call worker. E. She is a knowledge worker. A right triangle has legs with the lengths of 2 and 5, find the length of the hypotenuseAnswer Choices:213729 An engineer scale model shows a building that is 3 inches tall. If the scale is 1 inch = 600 feet, how tall is the actual building in feet ? Why are some countries megadiverse and others not? Rajid, an immigrant who speaks little English, enters into a contract to pay $300 per month for ten years to purchase an auto from Travel Motor Co. The appraised retail value of the car is $5000. What legal remedy would release Rajid from his contract? All of the following statements concerning project portfolios are true EXCEPT: a.The projects in a portfolio are managed as a group to achieve strategic business objectives. b.Portfolios cannot include operations and programs. c.Portfolios usually include a mix of some high-risk, high-reward projects and some low-risk projects. d.Each project in the portfolio should have a direct impact on the organization. Do you believe that the $785,000 amount at the center of the Overstock-Grant Thornton dispute was material? Defend your answer. What factors other than quantitative considerations should have been considered in deciding whether the $785,000 amount was material? A triangular prism has a volume of 350 cubic meters. If the dimensions are tripled what is the volume of the newprism? Explain how the product 1\2 1\3 relates to the model Check the box next to each molecule on the right that has the shape of the model molecule on the left: model molecules (check all that apply X 5 ? | O CH20 CNH, You can drag the slider to rotate the model molecule. + 1 O Brf 4 CH2Cl2 Note for advanced students: the length of bonds and size of atoms in the model is not necessarily realistic. The model is only meant to show you the general geometry and 3D shape of the molecule. COMPLETEMeiosis results in__cells.2diploid2haploid4diploidOr 4 haploidEach of these cells contains___242346chromosomes.