Write a recursive method that returns the number of 1’s in the binary representation of N. Use the fact that this is equal to the number of 1’s in the representation of N/2, plus 1, if N is odd

Answers

Answer 1

Answer:

Here is the recursive method NoOfOnes :

public static int NoOfOnes(int N)    { // method that takes number N as argument and returns the number of 1’s in the binary representation of N

       if(N==0)  { //base case 1

           return 0;        } //if the value of N is equal to 0 then method returns 0

       else if(N==1){ //base case 2

           return 1;        } // if the value of N is equal to 1 then method returns 1

       else if(N%2==1)  { //if N is odd (recursive case)

           return NoOfOnes(N/2)+1;   } //calls method recursively and divides N by 2 plus 1

       else{ //when N i even (recursive case)

           return NoOfOnes(N/2);   }   }   //calls method recursively and divides N by 2  to return number of 1's in binary representation of N

Explanation:

Here is the complete JAVA program:

import java.util.Scanner; //to take input from user

public class Main {

   public static int NoOfOnes(int N)    {//the method that takes number N as argument and returns the number of 1’s in the binary representation of N

       if(N==0)  { //base case 1

           return 0;        }

       else if(N==1){//base case 2

           return 1;        }

       else if(N%2==1)  {//recursive case when N is odd

           return NoOfOnes(N/2)+1;   }

       else{ //recursive case when N is even

           return NoOfOnes(N/2);   }   }    

public static void main(String[] args) { //start of main function

       Scanner scan = new Scanner(System.in); //creates object of Scanner

       System.out.print("Enter n: ");//prompts user to enter value of N

       int n = scan.nextInt(); //reads the value of n from use

 System.out.print("number of 1’s in the binary representation of " +n+" is: "+NoOfOnes(n)); } } //displays the number of 1’s in the binary representation of n

i will explain the working of the function with an example

Lets say N = 6

if(N==0) this statement evaluates to false as N is not 0

else if(N==1 this statement also evaluates to false as N is not 1

else if(N%2==1) this statement also evaluates to false because N is not odd. If we take modulo of 6 by 2 then the remainder is 0 because 6 is completely divisible by 2 so N = 6 is an even number. So the else part is executed:  

       else{

           return NoOfOnes(N/2);}

This statement calls NoOfOnes recursive by passing N/2 to the method. So this becomes:

return NoOfOnes(6/2)

6/2 = 3

NoOfOnes(3)

Now this method is called again with the value of N = 3. Since 3 is an odd number so the recursive case of odd N is executed:

else if(N%2==1)  {

           return NoOfOnes(N/2)+1;   }

NoOfOnes(3/2)+ 1

NoOfOnes(1) + 1

Now the method is called again with value of N=1. The base case 2 is executed because N==1 which returns 1

else if(N==1){

           return 1;   }

So this becomes

NoOfOnes(1) + 1

1 + 1

= 2

So the method return 2 as the number of 1’s in the binary representation of N = 6

Hence the output of the above program with N = 6 is

number of 1’s in the binary representation of 6 is: 2          

Write A Recursive Method That Returns The Number Of 1s In The Binary Representation Of N. Use The Fact

Related Questions

Select the correct answer from each drop-down menu. What skills should Tara hone to get a job in testing? Tara is a recent computer science graduate. After completing a three-month internship at an IT firm, she decides to become a tester. Since Tara is trying to get a job as a tester, she should concentrate on improving her and skills in order to get the desired job.

Answers

What’re the choices?

Answer:

heres your answer

Explanation:

have a good day <3

Write a program that reads in any number of MyStrings of characters from the user and determines if each MyString is a palindrome. The user will terminate each MyString by pressing the return (or enter) button. The user will indicate that there are no more MyStrings by entering "quit". The function must be recursive and must not call any other functions.

Answers

Answer:

Here is the recursive function:

bool isPalindrome(string& MyString,int start, int end){    // function that takes as argument a string and two arguments that are bounds indices

       while(start < MyString.length() && !isalpha(MyString[start])){  //while loop continues to execute as long as start does not exceed the length of the string AND does not point to a alphabetic letter

           start++;         } // increments start by 1 moving it to point the next  character

       while(end >= 0 && !isalpha(MyString[end])){  //while loop continues to execute as long as end does not gets less than 0 AND does not point to a alphabetic letter

           end--;         }    // decrements end by 1 moving it to point the next  character backwards

       if(start > end){  //the base case

           return true;        

       } else {    //recursive case

           return ( ( toupper(MyString[start]) == toupper(MyString[end]) ) && isPalindrome(MyString,start+1,end-1));         }    }  //The recursive case is to AND the result of comparing the  alphabetic letters at start and end with result of the function  (called recursively) after without both of the letters

Explanation:

Here is the complete C++ program:

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

#include <cctype>  //functions to manipulate characters

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

bool isPalindrome(string&,int start, int end);  // function prototype

int main(){  //start of main function

       string MyStrings;        //declare a string type variable to hold string of characters

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

       getline(cin,MyStrings );  //gets and reads the string from user

       while(MyStrings != "quit"){        // continues to take input from user until user enters quit

       if(isPalindrome(MyStrings ,0,MyStrings.length()-1)== true){  //calls function that checks if the string is a palindrome

       cout<<MyStrings<<" is a Palindrome\n";}  //if the input string is a palindrome then display this message

       else  

       {cout<<MyStrings<<" is not a Palindrome\n";}  //if the input string is not a palindrome then displays this message

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

       getline(cin,MyStrings); }    }        //reads a string from user

   bool isPalindrome(string& MyString,int start, int end){  //function definition        

       while(start < MyString.length() && !isalpha(MyString[start])){  

           start++;         }          

       while(end >= 0 && !isalpha(MyString[end])){

           end--;         }        

       if(start > end){

           return true;        

       } else {              

           return ( ( toupper(MyString[start]) == toupper(MyString[end]) ) && isPalindrome(MyString,start+1,end-1));         }    }

             

I will explain the working of the function:

First the start variable is pointed to the start of the MyString and the end variable points to the last character of MyString    

while(start < MyString.length() && !isalpha(MyString[start]))

The above statement has a while loop which continues to execute as long as start does not exceed the string length and  it does not point to a letter. It has a AND logical operator that means both the above condition have to be true in order to continue this while loop. Here isalpha() method is used that checks if the letter/character of MyString is an alphabet or not. At each iteration start is incremented to 1 to point the next  character of MyString.

while(end >= 0 && !isalpha(MyString[end]))

The above statement has a while loop which continues to execute as long as end does not becomes less than 0 and  it does not point to a letter, Here isalpha() method is used that checks if the letter/character of MyString is an alphabet or not. At each iteration end is decremented to 1 to point the next  character of MyString in backward or in reverse order.

if(start > end){  

The above statement is a base case which is the IF condition that checks if the start is greater than end. This basically shows that there are no more alphabetic characters and this base case returns true as it reads the same from both sides.

else {              

           return ( ( toupper(MyString[start]) == toupper(MyString[end]) ) && isPalindrome(MyString,start+1,end-1));         }    }

The above statement is a recursive part. It uses AND logical operator and compares the characters at start and end with the result of the function  after excluding both of the characters pointed by start and end.

The program along with its output is attached.

Mr. Edwards, a game designer, creates a game that draws attention to how real estate developers are causing the natural habitat of an
endangered species of bird to decline. Which option best describes this game?
ОА.
It is an entertainment-based game.
ОВ.
It is an advergame.
It is an educational game.
Ос.
OD.
It is an issues-based game.

Answers

Answer:

OB

Explanation:

Mr. Edwards the game designer is making it for education purposes so you can learn, it is for learning. So you know endangered species of birds.

Consider sorting n numbers stored in array A by first finding the smallest element of A and exchanging it with the element in A[1]. Then find the second smallest element of A, and exchange it with A[2]. Continue in this manner for the first n − 1 elements of A. Write pseudocode for this algorithm, which is known as selection sort. What loop invariant does this algorithm maintain? Why does it need to run for only the first n − 1 elements, rather than for all n elements? Give the best–case and worst–case running times of selection sort in Θ–notation.

Answers

Answer:

1. create the first array A

2. create the second array A1, the same length as array A.

3. create a loop to iterate over both arrays for a number of times specific to the length of the arrays, with a condition to get and pop only the minimum value of which arrays for every loop.

4. save both items to "a" for minimum value A and "b" for minimum value A1.

5. call a function to push the "a" variable value to A1 and "b" variable value to the array A.

Explanation:

This code would interchange the values of both arrays, the best-case scenario for the code is O( n ) where n is the number of items in both arrays and worst is the best-case multiplied by the number of time to compare all the items with the minimum value.

What converts source code onto object code

Answers

Answer:

The Compiler

Explanation:

A compiler takes the program code (source code) and converts the source code to a machine language module (called an object file). Another specialized program, called a linker, combines this object file with other previously compiled object files (in particular run-time modules) to create an executable file

The direction of data transport is its built from the top and goes down and across the wire and read going up on the recieving computer?
True
False

Answers

Do u mean one direction

how to write a function that counts the letters in a string in C?

Answers

Answer:

Here is the C function that counts the letters in a string:

int LetterCount(char string[]){  //function to count letters in a string passed as parameter

 string[100];  // char type string with size 100

  int i, letters;  // letter variable stores the count for no. of letters in string

   i = letters = 0;  //initialize variables i and letters to 0

  while (string[i] != '\0')  { // loop iterates through the entire string until end of string is reached

    if( (string[i] >= 'a' && string[i] <= 'z') || (string[i] >= 'A' && string[i] <= 'Z') )  { // if condition checks the letters in the string

     letters++;    }  // increments 1 to the count of letters variable each time a letter is found in the string

    i++;  }  //increments value of i to move one character forward in string

   printf("Number of Letters in this String = %d", letters);   // displays the number of letters in the string

   return 0; }                              

Explanation:

Here the question means that the function should count the letters in a string. So the letters are the alphabets from a to z and A to Z.

Here is the complete program:

#include <stdio.h>   // to use input output functions

int LetterCount(char string[]){  // method that takes a character string as parameter and counts the letters in the string

string[100];  

int i, letters;

i = letters = 0;

while (string[i] != '\0')   {

 if( (string[i] >= 'a' && string[i] <= 'z') || (string[i] >= 'A' && string[i] <= 'Z'))

   {letters++;  }

   i++; }

   printf("Number of Alphabets in this String = %d", letters);  

   return 0;}  

int main(){  // start of main function

  char string[100];  //declares a char array of string

   printf("Please Enter a String : ");   //prompts user to enter a string

  fgets(string,100,stdin);  //get the input string from user

   LetterCount(string); } // calls method to count letters in input string

I will explain this function with an example

Lets suppose the user input "abc3" string

string[100] = "abc3"

Now the function has a while loop that while (string[i] != '\0')  that checks if string character at i-th position is not '\0' which represents the end of the character string. As value of i = 0 so this means i is positioned at the first character of array i.e. 'a'

At first iteration:

i = 0

letter = 0

if( (string[i] >= 'a' && string[i] <= 'z') || (string[i] >= 'A' && string[i] <= 'Z') )   if condition checks if the character at i-th position of string is a letter. As the character at 0-th position of string is 'a' which is a letter so this condition evaluates to true. So the statement letter++ inside if condition executes which increments the letter variable to 1. So the value of letter becomes 1. Next statement i++ increments the value of i to 1. So i becomes 1. Hence:

i = 1

letter = 1

At second iteration:

i = 1

letter = 1

if( (string[i] >= 'a' && string[i] <= 'z') || (string[i] >= 'A' && string[i] <= 'Z') )  

if condition checks if the character at i-th position of string is a letter. As the character at 1st position of string is 'b' which is a letter so this condition evaluates to true. So the statements letter++ inside if condition and i++ executes which increments these variables to 1. Hence:

i = 2

letter = 2

At third iteration:

i = 2

letter = 2

if( (string[i] >= 'a' && string[i] <= 'z') || (string[i] >= 'A' && string[i] <= 'Z') )  

if condition checks if the character at i-th position of string is a letter. As the character at 2nd position of string is 'c' which is a letter so this condition evaluates to true. So the statements letter++ inside if condition and i++ executes which increments these variables to 1. Hence:

i = 3

letter = 3

At fourth iteration:

i = 3

letter = 3

if( (string[i] >= 'a' && string[i] <= 'z') || (string[i] >= 'A' && string[i] <= 'Z') )  

if condition checks if the character at i-th position of string is a letter. As the character at 3rd position of string is '3' which is not a letter but a digit so this condition evaluates to false. So the statement letter++ inside if condition does not execute. Now i++ executes which increments this variable to 1. Hence:

i = 4

letter = 3

Now the loop breaks because while (string[i] != '\0') condition valuates to false as it reaches the end of the string.

So the statement: printf("\n Number of Letters in this String = %d", letters); executes which prints the value of letters on the output screen. Hence the output is:

Number of Letters in this String = 3

ABC incorporated wants to implement a TCP/IP network for its only site. It has 180 employees and two buildings and requires Internet access for an e-mail server, a single Web server, a single FTP server, and two routers, each with a single high speed Internet interface. If the company wants to hold ISP costs to an absulate minumum, what kind of IP addresses should they primarily use

Answers

Answer:

A private IP address should be implemented but a PAT and a static NAT should be configured for the computers and the intermediate devices respectively.

Explanation:

There are two types of IP addresses, they are public and private addresses. The public address is an IP4 address routable on the internet while the private address is not routable.

Internet service providers do charge for the use of public IP addresses they render, which can be very costly. To reduce the company's expenses on the internet, the company is networked with private addresses and are mapped for network address translation ( NAT) which assigns a public global address to devices accessing the internet.

Match each of the following servers to its definition:
1. DNS
2. Web
3. E-mail
4. DHCP
5. Commerce
a. enables users to purchase items over the Internet
b. specifically deals with the SMTP communication method
c. translates a domain name into an IP address
d. delivers HTML documents on request
e. assigns users IP addresses for the duration of a session

Answers

Answer:

1. Commerce

2. E-mail

3. DNS

4. Web

5. DHCP

Explanation:

A server can be defined as a dedicated system either software or hardware that is used to provide specific services to other devices or programs, which are referred to as the clients. The following are the functions of various functions of server in cloud computing services;

a. Commerce: enables users to purchase items over the Internet.

b. E-mail: specifically deals with the SMTP communication method.

c. DNS: translates a domain name into an IP address.

d. Web: delivers HTML documents on request.

e. DHCP: assigns users IP addresses for the duration of a session.

what is computing networking​

Answers

A computer network is a group of computers that use a set of common communication protocols over digital interconnections for the purpose of sharing resources located on or provided by the network nodes.

Taking an online class doesn't require any special skills.
Please select the best answer from the choices provided
()T
()F
help pls

Answers

Answer:

F

Explanation:

It depends on whether the person has interest in it

The statement - "Taking an online class doesn't require any special skills" is false.

What is online class?

An online class is a course that is delivered through the Internet. They are often delivered via a learning management system, where students may monitor their course curriculum and academic progress, as well as communicate with their classmates and course teacher.

When taking an online class, one must be alert and prompt. Furthermore, certain material may be obscure owing to a communication barrier between the student and teacher.

The student must be able to grasp what the teacher is saying in a short period of time, and self-teaching abilities should be strengthened in distance online education. As a result, the supplied assertion is untrue.

Learn more about online class here:

https://brainly.com/question/13649312

#SPJ2

You want to decide whether you should drive your car to work or take the train. You know the one-way distance from your home to your place of work, and the fuel efficiency of your car (in miles per gallon). You also know the one-way price of a train ticket. You assume the cost of gas at $4 per gallon, and car maintenance at 5 cents per mile. Write an algorithm to decide which commute is cheaper.

Answers

Explanation:

Remember, an algorithm in simple words means a set of instructions or steps to be followed in other to solve a problem.

Note, to decide which commute is cheaper, it means the output of the algorithm should be the cheaper way to commute.

Using pseudocode do the following;

determine the inputs and outputs of the problem arrange the identified problem into micro-tasksdescribe each micro-tasks in the pseudocode Test the pseudocode by solving the problem.

                       

When using SSH to remotely access a Cisco router, can you see the terminal password?

Answers

Answer:

No, you can't.

Explanation:

SSH is an acronym for Secure Socket Shell and is a networking protocol used for providing remote authentication through a public-key cryptography over an unsecured network such as the internet.

Hence, it is a network protocol that is commonly implemented by using a client-server model; where a computer acts as a SSH client while the other network device acts as the host or SSH server.

When using SSH to remotely access a Cisco router, you cannot see the terminal password because it is Linux based and encrypted through the use of symmetrical encryption, asymmetrical encryption or hashing

In the file MajorSalary, data have been collected from 111 College of Business graduates on their monthly starting salaries. The graduates include students majoring in management, finance, accounting, information systems, and marketing. Create a PivotTable in Excel to display the number of graduates in each major and the average monthly starting salary for students in each major.

Answers

Answer:

The pivot table is attached below

Explanation:

procedure used to create the Pivot Table

select insert from worksheet Ribbonselect pivot tableselect the range of Dataselect   "new worksheet "select Major as row heading and the summation symbol to count the majorinput variables given in their right cells

after this procedure the table is successfully created

Attached below is the Pivot Table in Excel displaying The number of graduates in each major and average monthly salaries

If someone you don”t know asks where you go to school, what should you do?

Answers

Answer:come up something that sounds real but is not true.

Explanation: The reason why is because they could look it up if you tod them the real answer and then follow you and kidnap you and they could do a school shooting it"s not lying it's not it's protecting your self and others.#bettersafethansorry

The right thing to do when  someone you don't know asks where you go to school, is do not respond.

Why talking to stranger has its cons?

The act of talking to Strangers is one that can help a person to know more about a thing but it also has its disadvantage.

Conclusively, note that someone asking you about where you school may want to harm you or do some really bad and as such it is better not to respond when someone you don't know asks where you go to school.

Learn more about school from

https://brainly.com/question/6947486

#SPJ2

Which of the following statements is not true?A. A structured chart is a sequential representation of program designB. the Real-Time system is a particular case of a on-line-systemC. Batch totals are not incorporated while designing real-time applicationsD. 4GLs are used for application proto typingE. None of the above

Answers

Answer:

A structured chart is a sequential representation of program design

Explanation:

It is true that a real-time system which is a term to describe an operating system working in relation to real-time is actually a form of the online system. Hence, option B is not correct.

It is also true that Batch totals are not incorporated while designing real-time applications because Batch Data processing is carried out in a separate manner and at a time when the computer is free. Thus Option C is not Correct

It is also true that 4GL which stands for Forth generation programming language is used for application prototyping. Again Option D is not Correct.

However, a structured chart is not a sequential representation of program design, but rather a break down to the infinitesimal module in the program design. Hence, option A is the correct answer.

How does Wireshark differ from NetWitness Investigator?

Answers

Answer is given below

Explanation:

Wireshark differ from NetWitness Investigator because Windshark shows a detailed view of individual packets. WireShark captures live traffic and displays the results at the packet level. Netwitness shows a high-level view and can be compared to the new packet capture NetWitiness Investigator provides a comprehensive overview of previously tracked traffic that can be used to view anomalies, compliance and attacks.

If you have a second Ethernet adapter, which network location is being used by the adapter?

Answers

Answer:

Public network

Explanation:

The network includes different networks and settings for sharing which are applied to the network which you are connected to.

A public network is being used by the adapter. The public network is a network that is unrestrictive. That is, any member of the public can easily have access to it and connect to the internet. Such a network exposed users to risks by exposing the connected devices.

Which of these is the largest?
terabyte
exabyte
gigabyte
kilobyte
PLEASE HELP

Answers

Answer: Exabyte

Explanation:

I took the Quiz

. (a) Prove or disprove carefully and in detail: (i) Θ is transitive and (ii) ω is transitive. (b) Assume n is a positive integer. Algorithm A(n: int) int z = 0; int temp = 0; for (int i = 0; i < n ; i++) { for (int j = 0 ; j < i ; j++) { int temp = i + j ; int z = z + temp; } } System.out.println(z) ; What is the input size for Algorithm A? Analyze carefully and explicitly the time complexity of A in terms of the input size. Show all steps. Is A a polynomial time algorithm? Justify your answer.

Answers

Answer:

The Following are the solution to this question:

Explanation:

In Option a:

In the point (i) [tex]\Omega[/tex] is transitive, which means it converts one action to others object because if [tex]\Omega(f(n))=g(n)[/tex] indicates [tex]c.g(n)<=f(n)[/tex]. It's true by definition, that becomes valid. But if [tex]\Omega(g(n))=h(n)[/tex], which implies [tex]c.h(n)<=g(n)[/tex]. it's a very essential component. If [tex]c.h(n) < = g(n) = f(n) \[/tex]. They  [tex]\Omega(f(n))[/tex]   will also be [tex]h(n)[/tex].  

In point (ii), The  value of [tex]\Theta[/tex] is convergent since the [tex]\Theta(g(n))=f(n)[/tex]. It means they should be dual a and b constant variable, therefore [tex]a.g(n)<=f(n)<=b.g(n)[/tex] could only be valid for the constant variable, that is  [tex]\frac{1}{a}\ \ and\ \ \frac{1}{b}[/tex].

In Option b:

In this algorithm, the input size value is equal to 1 object, and the value of  A is a polynomial-time complexity, which is similar to its outcome that is [tex]O(n^{2})[/tex]. It is the outside there will be a loop(i) for n iterations, that is also encoded inside it, the for loop(j), which would be a loop[tex](n^{2})[/tex]. All internal loops operate on a total number of [tex]N^{2}[/tex] generations and therefore the final time complexity is [tex]O(n^{2})[/tex].

does Buzz or APEX shows all your due assignments on the left of the main home screen?

Answers

Answer:

go to your dashboard and press the number under grade to date (your percentage in the class) and it should show all your assignments that you have done and that still need to be done

which of the following are bee per frame attribute​

Answers

Explanation:

where are the choices

Smart home appliances typically include which of the following?

Answers

Answer:

Smart home-enabled devices can include appliances like refrigerators, washing machines, dryers, and toaster ovens, as well as heating and air conditioning units and lighting devices.

Explanation:

Smart home appliances include;

Sensors that collect information.WIFI Combability.The ability to send notifications to a smartphone app.

What is a smart home appliance?

A smart home is known to be home equipment that helps homeowners to control appliances, thermostats, lights, etc.

They are known to be used remotely via a smartphone or tablet through the aid of internet connection. They homes are often set up via wireless or hardwired systems.

Learn more about home appliances from

https://brainly.com/question/18713901

Write an application that determines which, if any, of the following files are stored in the folder where you have saved the exercises created in this chapter: autoexec.bat, CompareFolders.java, FileStatistics.class, and Hello.doc. The program should display the number of files found. For example, if two of the files are found display the message 2 of the files exist.

Answers

Answer:

Here is the JAVA application that determines which if any of the following files are stored in folder where you have saved the exercises created.

import java.nio.file.*;   // used to manipulate files and directories

import java.nio.file.attribute.*;  //used to provide access to file and file attributes

import static java.nio.file.AccessMode.*;  // provides access modes to test the accessibility of a file

import java.io.IOException;  //for exception handling

class FindSelectedFiles {

public static void main(String[] args) { //start of main function

   Path f1 = Paths.get("/root/sandbox/autoexec.bat"); //creates Path object f1 using Paths.get() method and this instance contains the file name and directory list used to construct the specified path

   Path f2 = Paths.get("/root/sandbox/CompareFolders.java");  //creates Path object f2 using Paths.get() method and this instance contains the file name and directory list used to construct the specified path

   Path f3 = Paths.get("/root/sandbox/FileStatistics.class");   //creates Path object f3 using Paths.get() method and this instance contains the file name and directory list used to construct the specified path

   Path f4 = Paths.get("/root/sandbox/Hello.doc"); //creates Path object f4 using Paths.get() method and this instance contains the file name and directory list used to construct the specified path

   int count=0; //used to count the number of files found  

try{  // used to define a code chunk to be tested for errors

 f1 = Paths.get("/root/sandbox/autoexec.bat");  // Converts a path string when joined form a path string to a Path

 System.out.println(f1);  //prints the file

     /* getFileSystem method is used to return the file system that created this Path object f1 and checkAccess Verifies access and throws exception if something is wrong

 f1.getFileSystem().provider().checkAccess(f1);  

 System.out.println(f1 +" File Exists\n");  //if file exists then displays this message

 count++;  }  //adds 1 to the count of number of files found

 catch (IOException e) {  //a code chunk to be executed if error occurs in the try part

  System.out.println("File Doesn't Exist\n"); }  //if file not found displays this message

   

try{  //works same as above try block but for 2nd folder and object f2

 f2 = Paths.get("/root/sandbox/CompareFolders.java");

 System.out.println(f2);

 f2.getFileSystem().provider().checkAccess(f2);

 System.out.println(f2 +" File Exists\n");

 count++;  }

 catch (IOException e) {

  System.out.println("File Doesn't Exist\n"); }

   

try{  //works same as above try block but for 3rd folder and object f3

 f3 = Paths.get("/root/sandbox/FileStatistics.class");

 System.out.println(f3);

 f3.getFileSystem().provider().checkAccess(f3);

 System.out.println("File Exists\n");

 count++; }

 catch (IOException e) {

  System.out.println("File Doesn't Exist\n"); }

   

try{  //works same as above try block but for 4th folder and object f4

    f4 = Paths.get("/root/sandbox/Hello.doc");

    System.out.println(f4);

 f4.getFileSystem().provider().checkAccess(f4);

 System.out.println(f4 +" File Exists\n");

 count++; }

 catch (IOException e) {

  System.out.println("File Doesn't Exist\n"); }

   

   System.out.println(count+" of the files exist");  }  } //displays the number of files found

Explanation:

If you want to directly pass the file name as argument to Paths.get() method then you can use the following code:

   Path f1 = Paths.get("autoexec.bat");

   Path f2 = Paths.get("CompareFolders.java");

   Path f3 = Paths.get("FileStatistics.class");

   Path f4 = Paths.get("Hello.doc");

The program determines if any, of the files from autoexec.bat, CompareFolders.java, FileStatistics.class, and Hello.doc. are stored in the folder. If a file is found then the program displays the message File exists and add 1 to the count variable each time a file is found. If all the files are found then the program returns the count as 4 otherwise the program display the number of files found by displaying the computed final value of count in the output. Lets say all the files are found then the output of the above program is:

autoexec.bat                                                                                                                                                   autoexec.bat File Exists  

                                                                                                                                                      CompareFolders.java                                                                                                                                            CompareFolders.java File Exists                                                      

                                                                                                                                                         FileStatistics.class                                                                                                                                           File Exists                                                                                        

                                                                                                                                                     Hello.doc                                                                                                                                                      Hello.doc File Exists  

   

4 of the files exist    

Select the correct answer.
Steve is a recruiter for a large graphic design company. He is looking for a candidate who can translate any vision into reality and make tough decisions. Which quality is he looking for in an employee?
A.
teamwork
B.
leadership
C.
honesty
D.
dedication
E.
self-motivation

Answers

Answer:

D

Explanation:

Hard work and dedication prove that you will be there and do what you need to.

Answer:

isnt it leadership

Explanation:

making tough descisions..

An optimal solution to an Operations problem will yield:____________

Answers

Answer:

The best solution.

Explanation:

In the operations and management of systems such as manufacturing, transport, government, network, service systems, we encounter various type of challenges and problems. These challenges and problems must be fixed or resolved as soon as possible in order to restore normal operations, as well as ensuring that the solution mitigates the occurrence of such problems in the future.

Hence, an optimal solution to an Operations problem will yield the best solution because it gives the maximum functionality. For instance, an optimal solution is considered to be the best solution because it gives the least cost, effective and efficient or gives the most profit.

2.13) A simple rule to estimate your ideal body weight is to allow 110 pounds for the first 5 feet of height and 5 pounds for each additional inch. Write a program that reads the data in the file and outputs the full name and ideal body weight for each person. In the next chapter, you will learn about loops, which allow for a more efficient way to solve this problem.

Answers

Answer:

import csv

def ideal_weight( filename ):

   with open( "filename", "r" ) as file:

       for row in csv.DictReader( file):

           print ( "Name of person: ",row["name"] )

           person_weight = ( 110 * row["height"] )/ 5

           print ( "Ideal weight: ", person_weight )

Explanation:

The python source code above is a function which recieves a csv file argument, opens the file and reads each row an ordered dictionary. The function prints the name of each person in the file and their ideal weight.

which data type could be used for the field, remark or comment? ​

Answers

Answer:

While CLOB/NCLOB types may seem attractive, they are not nearly as efficent as [N]VARCHAR for most of the functions you would usually want to run on them, and anyone who can't comment in 2000 or 4000 characters isn't likey to generate a comment you'd want to use anyway.

copied from google

hope that helps

Consider that an individual threat agent, like a hacker, can be a factor in more than one threat category. If a hacker breaks into a network, copies a few files, defaces a Web page, and steals credit card numbers, how many different threat categories does the attack fall into

Answers

I think the answer is 5 categories but I am not sure

In an event, it is when an object moves from a prior state to a subsequent state.
a. True
b. False

Answers

Answer:

a. True

Explanation:

Objects suffer inertia before a transition is achieved.  Transition is the movement of an object from one state to another.  But, this transition does not happen on its own.  It is usually triggered by an event or series of events.  This means that when the object moves from its prior state to a subsequent state, an event must have occurred to trigger the transition.  Objects, therefore, depend on events or an outside force to remove their inertia.  They are usually in a state of inertia until an outside stimulus stimulates them with some momentum.

Other Questions
How did the development of irrigation improve agricultural output during the Neolithic era? Why might a person who is dehydrated from heat have blood that is hypertonic compared to a normally hydrated individual? The tone at breakfast the morning after the family receives the monkeys paw is best described as Why do some Europeans view immigrants as a threat? Choose All That Apply. - They create negative population growth.- They dilute European culture.- They increase the threat of terrorism.- They take jobs from "natives."- They remodel cities.- They move to rural areas. Read the paragraph.Rats are like dogs in many ways, which makes them good pets. They can be trained like dogs. They also love to play.Which sentence should come next in the paragraph to best maintain the compare-and-contrast text structure?Both of them dont take up a lot of space.As well as they dont take up a lot of space.Instead, they dont take up a lot of space.However, they dont take up a lot of space. ??????????????????????????????? is there two characteristics of a plant cell if it is then tell me pls Explain how fossils provide evidence of organisms on Earth?Fossils are preserved physical evidence of organisms that lived on Earth.All organisms have been fossilized which allows us to see what organisms existed before.All fossil records have been found that provides evidence of all animals found on Eartho Fossils provide evidence that a meteor hit Earth a long time ago. what happens first during cellular respiration 3. Jack & Jill went up the hill to fetch a pail of water. At the well, Jill used a forceof 20.0 N to turn the crank handle of radius 0.400 m to rotate the axle of radius0.100 m, so she could raise the 60.0 N bucket of water. A) What is the idealmechanical advantage of the wheel? B) What is the actual mechanical advantageof the wheel? C) What is the efficiency of the wheel? he Foundational 15 [LO1-1, LO1-2, LO1-3, LO1-4, LO1-5, LO1-6] [The following information applies to the questions displayed below.] Martinez Companys relevant range of production is 7,500 units to 12,500 units. When it produces and sells 10,000 units, its average costs per unit are as follows: Average Cost per Unit Direct materials$6.00 Direct labor$3.50 Variable manufacturing overhead$1.50 Fixed manufacturing overhead$4.00 Fixed selling expense$3.00 Fixed administrative expense$2.00 Sales commissions$1.00 Variable administrative expense$0.50 Foundational 1-1 Required: 1. For financial accounting purposes, what is the total amount of product costs incurred to make 10,000 units? Which would be a better example of light energy to electrical energy? Solar panels or flashlights? evaluate the expression14.549 - (8.131 + 3.7024)ANYONE WHO ANSWERS GETS A BRAINLIEST ANSWER OR THANKS Fill in the blank.-6 + ____ = -6 what is the primary audience in this text.......Did you know that some monkeys in Thailand teach their young to floss? If monkeys can do it, so can we! It is so important to teach our children healthy habits when it comes to oral hygiene. There are many simple strategies you can use when teaching young kids to brush, floss, and make healthy choices about eating and drinking.there are No answer choices Choose the correct "If...then.." form of the statement:All zonks are widgets.o If it is a zonk, then it is a widget.O If it is a widget, then it is a zonk.o If it is not a zonk, then it is a widget.O if it is a widget, then it is not a zonk. HELP PLS IF U FDONT KNOW DO NOT ANSWER 1. Why do youthinkHannibalfollowedthecoastline? Use the graph of a quadratic function to find the following: a. VertexB. Axis of symmetry C. Y-interceptD. X-interceptE. Domain and rangeDont mind my answers Solve the following equation 2(x+5)=24