Questions
Please answer in JAVA I am using java.time.Duration class. 1.). How can I add all of...

Please answer in JAVA

I am using java.time.Duration class.

1.). How can I add all of the given duration time?

for example:

Duration t1 = Duration.ofMinutes(2).plusSeconds(30)

Duration t2 = Duration.ofMinutes(3).plusSeconds(20)

then the result would be total = Duration.ofMinutes(5).plusSeconds(50)

*** and how would it be if it exceeds 59 minutes and its an hour.

2). How would I be able to add it all up on an ArrayList? does a for loop and simple add() works?

In: Computer Science

You have been tasked to write a C# application that will go through the first step...

You have been tasked to write a C# application that will go through the first step of encrypting an input file and writing the encrypted contents to an output file.

For this first step in encryption, read each letter in from the input file, add 3 letters to the value of the input letter. If the input letter is an A then the encrypted letter would be a D. If the input letter from the input file is an X then the encrypted letter would be an A.
All spaces, digits, punctuation, and special characters do not need to be encrypted at this level.   Simply write the space, punctuation, or special character to the output file as is.
If a letter is uppercase in the input file, it should remain as an uppercase character in the output file. If a letter is lowercase in the input file, it should remain as a lowercase character in the output file.

Since this program runs each month, the input file will be of various lengths; therefore, the program will read until end of file.

The input file is found in the current directory and is named October20.txt.   The output file will be written to the current directory and named EncryptOct20.txt.

An example:

If the contents of the input file is

Live long and prosper.



The output file would be:

Olyh orqj dqg survshu.



What the user should see when the program executes:


When the program begins, the statement "Encryption Level 1" should be displayed.
The focus should be set to the "Begin Encryption" button.
When the user clicks the "Begin Encryption" button, the program opens the input file, the statement "Opening input file...." should be displayed. The "Begin Encryption" button should be disabled.
When the program begins reading through the input file encrypting the contents, the statement "Encrypting input file...." should be displayed.
When the program closes the input and output files, the statement "Encryption complete...." should be displayed.
When the program is complete, the statement "End of process" should be displayed.

In: Computer Science

course: IT Data Mining and Data Warehousing There are several typical cube computation methods such as...

course: IT Data Mining and Data Warehousing

There are several typical cube computation methods such as Multi-Way, BUC, and Star-cubing. Briefly describe each one of these methods outlining the key points.

note: need a unique answer and no handwriting please.

In: Computer Science

After your successful engagement to develop privacy and personal data protection strategies for DAS, you have...

After your successful engagement to develop privacy and personal data protection strategies for DAS, you have been engaged by the Department of Health (DoH) to advise on the development of privacy and data protection for CovidSafe users. DoH expect up to 16 million Australian mobile users to download and use this app. DoH have announced that they will be using a major U.S. based public cloud provider to host the CovidSafe data, but claim that the data will always be under Australian Government control.

You are to provide a report to DoH that:

  1. Discusses the possible threats and risks to the security of user data on mobile phones, and in linked Cloud and financial accounts from the use of the CovidSafe app.
  2. Discusses the possible threats to the privacy of a user's data, location and activities from the use of the CovidSafe app.
  3. Discusses the issues of data sovereignty that may apply to the storage of CovidSafe data in U.S. based Cloud storage.
  4. You are to recommend that DoH adopt:
    1. Possible security controls that would prevent the loss or breach of user data, while still enabling effective tracking for COVID-19, and the reasons these controls will be effective.
    2. Possible privacy controls to protect user privacy, particularly of data, location and activity, while still enabling effective tracking of COVID-19, and the reasons these controls will be effective.
    3. Possible controls to ensure that the CovidSafe data remains under Australian data sovereignty and control, and the reasons these controls will be effective.

In: Computer Science

Mention any three reconnaissance techniques. Briefly explain each of them (just one or two sentences). Why...

Mention any three reconnaissance techniques. Briefly explain each of them (just one or two sentences). Why reconnaissance is a threat to network security?

In: Computer Science

What are the advantages of filtering using Slicers over using filtering in Excel?

What are the advantages of filtering using Slicers over using filtering in Excel?

In: Computer Science

I. Answer part A,B, C and D. 1a) Count the number of times a given char...

I. Answer part A,B, C and D.

1a)

Count the number of times a given char occurs in a given range of a String parameter (i.e. starting at a given start index, and up to but not including and end index). If end is greater than the length of the String, then the method should stop looking at the end of the String.


countCharsInRange("java", "v", 1, 2) → 0
countCharsInRange("java", "v", 0, 2) → 0
countCharsInRange("java", "v", 0, 3) → 1

1b)

Return a new String that removes all copies of the given char ch from the given String

removeChar("dog", "o") → "dg"
removeChar("cat", "o") → "cat"
removeChar("aaa", "a") → ""

1c)

Return the number of times the letter 'a' is directly followed by the letter 'b' in the given String.


countAB("abc") → 1
countAB("wxyz") → 0
countAB("bcaca") → 0

1d)

Return a new String that is a copy of the given String with each character copied the given number of times. Assume that n is 0 or more.


eachCharNTimes("abc", 2) → "aabbcc"
eachCharNTimes("xyz", 3) → "xxxyyyzzz"
eachCharNTimes("a", 5) → "aaaaa"

In: Computer Science

Project : facial recognition system use the DEEP method to reflective writing. The four steps in...

Project : facial recognition system

use the DEEP method to reflective writing. The four steps in this method are:

  • 2.1 D - Describe experience (past or present).
    1. Describe the problem
  • 2.2 E - Explore or consolidate new learning
    1. Read/Research about the problem
  • 2.3 E - Evaluate/analyse/self reaction
  • 2.4 P - Plan future learning

In: Computer Science

How would you describe some of the ER design limitations, and discuss how understanding these limitations...

How would you describe some of the ER design limitations, and discuss how understanding these limitations will influence how you choose to model a particular situation so that you are able to represent the things that are most important?

In: Computer Science

Consider an array A[1 · · · n] which is sorted and then rotated k steps...

Consider an array A[1 · · · n] which is sorted and then rotated k steps to the right. For example, we might start with the sorted array [1, 4, 5, 9, 10], and rotate it right by k = 3 steps to get [5, 9, 10, 1, 4]. Give an O(log n)-time algorithm that finds and returns the position of a given element x in array A, or returns None if x is not in A. Your algorithm is given the array A[1 · · · n] but does not know k. You can use C, C++, Java, or Python to solve this problem (ask the instructor if you have another programming language in mind). Python3 pls

In: Computer Science

*** Using Python *** Your program must prompt the user for their city or zip code...

*** Using Python ***

Your program must prompt the user for their city or zip code and request weather forecast data from openweathermap.org. Your program must display the weather information in an READABLE format to the user.

Requirements:

  • Create a Python Application which asks the user for their zip code or city.
  • Use the zip code or city name in order to obtain weather forecast data from: http://openweathermap.org/
  • Display the weather forecast in a readable format to the user.
  • Use comments within the application where appropriate in order to document what the program is doing.
  • Use functions including a main function.
  • Allow the user to run the program multiple times.
  • Validate whether the user entered valid data. If valid data isn’t presented notify the user.
  • Use the Requests library in order to request data from the webservice.
  • Use Python 3.
  • Use try blocks when establishing connections to the webservice. You must print a message to the user indicating whether or not the connection was successful.

*** also formatted into imperial units. Site defaults into Kelvin. ***

In: Computer Science

1. What is the fundamental equation that guides changes to a weight wij in a BP...

1. What is the fundamental equation that guides changes to a weight wij in a BP network.   Describe its components.

2. Multi-layer BP neural networks have no proof of converging to an optimal solution. Is this true? If it is, then why do we bother to use them?

In: Computer Science

In this assignment you are going to create a Student class to demonstrate a Student object....

In this assignment you are going to create a Student class to demonstrate a Student object. Then create a StudentTest class to place the main method in, which demonstrates the Student object.

Student class should have the following instance variables:

  • firstName, middleName, lastName (String)
  • id (int)
  • grade (int)

Student class should have the following methods:

  • Set and Get methods for each variable
  • Constructor that sets all variables using Set methods that you defined.

Design the application in main that you create 10 student objects in main. You don’t need to get the input from the user; just provide some values you prefer. Also, create an ArrayList of type Student in main.

Once you create 10 student objects, add these objects into the ArrayList. Using enhanced for loop (which we sometimes call foreach loop), display the information of every student in your ArrayList

In: Computer Science

Safaricom service provider has assigned you a task in their software section to design an application...

Safaricom service provider has assigned you a task in their software section to design an application that can be used by wholesalers to buy their products. Your duty is to implement the data structure which can be used to store the inventory of the warehouse containing the products. The data structure should be able to add a product with an associated code indicating its likelihood to spoil, remove a product that is most likely to spoil, and return the overall number of products in the inventory.

i.          Describe the data structure you would use and give reasons.

ii.         With reference to algorithms, explain the terms time efficiency and space efficiency.

iii.        Describe a non-linear data structure. Give examples and operations in which you might perform on such a structure.         

In: Computer Science

C++ Question 2 You will read in data about the planets from a text file, and...

C++ Question 2

You will read in data about the planets from a text file, and then print out the data about that planet when the user requests the data. You will need to create a Planet Class (since this assignment does not cover templates, you are expected to split your class into .cpp and .h files), as well as a .cpp/.h library with the functions described below

Planet Class

For the first phase of the question, you will create a Planet class.

Include the iostream and fstream libraries in the Planet class so we can do the friend operator<<

Before the class definition, create a const integer that defines the number of planets as 9. (Yes, I am counting Pluto for the purposes of this assignment.)

The Planet class should have the following private members:
*
* A std::string with the planet's name
* A double that is the mean distance from the sun
* A double that is the circulation time around the sun
* A double that is the rotation time around own its own axis
* A long unsigned int that is the planet's equatorial radius in kilometers ;
* A double that is the planet's mass compared to earth ;
* An unsigned int that is the planet's number of moons ;

You will need to create a constructor that takes in all these values and stores them using a member initialization list.
* Remember that your member initialization list must be in the same order as the private members are listed in the class definition. Recall the reason why: we want to ensure effective pointer arithmetic when allocating these elements, so putting them in order will make your program run more efficiently.
Next, you should write a method that returns the Planet's Name.

Next, you should write an overloaded friend operator that prints out the information regarding the Planet. You may reference the format below to see a good output format. Here are a couple of crucial details to make it work:
* You will need to multiply the mean distance from the sun by 149500000 to get the number of kilometers
* Remember my "rules" for creating a friend operator<< in .h and .cpp
* Remember the importance of const and call by reference in the overloaded operator.

Function Library

For the second phase of the assignment, you will create functions to call the Planet objects, and these functions will be called in main

First, be sure to include the Planet.h library for the class

Second, include string and vector libraries in this .h file

You will need to write two functions in the .h/.cpp files

void getPlanets( std::ifstream& ifs, std::vector< Planet >& thePlanets );
In main, you will create an ifstream and a vector of Planets. In this file, you will read in from the file information about the Planets. The information is stored in the exact order that we made in the class.

The data may be found here at PlanetData.txt:

Mercury 0.387 0.241 58.815 2433 0.05 0
Venus 0.723 0.615 224.588 6053 0.82 0
Earth 1.000 1.000 1.000 6379 1.00 1
Mars 1.523 1.881 1.029 3386 0.11 2
Jupiter 5.203 11.861 0.411 71370 317.93 12
Saturn 9.541 29.457 0.428 60369 95.07 10
Uranus 19.190 84.001 0.450 24045 14.52 5
Neptune 30.086 164.784 0.657 22716 17.18 2
Pluto 39.507 248.35 6.410 5700 0.18


Use the while( ifs.good() ) to loop through the file. In each loop, create a temporary variable for each element, and then read in using the ifs >> operator. Once read in, create a temporary Planet using the constructor you wrote. Then, push that temporary Planet onto the vector.

bool getPlanetNameFromUser( std::string& planetName );

Prompt the user to enter a value from the command line, or "End" to terminate. If the user entered end, call exit(-1) to end the program. Otherwise, return true. planetName will store the value. Calling planetName by reference will save the input.


Main Program

For the third phase of the question, you will develop the program itself. In the main program:
* create a std::vector of Planets and an std::ifstream. (You may hardcode the Planet file into this program instead of reading from the command line)
* Then get the Planets from the file.
* Create a string to store the user's response
* Using a while loop, Get the Planet Name From the User and use the bool to determine whether to continue
* When we go inside the loop
* Create a long unsigned int to loop
* Iterate through the vector, and compare the Planet's name in each Planet in the vector
* For this internal while loop, it is important to check if the long unsigned int is less than the number of planets, and then check to see if the Planet's name is equal to the input
* Otherwise, you will get major issues with segmentation faults
* After the while loop completes, make an if statement
* First, check if the iteration value is less than the number of planets (for the same reason)
* Next, check if the name at the Planet at the iter location is equal to the string input by the user
* If both tests pass, use the Planet's operator<< to print the information to the user.

In: Computer Science