In a class, why do you include the function that overloads the stream insertion operator, <<, as a friend function? (5, 6)

Answers

Answer 1

Answer:

To provide << operator access to non-public members of the class.

Explanation:

Whenever we overload << operator, an object to ostream class has to be passed as this is the class which has properties which allows printing of output to console. Moreover, this operator is used outside class all the time so if not made a global member it will produce conflicts so thats why it has to be made a friend function to allow efficient access to private members of the class. Its declaration inside class is as follows :

friend ostream& operator<<(std::ostream& os, const T& obj) ;


Related Questions

Create a Python program to solve a simple payroll calculation. Calculate the amount of pay, given hours worked, and hourly rate. (The formula to calculate payroll is pay.

Answers

Answer:

The Python code is given below with appropriate comments

Explanation:

hoursWorked=input("Enter number of hours worked:")   #hours worked

hW=int(hoursWorked)      #to convert the string input to integer

hourlyRate=input("Enter Hourly Rate:")

hR=float(hourlyRate)     #to convert the string input to floating point number

print "Hours Worked=",hW,", Hourly Rate=",hR,", Pay=",hW*hR

The program is a sequential program, and does not require loops and conditions

The payroll program in Python, where comments are used to explain each line is as follows:

#This gets input for the number of hours worked

hours = int(input("Hours worked :"))

#This gets input for the hourly rate

rate=float(input("Hourly Rate :"))

#This calculates the pay

pay = hours * ray

#This prints the pay

print("Pay =",pay)

Read more about payroll calclations at:

https://brainly.com/question/15858747

The Account class contains a definition for a simple bank account class with methods to withdraw, deposit, get the balance and account number, and return a String representation. Modify the file as follows:1. Overload the constructor as follows:a. public Account (double initBal, String owner, long number) - initializes the balance, owner, and account number as specified.b. public Account (double initBal, String owner) - initializes the balance and owner as specified; randomly generates the account number.c. public Account (String owner) - initializes the owner as specified; sets the initial balance to 0 and randomly generates the account number.2. Overload the withdraw method with one that also takes a fee and deducts that fee from the account.

Answers

Answer:

I've updated the Account class as per the instructions. The instructions mention "the constructor for this class creates a random account number" although I didn't find where that was. As a result, I created a simple method to generates the account number (located at the bottom of the class). Be sure you understand the changes (highlighted in yellow) and feel free to ask follow-up questions:

Explanation:

//*******************************************************

// Account.java

//

// A bank account class with methods to deposit to, withdraw from,

// change the name on, and get a String representation

// of the account.

//*******************************************************

import java.util.Random;   // Used for Random # generator

public class Account

{

      private double balance;

  private String name;

     private long acctNum;

      //----------------------------------------------

 //Constructor -- initializes balance, owner, and account number

  //----------------------------------------------

 public Account(double initBal, String owner, long number)

{

        balance = initBal;

               name = owner;

            acctNum = number;

}

// !!!!!! New Constructor !!!!!!

public Account(double initBal, String owner)

     {

        balance = initBal;

               name = owner;

            acctNum = generateAccountNumber();

       }

  // !!!!!! New Constructor !!!!!!

 public Account(String owner)

     {

        balance = 0;

             name = owner;

            acctNum = generateAccountNumber();

       }

   //----------------------------------------------

 // Checks to see if balance is sufficient for withdrawal.

// If so, decrements balance by amount; if not, prints message.

  //----------------------------------------------

 public void withdraw(double amount)

      {

        if (balance >= amount)

                balance -= amount;

               else

                     System.out.println("Insufficient funds");

}

 // !!!!!! New withdraw() method !!!!!!

   public void withdraw(double amount, double fee)

  {

        double amountWithFee = amount + fee;

               if (balance >= amountWithFee)

                 balance -= amountWithFee;

        else

                     System.out.println("Insufficient funds");

}

   //----------------------------------------------

 // Adds deposit amount to balance.

       //----------------------------------------------

 public void deposit(double amount)

       {

        balance += amount;

       }

  //----------------------------------------------

 // Returns balance.

      //----------------------------------------------

 public double getBalance()

       {

        return balance;

  }

    //----------------------------------------------

 // Returns a string containing the name, account number, and balance.

    //----------------------------------------------

 public String toString()

 {

        return "Name:" + name +

          "\nAccount Number: " + acctNum +

         "\nBalance: " + balance;

 }

 // !!!! NEW PRIVATE HELPER METHOD TO GENERATE ACCOUNT NUMBERS !!!!!

//-------------------------------------------------------

// Returns a random account number between 10000 - 99999

 //--------------------------------------------------------

       private long generateAccountNumber()

     {

        Random r = new Random();        // Seed the random number genertor with the system time

         return 10000 + r.nextInt(89999);        // .nextInt(89999) will return a value between 0 and 89999)

      }

}

Last year the major search engine stopped providing the keyword data when they forwarded the organic users who clicked over from their search results page. What this means is that the site receiving the visitor no longer could determine the performance of users and the specific keywords they used on the search engine to get to the site. In other words, the site's visibility of visitor history was significantly decreased.What effect do you think this had on the volume of traffic?

Answers

Answer:

This action by major search engine  would reduced the volume of traffic for site receiving the users from the search engine.

Explanation:

In order to get a better understanding of the answer above let first understand, what a keywords are.

Keywords are ideas and topics that define what the content of your website is about. In terms of SEO (Search Engine Optimization:it is the process that organizations go through to help make sure that their site ranks high in the search engines for relevant keywords and phrases) they're the words and phrases that searchers enter into search engines. These keyword are important because they are like a bridge between what people are searching for and the content you are providing to fill that need.

When this major search engine stopped providing this keyword data it meant that for those website who relied on those keywords to optimize their website in other to be top ranked on this major search engine and gain more traffic would no longer be able to gain access to these keyword and hence would fall in ranking on this major search engines and this in turn this would reduce the traffic to their website.    

What tools you need to use to migrate Metadata to Two Different Production Orgs?

A. Force.Com Migration Tool
B. Change Set
C. Force.Com IDE
D. Data Loader
E. Unmanaged Package

Answers

Answer:D.

Explanation:I just did this and d is right

Write a JavaScript program that asks a user for their name, then, uses a function to do the following:

1. reverses the name;
2. replaces all the vowels with asterisks (*);
3. takes the first two letters and then adds a random number between 100 and 300 to it. The results should be written to the browser window using "document.write". Post the code to your solution below.

Answers

Answer:

       function DoStuff(name) {

           document.write('Reversed: ', name.split("").reverse().join(""), '<br/>');

           document.write('Masked vowels: ', name.replace(/[aeiouy]/ig, '*'), '<br/>');

           document.write('First two with number: ', name.slice(0, 2) + Math.floor(Math.random() * (300 - 100 + 1) + 100), '<br/>');

       }

       const name = prompt("Please enter your name", "Brainly exercise");

       DoStuff(name);

Explanation:

Brainly won't let me paste html here, so I'm just showing you the javascript. Let me know if you don't know how to embed this in a page. I'm a bit unsure about subassignment number 3. Does 'add' mean 'append' here?

You are designing a distributed application for Azure. The application must securely integrate with on-premises servers. You need to recommend a method of enabling Internet Protocol security (IPsec)-protected connections between on-premises servers and the distributed application. What should you recommend?

Answers

Answer:

Azure Site-to-Site VPN

Explanation:

Distributed applications are computer softwares that run and work with each other on different computers that are registered under a network to execute a specific task.

And the method of enabling Internet Protocol security (IPsec)-protected connections between on-premises servers and the distributed application is a Site-to-Site VPN.

Azure Site-to-Site VPN gateway connection is used to securely integrate with on-premises servers. It is used to send encoded messages.

Answer:

Azure Site-to-Site VPN

Explanation:

First of all what is a distributed application

According to Techopedia  

 A distributed application is software that is executed or run on multiple computers within a network. These applications interact in order to achieve a specific goal or task.  

Azure distributed applications are software that run on Azure which is a cloud base technology that not only provides an Application Hosting environment, but also a full-scale Development Platform.  

In order to understand why this answer for this question we need to also understand what an On-premises server is.

On-premises:  

This can be defined as a computer application that is always found at a company's data center instead of running it on a hosted server or in the cloud  

Now an Azure Site-to-Site VPN is the recommended method for enabling Internet Protocol security (IPsec)-protected connections between on-premises servers and the distributed application because IPsec can be used on Site-to-Site VPN, and Distributed applications can used the IPSec VPN connections to communicate.

Universal Containers uses a custom field on the account object to capture the account credit status. The sales team wants to display the account credit status on opportunities Which feature should a system administrator use to meet the requirements?

Answers

Answer:

Cross-object formula field

Explanation:

A Cross-object formula is a formula which does span two related objects, and then references merge fields on those same objects. Which makes it the best feature for the system administrator to display the account credit status on opportunities.

Suppose that you have been running an unknown sorting algorithm. Out of curiosity, you once stopped the algorithm when it was part-way done and examined the partially sorted array. You discovered that the first K elements of the array were sorted into ascending order, but the remainder of the array was not ordered in any obvious manner.

Based on this, you guess that the sorting algorithm could likely be:

Shell's Sort

heapsort

quicksort

merge sort

insertion sort

Answers

The sorting algorithm could likely be: insertion sort.

Insertion Sort

Explanation:

There are may sort is available in programming languages, in this situation  Insertion sort method is used. Here, in insertion sort, the array elements are compared with each other cells and find the smallest value from cells pushed front thus, forming a sorted ascending ordered array.

If we stop the algorithm midway, we would get a sorted array till where the iteration is stopped and the other elements are not sorted or ordered in any way. This sort is only used to find a small number from the array, thus it is easier sorting technique than others.

Write a MATLAB function named mag_force Inputs: (No input validation is required) 1. a scalar value representing charge 2. a 1x3 vector representing velocity 3. a 1x3 vector representing a magnetic field. 4. a 1x3 unit vector representing an axis. Output: 1. a scalar value calculated by taking the the charge times the cross product of velocity and magnetic field and then taking the dot product of that result with the unit vector of the axis F=q(v x B) Force = F . u Example: clc; format compact; e e]) mag_force (6, [1 2 3],[-2 0 1],[1 Should display this in the command window ans = 12 Your code should work for any set of inputs. Do not include test cases, clear all, etc as part of your submission.

Answers

Answer:

The implementation was done with 5 lines of codes given below

Explanation:

mag_force(6, [1 2 3], [-2 0 1], [1 0 0])

function Force = mag_force(q, v, B, u)

F = q .* cross(v, B);

Force = dot(F, u);

end %This brings an end to the program

% This display ans = 12 on the MATLAB command window

% indicating a right implementation

In the function below, use a function from the random module to return a random integer between the given lower_bound and upper_bound, inclusive. Don't forget to import the random module (before the function declaration). For example return_random_int(3, 8) should random return a number from the set: 3, 4, 5, 6, 7, 8 The whole point of this question is to get you to read the random module documentation.

Answers

Final answer:

To generate a random integer within an inclusive range in Python, use the 'randint' function from the 'random' module. Ensure the 'random' module is imported, then apply 'randint' with the desired range as its arguments.

Explanation:

To return a random integer between the given lower_bound and upper_bound, inclusive, you can use the randint function from Python's random module. Here is how you can implement the return_random_int function:

import random
def return_random_int(lower_bound, upper_bound):
   return random.randint(lower_bound, upper_bound)
Remember to import the random module before you define the function. The randint function will return an integer where the range includes both endpoints (lower_bound and upper_bound).

sing your knowledge of the employees table, what would be the result of the following statement:

DELETE FROM employees;

a. Nothing, no data will be changed.
b. All rows in the employees table will be deleted if there are no constraints on the table.
c. The first row in the employees table will be deleted.
d. Deletes employee number 100.

Answers

Answer:

b. All rows in the employees table will be deleted if there are no constraints on the table.

Explanation:

This is a MySql command.

DELETE FROM table_name [WHERE Clause]

If the where clause is not estabilished, as it happens in this example, the entire table will be deleted. The where clause is the constraint, that is, whichever row you want to delete.

The correct answer is:

b. All rows in the employees table will be deleted if there are no constraints on the table.

Discuss why it is common for XML to be used in interchanging data over the Internet. What are the advantages of using XML in data interchanging?

Answers

Answer:

Gives a clear structure for storing data

Explanation:

XML provide files that are clear to read and simple to produce, data are stored in form of text and in turn it is used as a transfer mechanism that defines how the structure or model should look like. XML is also usually described as a format that describes itself, and it is easy to learn and use.

Print "Censored" if userInput contains the word "darn", else print userInput. End with newline. Ex: If userInput is "That darn cat.", then output is:


Censored


Ex: If userInput is "Dang, that was scary!", then output is:


Dang, that was scary!


Note: If the submitted code has an out-of-range access, the system will stop running the code after a few seconds, and report "Program end never reached." The system doesn't print the test case that caused the reported message.


#include


#include


using namespace std;


int main() {


string userInput;


getline(cin, userInput);


int isPresent = userInput.find("darn");


if (isPresent > 0){


cout << "Censored" << endl; /* Your solution goes here */


return 0;


}

Answers

Answer:

if(userInput.indexOf("darn") != -1) {

        System.out.println("Censored");

     }

     else {

        System.out.println(userInput);

     }

Explanation:

The code segment is written in C++ and it must be completed in C++.

To complete the code, we simply replace  /* Your solution goes here */ with:

}

else{

   cout<<userInput;

}

The missing code segments in the program are:

The end curly brace of the if-conditionThe else statement that will print userInput, if string "darn" does not exist in the input string.

For (1), we simply write } at the end of the 9th line of the given code segment.

For (2), the else condition must be introduced, and it must include the statement to print userInput.

The complete code where comments are used to explain each line is as follows:

#include<iostream>

#include<string>

using namespace std;

int main() {

//This declares userInput as string

string userInput;

//This gets input for userInput

getline(cin, userInput);

//This checks if "darn" is present in userInput

int isPresent = userInput.find("darn");

//If isPresent is 0 or more, it means "darn" is present

if (isPresent >= 0){

//This prints Censored

   cout << "Censored" << endl;}

//If otherwise

else{

//The userInput is printed

cout<<userInput;

}

return 0;

} // Program ends here

See attachment for the complete code and a sample run

Read more about C++ programs at:

https://brainly.com/question/12063363

A local variable is a variable that can only be accessed in the region in which it was defined.

A. True
B. False

Answers

The answer to this question would be, A. True

Complete this assignment in Python 3.x. Make sure you have downloaded the software, and it is installed correctly.

You will code the following and submit it in one file. Use the information in the Lessons area for this week to assist you. Save it as a python file (.py), and upload it into the Assignments area.

Create a comment block (starts at line 1 in the code) with the following information:

Your Name
Course Name, Section (example: ENTD200 B002 Spr15)
Instructor name
Week #
Date completed
Problem 1: Create a list (or tuple only, no dictionary) that contains the months of the year. ( do not hardcode the number)
Problem 2: Create a loop to print the number and the months of the year from the list.
The output should like this:

Month 1 is January
Month 2 is February
….
….

Month 12 is December

Optional 1

Month 1 is January, ...Happy new year ( Do not use if-then)

The output will look like this

Month 1 is January , ...Happy New Year!
Month 2 is February, ...Happy Valentine!
Month 3 is March
Month 4 is April
Month 5 is May
Month 6 is June
Month 7 is July, ...Happy Fourth of July!
Month 8 is August
Month 9 is September
Month 10 is October, ...Happy Halloween!
Month 11 is November, ...Happy Thanksgiving!
Month 12 is December, ...Merry Christmas!

Optional 2
Modify the Payroll and/or the MPG program from week5/6 to store the results in a list/dictionary. Print the list/dictionary when no more calculation is selected.
The output will be something like this for the payroll

Payroll for week xyz
James Bond ....... 21,500
Al Bundy ....... 500
Johnny English ….. 1,200
Total Payroll ....... 23,200

For the MPG will be something like

MPG for zyz truck
Week 1 ..... 12
Week 2 ..... 33
Week 3 ..... 27
MPG Ave ..... 24

Answers

Answer:

The program code is completed below

Explanation:

Program Code:

"""

  Your Name

  Course Name, Section (example: ENTD200 B002 Spr15)

  Instructor name

  Week #

  Date completed

"""

months = ["January ", "February", "March", "April", "May", "June", "July"

, "August", "September", "October", "November", "December"]

for i in range(0,12):

print("Month",i+1, "is" , months[i])

g Define a write through cache design. A. A block of main memory may be loaded into any cache line. B. Each block of main memory is mapped to exactly one cache line. C. A block of main memory is mapped to a group cache lines. D. When the CPU writes a word, the data is immediately written both to cache and to main memory. E. When the CPU reads a word, the cache writes part of a block to memory.

Answers

Answer:

Option D is the correct answer.

Explanation:

"Write through cache" is a writing technique in which any data is written in memory and the cache at the same time to overcome the problem of loss of data. This is a concept of "Write through cache". It means that, if the data is written at the two positions at the same time then the loss of data problem is not occurring and the users can save the data.

Here in the question, option D states the same concept which is defined above. That's why Option D is correct. while the other option is not correct because-

Option "a" states about the block of memory which can load on the cache which is not states about the above concept.Option "b" states about the mapping concepts.Option "C" also states about the mapping concepts.Option "E" states to write that data on cache, which is read from the memory.  

The principal advantage of wireless technology is _____________ .

Answers

Answer:

The principal advantage of wireless technology is increased mobility.

Explanation:

The principal advantage is increased mobility, which means that you can access the network from wherever you are, as long you are in the network range.

For example, the wireless conection may be in the living room for example, and you may access the network from your bedroom, just a simple example.

So:

The principal advantage of wireless technology is increased mobility.

Write a program that first gets a list of integers from input (the first integer indicates the number of integers that follow). That list is followed by two more integers representing lower and upper bounds of a range. Your program should output all integers from the list that are within that range (inclusive of the bounds). For coding simplicity, follow each output integer by a space, even the last one. If the input is: then the output is: (the bounds are 0-50, so 51 and 200 are out of range and thus not output). To achieve the above, first read the list of integers into a vector. # include < iostream > # include < vector >

Answers

Answer:

The C program is given below. The code follows the instructions of the question. Follow both as you program for better understanding

Explanation:

#include <stdio.h>

int main()

{

   int n, min, max, i;

   int arr[20];

   

   scanf("%d",&n);

   

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

       scanf("%d",&arr[i]);

   }

   

   scanf("%d",&min);

   scanf("%d",&max);

   

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

       if(arr[i]>=min && arr[i]<=max){

           printf("%d ",arr[i]);

       }

   }

   

   return 0;

}

Final answer:

To write a program that outputs integers from a list within a given range, follow these steps: read the integers into a vector, specify the lower and upper bounds of the range, and loop through the vector to check if each integer is within the range.

Explanation:

To write a program that outputs integers from a list within a given range, you can follow these steps:

Read the first integer from the input, which represents the number of integers to followRead the remaining integers into a vectorRead the lower and upper bounds of the rangeLoop through the vector and check if each integer is within the rangeIf an integer is within the range, output it followed by a space

For example, if the input is [7, 12, 25, 51, 200, 5, 8, 40] and the range is 0-50, the program should output: 12 25 5 8 40

(Complete the Problem-Solving discussion in Word for Programming Challenge 2 on page 404. Your Problem-Solving discussion should include Problem Statement, Problem Analysis, Program Design, Program Code and Program Test in Words Document.) Create a program that will find and display the largest of a list of positive numbers entered by the user. The user should indicate that he/she has finished entering numbers by entering a 0.

Answers

Answer:

The approach to the question and appropriate comments are given below in C++

Explanation:

Problem statement:

Write a program that will find and display the largest of a list of positive numbers entered by the user. The user should indicate that he/she has finished entering numbers by entering a 0.

Problem Analysis:

It can be completed in worst-case O(n) complexity, best case O(1) (if the first number is maxed element)

Program Design:

1. Start

2. Take the list of positive numbers for the user until he/she enter 0.

3. store the entered numbers in an array

4. find the max number from it.

5. Print the output

6. End

Program Code:

#include<iostream>

using namespace std;

int main(){

  int num = 0, *array = NULL, i= 0, counter = 0, max = 0;

 

  cout<<"Enter a list of positive numbers to find the maximum out of it and if you enter 0 that is the last number: \n";

  array = new int;

 

  /*Taking input from user until he/she enters 0*/

  while(1){

      cin>>num;

      array[i] = num;

      i++;counter++;

      if(num == 0)

          break;  

  }

 

  cout<<"Print user input numbers: \n";

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

      cout<<"list["<<i<<"] --> "<<array[i]<<"\n";

  cout<<"\n";

 

  /*Find max element*/

  max = array[0];

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

      if(array[i] > max)

          max = array[i];  

  }

  cout<<"Max number = "<<max<<"\n";      

  delete array;  

  return 0;

}

What is displayed on the console when running the following program?

1. Welcome to Java, then an error message.
2. Welcome to Java followed by The finally clause is executed in the next line, then an error message.
The program displays three lines:

a. Welcome to Java,
b. Welcome to HTML,
c. The finally clause is executed, then an error message.
d. None of these.

Answers

I guess there should be the program code in your question. I presume that the complete version of your question is the following:

What is displayed on the console when running the following program?

public class Test {

 public static void main(String[] args) {

   try {

     System.out.println("Welcome to Java");

     int i = 0;

     int y = 2 / i;

     System.out.println("Welcome to HTML");

   }

   finally {

     System.out.println("The finally clause is executed");

   }

 }

}

A.  Welcome to Java, then an error message.

B.  Welcome to Java followed by The finally clause is executed in the next line, then an error message.

C.  The program displays three lines: Welcome to Java, Welcome to HTML, The finally clause is executed, then an error message.

D.  None of the above.

Answer to the complete question with explanation:

B.     Welcome to Java followed by The finally clause is executed in the next line, then an error message

After entering try/catch block program will output "Welcome to Java".

Then ArithmeticException will be raised at line:

int y = 2 / i;

The reason is division by 0 because i = 0.

After that finally clause will be executed despite exception thrown which will output "The finally clause is executed".

There could be a chance that you have modified answers to your question. In that case:

Answer to the original question:

a. Welcome to Java,

c. The finally clause is executed, then an error message.

What can be used to meet this requirement? The App Builder at Universal Containers has been asked to ensure that the Amount field is populated when the stage is set to Closed Won.
A. Validation Rule
B. Lightning Process Builder
C. Workflow
D. Approval Process

Answers

Answer:

Option C i.e., Workflow is the correct answer to the following question.

Explanation:

The following option is correct because Workflow makes secure that field of amount that is populated when the Close Won stage is set. So, that's why the workflow meets the following necessity.

Option A is not true because there is no rules is validating.

Option B is not true because the following requirement is not meet the process of the Lightning Builder.

Option c is not true because there is not any requirement of process of the approval.

Final answer:

A Validation Rule is the best solution to ensure the Amount field is populated when the opportunity stage is set to Closed Won in Salesforce. It enforces data quality and prevents the record from being saved without meeting the necessary conditions.

Explanation:

The requirement stated that the Amount field must be populated when the stage is set to Closed Won. The best option to meet this requirement is A. Validation Rule. A validation rule in Salesforce can be used to enforce data quality and required fields based on specific conditions, such as a stage being set to Closed Won.

Option B, Lightning Process Builder, is a powerful tool for automating complex business processes, but in this case, it might be an overkill solution for simply ensuring a field is populated. Option C, Workflow, could be used to send alerts or update fields when a record meets certain criteria but cannot prevent a record from being saved without the Amount value. Option D, Approval Process, is typically used to approve records before they can proceed to the next stage and isn't relevant to the requirement of ensuring a field's population.

In cell B3 in the Bonnet sheet, create a validation rule with these specifications: • Whole number less than or equal to $350. • Input message title Professional Membership and input message Enter the amount of the annual professional membership dues. • Error alert style Warning, alert title Too Expensive, and error message The amount you tried to enter exceeds $350. Please select a less expensive membership.

Answers

Answer:

Spread sheet application (eg Microsoft Excel).

Explanation:

Data validation is a very power tool in spread sheet applications like Excel. It is used to determine the type of data that should be inputted in a cell or group of cells or an entire column. To create a data validation rule, select the area or column(s), locate and click on the data tab in the ribbon menu, then locate data validation.

To input numbers, select the number tab on the new window, then whole number and range of the input value (it can also be customised). A message for the user can be set with a title and body, to alert the user of the needed input. For wrong input, an error message with a title and body, can be set to alert users of wrong entries.

The Windows ____ window allows you to create the graphical user interface for your application.

Answers

The Windows GUI window allows you to create the graphical user interface for your application.

Create an array of doubles with 5 elements. In the array prompt the user to enter 5 temperature values (in degree Fahrenheit). Do this within main. Create a user defined function called convert2Cels. This function will not return any values to main with a return statement. It should have parameters that include the temperature array and the number of elements. The function should convert the values for Fahrenheit to Celsius and save them back into the same array. Celsius=(F-32)*5/9 From main, print the modified temperature array in a single column format similar to one shown below: Temperatures(Celsius) 37.78 65.56 100.00 0.00 21.11 Test your program with the following values: 100 150 212 32 70

Answers

Answer:

The solution code is written in Java.

import java.util.Scanner; public class Main {    public static void main(String[] args) {        double myArray [] = new double[5];        Scanner reader = new Scanner(System.in);        for(int i=0; i < myArray.length; i++){            System.out.print("Enter temperature (Fahrenheit): ");            myArray[i] = reader.nextDouble();        }        convert2Cels(myArray, 5);        for(int j = 0; j < myArray.length; j++){            System.out.format("%.2f \n", myArray[j]);        }    }    public static void convert2Cels(double [] tempArray, int n){        for(int i = 0; i < n; i++){            tempArray[i] = (tempArray[i] - 32) * 5 / 9;        }    } }

Explanation:

Firstly, let's create a double-type array with 5 elements, myArray (Line 6).

Next, we create a Java Scanner object to read user input for the temperature (8).

Using a for-loop that repeats iteration for 5 times, prompt user to input temperature in Fahrenheit unit and assign it as the value of current element of the array. (Line 11 - 12). Please note the nextDouble() method is used to read user input as the data type of input temperature is expect in decimal format.

At this stage, we are ready to create the required function convert2Cels() that takes two input arguments, the temperature array,  tempArray and number of array elements, n (Line 23).  Using a for-loop to traverse each element of the tempArray and apply the formula to convert the fahrenheit to celcius.  

Next, we call the function convert2Cels() in the main program (Line 15) and print out the temperature (in celsius) in one single column (Line 17-19). The %.2f in the print statement is to display the temperature value with 2 decimal places.

The smallest signed integer number, base 16, that can be store in a variable of type BYTE is__________.

Answers

Answer:

The correct answer is ushort

Codio Challenge Activity PythonWe are passing in a list of numbers. You need to create 2 new lists in your chart, then put all odd numbers in one list put all even numbers in the other list output the odd list first, the even list secondTip: you should use the modulo operator to decide whether the number is odd or even. We provided a function for you to call that does this.Don’t forget to define the 2 new lists before you start adding elements to them.------------------------------------------------------------Requirements:Program Failed for Input: 1,2,3,4,5,6,7,8,9Expected Output: [1, 3, 5, 7, 9][2, 4, 6, 8]------------------------------------------------------------Given Code:# Get our input from the command lineimport sysnumbers = sys.argv[1].split(',')for i in range(0,len(numbers)):numbers[i]= int(numbers[i])def isEven(n) :return ((n % 2) == 0)# Your code goes here

Answers

Answer:

The python code is given below with lists defined.

Explanation:

import sys

def isEven(n) :

 return ((n % 2) == 0)  //for even items

numbers = sys.argv[1].split(',')

for i in range(0,len(numbers)):

 numbers[i]= int(numbers[i])

even = []

odd = []

for i in numbers:

   if isEven(i):

       even.append(i)  #adds i to even list if it is even

   else:

       odd.append(i)  #adds i to odd list if not even (odd)

print(odd)

print(even)

Suppose that some company has just sent your company a huge list of customers. You respond to that company with a strongly worded note because you only wanted the phone number of one customer, Mike Smith. They, in turn, reply to you suggesting that you simply find him quickly using binary search. Explain why it might not, in fact, be possible to use binary search on the huge list.

Answers

Answer:

Explanation:

Actually this is possible

First sort the list of all names in ascending order based on string comparison (ASCII value)

The middle can be found as we have total number of contacts

Binary search can be applied by comparing the name string

If any of these is not given or time bound then binary search can not be applied.

Identify the kind of argument.
Using a lemon when cooking is like using a lime. Given that limes can be added to bland foods to give them some zest, lemons, too, will give zest to bland foods.

a. Analogical argument
b. Categorical argument
c. Truth-functional argument
d. Causal argument

Answers

Answer:

B

Explanation:

A categorical argument or syllogism consists of deductive statement based on two premises. For example the highlighted statements:

No boy is a girl

Some humans are boys

Therefore, some humans are girls

is a categorical argument which consists of two premises (No boy is a girl, some humans are boys) and a deduction (Therefore, some humans are girls). The deduction is made by using the premises as the basis.

In the question, the two premises are:

Using a lemon when cooking is like using a lime

Limes add to bland foods to give them some zest

The deduction is:

Therefore, lemons too will give zest to bland foods

Thus, representing a categorical argument.

Encoding is the process:
Select one:
a. of assigning meaning to an idea or thought
b. and location where communication takes place
c. of translating an idea or a thought into a code
d. of any interference in the encoding and decoding processes that reduces the clarity of a message
e. of arrangement of symbols used to create meanings

Answers

Answer:

Of translating an idea or a thought into a code

Explanation:

Encoding is the process of translating an idea or a thought into a code.

For example:

You want a friend to get you a gaming Laptop as a birthday gift, while describing the specification and how the laptop should look like. You visualize a fast laptop in black cover. You tell your friend it is "fast and portable". You translate your perceptions on a particular laptop into words that describe the model.

How do the principles behind the Agile Manifesto suggest approaching architecture?A. Architecture emergesB. Architecture is not important, but functionality is importantC. Architecture is defined and planned up frontD. Architecture is defined and implemented in the first iterations

Answers

The principle behind the Agile Manifesto suggests that Architecture emerges in regard to approach architecture.

Explanation:

Based on the Agile Manifesto's principles or the Manifesto for the best architecture, designs and requirements emerge from self-organizing teams.The principles deal with changing requirements even late in development. Agile processes harness change for customer satisfaction.Business people and developers working throughout the project exposes the fact that both functionality and architecture is important.Agile software development is defined as the development through which requirements and solutions evolve through collaboration and cross-functional terms.Architecture is used in this Manifesto for the following reasons. Adaptable to change Minimized risk Maximized business value

The correct answer is A. Architecture emerges.

According to the Agile Manifesto and its underlying principles, architecture is not strictly defined or planned upfront. Instead, it evolves over time through collaboration, continuous improvement, and iteration.

The principles behind the Agile Manifesto emphasize responding to change and facilitating collaboration among self-organizing teams. One of the twelve principles explicitly states: "The best architectures, requirements, and designs emerge from self-organizing teams." This approach aligns with Agile's focus on adaptability and iterative development rather than rigid, upfront architectural planning.

Other Questions
The random variable X = the number of vehicles owned. Find the expected number of vehicles owned. Round answer to two decimal places. refer to the graphic novel frame below. write and solve an equation to find how many movies they have time to show. Cara grew 4inches in second grade and 3 inches in third grade. If Cara was 44 inches tall at the start of second grade, how tall is she at the end of third grade? The solution to the equation x? = 45 is between 1. Explain how the 4 C's of mental commitment are necessary for one to compete at a high level in sports. Most group Disability Income contracts are offered on a/an:A. Contributory basisB. Noncontributory basis C. Nonoccupational basis D. Occupational basis help me??????????????????? An account earned interest of 3% per year. The beginning balance was $150. The equation t=log1.03 (E/150) represents the situation, where t is the time in years and E is the ending balance. If the account was open for 8 years, what was the ending balance? According to the Nutrition Facts panel on a package of cream cheese, a 1 oz serving of the cheese supplies 70 kcal; 50 of the kcal are from fat. Based on this information, fat contributes about _____ % of total kcal. Convergent plate movement can create all of the following EXCEPTA) ridgesB) valleysC) mountainsD) volcanoes. 2. I Using the example { 2/3+4/3 X, explain why we add fractions the way we do. What is the logic behind the procedure? Make math drawings to support your explanation a house burns down. on the house across the street, all of the vinyl siding is twisted and warped by heat. the heat was transferred across the street by Article IX of the constitution grants the legislature the power to create counties.True or false? Consider the accompanying data on flexural strength (MPa) for concrete beams of a certain type.11.87.76.56.89.76.87.37.99.78.78.18.56.37.07.37.45.39.08.111.36.37.27.77.811.610.77.0a) Calculate a point estimate of the mean value of strength for the conceptual population of all beams manufactured in this fashion. [Hint: ?xi = 219.5.] (Round your answer to three decimal places.) MPaState which estimator you used.xp? s / xsx tilde -6x+3y=-76x+3y=7minus, 6, x, plus, 3, y, equals, minus, 7x what statistic is most closely related to climate How could government laws have the most direct impact on water quality? provide rewards to recycleprovide rewards to use solar powerprovide rewards to use liquid-absorbing surfaces Question 1 with 1 blank Esa revista es aburrida. Prefiero (this one).Question 2 with 1 blank Hay muchas gangas aqu! Voy a comprar estas botas y tambin (those over there).Question 3 with 1 blank No me gustan esos museos. Por qu no visitamos (this one)?Question 4 with 1 blank Yo trabajo en este restaurante y Joaqun trabaja en (that one).Question 5 with 1 blank Primero vamos a este almacn y luego vamos a (that one over there). A salesperson is offering promissory notes for a company selling coffee at drive-through kiosks. The notes pay a 13% interest rate and mature within 9 months. The salesperson tells a potential investor that the motes are risk-free and that the kiosks are collateral that secure the note.The salesperson is not registered in the state and notes are not registered in the state. Factor completely. x^2-4 Steam Workshop Downloader