Answer:
Explanation:
The following Java program has the method calcAverage(). It creates a sum variable which holds the sum of all the values in the array and the count variable which holds the number of elements in the array. Then it uses a For Each loop to loop through the array and go adding each element to the sum variable. Finally it calculates the average by dividing the sum by the variable count and returns the average to the user. A test case has been created in the main method using the example in the question. The output can be seen in the image attached below.
class Brainly {
public static void main(String[] args) {
int[] myArr = {1, 2, 3, 4, 5};
System.out.println(calcAverage(myArr));
}
public static double calcAverage(int[] myArr) {
double sum = 0;
double count = myArr.length;
for (int x: myArr) {
sum += x;
}
double average = sum / count;
return average;
}
}
What is the default return type of a method in Java language?
A.Void
B.Int
C.None
D.Short
Answer:
The default return data type in function is int
Answer: Option (b)
Explanation:
The default return data type in a function is int. In other words commonly if it is not explicitly mentioned the default return data type of a function by the compiler will be of an integer data type.
If the user does not mention a return data type or parameter type, then C programming language will inevitably make it an int.
mark me brainlist
In python,
Here's some fake data.
df = {'country': ['US', 'US', 'US', 'US', 'UK', 'UK', 'UK'],
'year': [2008, 2009, 2010, 2011, 2008, 2009, 2010],
'Happiness': [4.64, 4.42, 3.25, 3.08, 3.66, 4.08, 4.09],
'Positive': [0.85, 0.7, 0.54, 0.07, 0.1, 0.92, 0.94],
'Negative': [0.49, 0.09, 0.12, 0.32, 0.43, 0.21, 0.31],
'LogGDP': [8.66, 8.23, 7.29, 8.3, 8.27, 6.38, 6.09],
'Support': [0.24, 0.92, 0.54, 0.55, 0.6, 0.38, 0.63],
'Life': [51.95, 55.54, 52.48, 53.71, 50.18, 49.12, 55.84],
'Freedom': [0.65, 0.44, 0.06, 0.5, 0.52, 0.79, 0.63, ],
'Generosity': [0.07, 0.01, 0.06, 0.28, 0.36, 0.33, 0.26],
'Corruption': [0.97, 0.23, 0.66, 0.12, 0.06, 0.87, 0.53]}
I have a list of happiness and six explanatory vars.
exp_vars = ['Happiness', 'LogGDP', 'Support', 'Life', 'Freedom', 'Generosity', 'Corruption']
1. Define a variable called explanatory_vars that contains the list of the 6 key explanatory variables
2. Define a variable called plot_vars that contains Happiness and each of the explanatory variables. (Hint: recall that you can concatenate Python lists using the addition (+) operator.)
3. Using sns.pairplot, make a pairwise scatterplot for the WHR data frame over the variables of interest, namely the plot_vars. To add additional information, set the hue option to reflect the year of each data point, so that trends over time might become apparent. It will also be useful to include the options dropna=True and palette='Blues'.
Answer:
Here the answer is given as follows,
Explanation:
import seaborn as sns
import pandas as pd
df = {'country': ['US', 'US', 'US', 'US', 'UK', 'UK', 'UK'],
'year': [2008, 2009, 2010, 2011, 2008, 2009, 2010],
'Happiness': [4.64, 4.42, 3.25, 3.08, 3.66, 4.08, 4.09],
'Positive': [0.85, 0.7, 0.54, 0.07, 0.1, 0.92, 0.94],
'Negative': [0.49, 0.09, 0.12, 0.32, 0.43, 0.21, 0.31],
'LogGDP': [8.66, 8.23, 7.29, 8.3, 8.27, 6.38, 6.09],
'Support': [0.24, 0.92, 0.54, 0.55, 0.6, 0.38, 0.63],
'Life': [51.95, 55.54, 52.48, 53.71, 50.18, 49.12, 55.84],
'Freedom': [0.65, 0.44, 0.06, 0.5, 0.52, 0.79, 0.63, ],
'Generosity': [0.07, 0.01, 0.06, 0.28, 0.36, 0.33, 0.26],
'Corruption': [0.97, 0.23, 0.66, 0.12, 0.06, 0.87, 0.53]}
dataFrame = pd.DataFrame.from_dict(df)
explanatory_vars = ['LogGDP', 'Support', 'Life', 'Freedom', 'Generosity', 'Corruption']
plot_vars = ['Happiness'] + explanatory_vars
sns.pairplot(dataFrame,
x_vars = explanatory_vars,
dropna=True,
palette="Blues")
What is machine learning
Answer:
machine learning is the ability for computers to develop new skills and algorithms without specific instructions to do so.
A user reports network resources can no longer be accessed. The PC reports a link but will only accept static IP addresses. The technician pings other devices on the subnet, but the PC displays the message Destination unreachable. Wh are MOST likley the causes of this issue?
Answer: is this a real question but I think it would be Ip address hope this helps :)))
Explanation:
Create a function called GetColors that will accept two parameters. These parameters can only be red, blue or yellow. Your function needs to analyze these two colors and determine the color mix. Make sure your function returns the color mix back to where it was called.
Answer:
Explanation:
The following code is written in Java. It creates a GetColors method that takes in the two parameter colors of either red, blue or yellow. It combines those colors and returns the mix of the two colors back to the user. A test case has been used in the main method and the output can be seen in the attached image below.
import java.util.Scanner;
class Brainly {
public static void main(String[] args) {
System.out.println(GetColors("yellow", "red"));
}
public static String GetColors(String color1, String color2) {
if (color1 == "red") {
if (color2 == "blue") {return "purple";}
else if (color2 == "yellow") {return "orange";}
else {return "red";}
} else if (color1 == "blue") {
if (color2 == "red") {return "purple";}
else if (color2 == "yellow") {return "green";}
else {return "blue";}
} else if (color1 == "yellow") {
if (color2 == "red") {return "orange";}
else if (color2 == "blue") {return "green";}
else {return "yellow";}
} else {
return "Wrong Parameters";
}
}
}
Definition of digital
Answer:
There are two definitions from
Explanation:
1.) (of signals or data) expressed as series of the digits 0 and 1, typically represented by values of a physical quantity such as voltage or magnetic polarization.
2.) (of a clock or watch) showing the time by means of displayed digits rather than hands or a pointer.
I'm not sure if you meant "Digit". But if you did it would mean numbers or the places where numbers would go.
Hope this helps! (If not so sorry)
Answer:
adjective
1.
(of signals or data) expressed as series of the digits 0 and 1, typically represented by values of a physical quantity such as voltage or magnetic polarization.
relating to, using, or storing data or information in the form of digital signals.
"digital TV"
involving or relating to the use of computer technology.
"the digital revolution"
In C++, objects instantiated on the stack must be returned to program memory through the explicit use of the delete keyword.
a) True
b) False
Answer:
b. False.
Explanation:
Delete function not used to remove data stored on the stack. It is only used to free memory on the heap. The C++ is programming language used to develop operating systems.
Data representation and interactivity are important aspects of data visualization.
a. True
b. False
Answer:
a. True
Explanation:
Data visualization are defined as the representation of the data and information in graphical way. The data visualization tool uses charts, diagrams, graphs, maps, etc. to represent and visualized the information and understand the patter or trend in the data.
It is an effective way to interact with the user and works likes a form of a visual art.
Thus interactivity and data representations are the two important aspect of the data visualization.
Hence, the answer is true.
___________ colors come forward and command attention. ______________ colors recede away from our eyes and tend to fall into the background of a design.
Answer:
"Warm; Cool/receding" is the correct answer.
Explanation:
The color temperature would be referred to as summer and winter upon that color wheel, the hottest becoming red/orange as well as the most cooler always being bluish or greenish.A terminology to define the warmth of the color is termed as Warm colors. Warm hues are prominent as well as lively just like reds, oranges, etc.Thus the above is the right answer.
A strategy that adopts interface standards that are defined by and widely used throughout industry to facilitate the update of components with new technology is __________. Open systems Non-developmental items Software-embedded systems Automated Information Systems
Answer:
The right approach is Option d (Automated information systems).
Explanation:
A technology that collects as well as disseminates knowledge or material throughout a range or variety of computerized systems, they are determined as an Automated information system.Oftentimes virtually minimal individual personal interference is necessary except perhaps construction as well as services.Other choices aren't related to the given scenario. So the above is the appropriate one.
You are having a problem with your Windows computer that is isolated to a single graphics editing program that you use every day in your work. When you described the problem to the customer service support person for this product, she told you that the only fix for it is to edit a key under HKEY-LOCAL_MACHINE\SOFTWARE. She has assured you that this fix will work without causing any problems, but you are wary of doing this. Descript the steps and precautions taken.
Answer:
I'm not a big tech head but I know that creating a restore point is highly recommended for changing anything that you aren't 100% sure about to your computer.
Assume that an O(log2N) algorithm runs for 10 milliseconds when the input size (N) is 32. What input size makes the algorithm run for 14 milliseconds
Answer:
An input size of N = 128 makes the algorithm run for 14 milliseconds
Explanation:
O(log2N)
This means that the running time for an algorithm of length N is given by:
[tex]F(N) = c\log_{2}{N}[/tex]
In which C is a constant.
Runs for 10 milliseconds when the input size (N) is 32.
This means that [tex]F(32) = 10[/tex]
So
[tex]F(N) = c\log_{2}{N}[/tex]
[tex]10 = c\log_{2}{32}[/tex]
Since [tex]2^5 = 32, \log_{2}{32} = 5[/tex]
Then
[tex]5c = 10[/tex]
[tex]c = \frac{10}{5}[/tex]
[tex]c = 2[/tex]
Thus:
[tex]F(N) = 2\log_{2}{N}[/tex]
What input size makes the algorithm run for 14 milliseconds
N for which [tex]F(N) = 14[/tex]. So
[tex]F(N) = 2\log_{2}{N}[/tex]
[tex]14 = 2\log_{2}{N}[/tex]
[tex]\log_{2}{N} = 7[/tex]
[tex]2^{\log_{2}{N}} = 2^7[/tex]
[tex]N = 128[/tex]
An input size of N = 128 makes the algorithm run for 14 milliseconds
Given main(), complete the Car class (in file Car.java) with methods to set and get the purchase price of a car (setPurchasePrice(), getPurchasePrice()), and to output the car's information (printInfo()).
Ex: If the input is:
2011
18000
2018
where 2011 is the car's model year, 18000 is the purchase price, and 2018 is the current year, the output is:
Car's information:
Model year: 2011
Purchase price: 18000
Current value: 5770
Note: printInfo() should use three spaces for indentation.
Answer and Explanation:
public class Main {
int Carmodel;
int Purchaseprice;
int Currentyear;
Public void setPurchasePrice(int Purchaseprice){
this.Purchaseprice=Purchaseprice;
}
Public void getPurchasePrice(){
return Purchaseprice;
}
static void printInfo(int Carmodel int Currentyear ){
this.Carmodel=Carmodel;
this.Currentyear=Currentyear;
System.out.println(getPurchasePrice() Carmodel Currentyear);
}
}
The above java program defines a class that has three methods, a get method that returns purchase price of the object, a set method that sets purchase price of the object, and a print method that print out the information about the car object(model, year, price). The print method also takes arguments and assigns values of the arguments/parameters to the object, then prints all.
how much is this worth in dollars
Answer:
This is worth 50 dollars.
Explanation:
١ - one
٢ - two
٣ - three
٤ - four
٥ - five
٦ - six
٧ - seven
٨ - eight
٩ - nine
٠ - zero
What you see above is the ten digits in Arabic.
Both 5 (٥) and 0 (٠) appear here, thus representing 50.
State two ways of preventing virus attack on a computer.
Answer:
updating the computer and having an anti virus on your computer
Which operating system desktop or mobile is the best
Answer:
bing or alien ware is the best.
Answer:
Your choice, but personally, desktop is better.
Explanation:
Desktop devices have portrait orientations so content can stretch across a screen and often multiple messages or images can live comfortably in such a wide space. Mobile devices are usually used in portrait orientation (and the smaller screens mean that even in landscape mode, horizontal space is limited).
..............is a piece of hardware used to provide data and instructions to a computer used for interaction and control. *
Output device.
Processing.
input device.
All of above.
Answer:
output
Explanation:
it can be seen and touched
1. Write the CSS for an id with the following characteristics: fixed position, light grey background color, bold font weight, and 10 pixels of padding
Answer:
#element
{
position: fixed;
background-color: RGBA(211, 211, 211, 1);
font-weight: bold;
padding: 10px;
}
what is the characteristics of computer?dicuss any 5 of them
Answer:
speed
accuracy
diligence
versatility
reliabiility
memory
speed: a computer works with more higher speed compared to humans when performing mathematical calculations
accuracy: computer perform calculations with 100% accuracy
dilligence:a computer can perform calculations with the same consistentcy and accuracy
versatility:refers to the capability of a computer to perform different kind of works with same accuracy and efficiencies
reliability
Answer:
speed
accuracy
diligent
versatile
storage and communication
what is an RTF file?
Answer:
The Rich Text Format is a proprietary document file format with published specification developed by Microsoft Corporation from 1987 until 2008 for cross-platform document interchange with Microsoft products.
What will MOST likely adversely impact the operations of unpatched traditional programmable-logic controllers, running a back-end LAMP server and OT systems with human-management interfaces that are accessible over the Internet via a web interface?
Answer:
The answer is "Option a and Option f"
Explanation:
The cross-site programming and Server-Side Requests fraud were activities that can have negative effects as these are assaults that directly affect your cloud-based servers via web apps. Although the remainder of an attack could be controlled with these approaches, then they can affect the encryption keys only less.
Print the two strings in alphabetical order. Assume the strings are lowercase. End with newline. Sample output: capes rabbits import java.util.Scanner: public class OrderStrings { public static void main (String args) { String firstString: String secondString: firstString = "rabbits" secondString = "capes" /*Your solution goes here */ return: } }import java.util.Scanner;public class OrderStrings { public static void main(String[] args) { String firstString; String secondString; firstString = "rabbit"; secondString= "capes"; //String class in java provide string comparison function, use it, and get //your work done may even use brute force i.e using for loop and compare character by // character which will not good for the programming language which already have vast //predefined number of functions if(firstString.compareTo(secondString) < 0){ System.out.println(firstString + " " + secondString); } else{ System.out.println(secondString + " " + firstString); } return; }}
Answer:
Following are the code to the given question:
import java.util.Scanner;//import package
public class OrderStrings // defining a class OrderStrings
{
public static void main(String[] args) //defining a main method
{
Scanner scnr = new Scanner(System.in);//defining a Scanner class object
String firstString;//defining a String variable
String secondString; //defining a String variable
firstString = scnr.next();//input value
secondString = scnr.next();//input value
if (firstString.compareTo(secondString) < 0)//use if to compare sting value
System.out.println(firstString + " " + secondString);//print sting value
else//else block
System.out.println(secondString + " " + firstString);//print sting value
}
}
Output:
rabbits capes
capes rabbits
Explanation:
In this code a class "OrderStrings" is defined inside the class the main method is defined that declares the two string variable that uses the input method to input the string value and after input, it uses the conditional statement. Inside this compareTo method is declared that compare string value and prints the string value.
application of printer
Answer:
In addition, a few modern printers can directly interface to electronic media such as memory cards, or to image capture devices such as digital cameras, scanners; some printers are combined with a scanners and/or fax machines in a single unit, and can function as photocopiers.
9.18 LAB: Exact change - methods Write a program with total change amount as an integer input that outputs the change using the fewest coins, one coin type per line. The coin types are dollars, quarters, dimes, nickels, and pennies. Use singular and plural coin names as appropriate, like 1 penny vs. 2 pennies. Ex: If the input is:
Answer:
Explanation:
The following code is written in Java. It asks the user to enter the amount of change needed. This is done as a double since we are dealing with coins and not full dollar values alone. It then makes the necessary calculations to calculate the number of each coin needed and outputs it back to the user. A test case has been provided in the picture below with a sample output.
import java.util.Scanner;
class Brainly {
public static void main(String[] args) {
int dollars = 1;
double quarters = 0.25;
double dimes = 0.10;
double nickels = 0.05;
double pennies = 0.01;
Scanner in = new Scanner(System.in);
System.out.println("Enter Change Value: ");
double change = in.nextDouble();
int numDollars, numQuarters, numDimes, numNickels, numPennies;
double newChange;
numDollars = (int) (change / dollars);
newChange = change % dollars;
numQuarters = (int) (newChange / quarters);
newChange = newChange % quarters;
numDimes = (int) (newChange / dimes);
newChange = newChange % dimes;
numNickels = (int) (newChange / nickels);
newChange = newChange % nickels + 0.001;
numPennies = (int) (newChange / pennies);
newChange = newChange % pennies;
System.out.println("Minimum Num of Coins needed: ");
if (numDollars != 1) {
System.out.println(numDollars + " Dollars");
} else {
System.out.println(numDollars + " Dollar");
}
if (numQuarters != 1) {
System.out.println(numQuarters + " Quarters");
} else {
System.out.println(numQuarters + " Quarter");
}
if (numDimes != 1) {
System.out.println(numDimes + " Dimes");
} else {
System.out.println(numDimes + " Dime");
}
if (numNickels != 1) {
System.out.println(numNickels + " Nickels");
} else {
System.out.println(numNickels + " Nickel");
}
if (numPennies != 1) {
System.out.println(numPennies + " Pennies");
} else {
System.out.println(numPennies + " Penny");
}
}
}
The program is an illustration of conditional statements
Conditional statements are used to make decisions
The program in C++ where comments are used to explain each line is as follows
#include<iostream>
using namespace std;
int main() {
// This line declare all the variables
int amount, dollar, quarter, dime, nickel, penny;
// This prompts the user for input (i.e. the amount)
cout<<"Amount: ";
//This gets the amount from the user
cin>>amount;
// This checks if the amount is 0 or less
if(amount<=0) {
//This prints "No Change"
cout<<"No Change";
}
//If the amount is greater than 0
else {
// These convert the amount to various coins
dollar = amount/100;
amount = amount%100;
quarter = amount/25;
amount = amount%25;
dime = amount/10;
amount = amount%10;
nickel = amount/5;
penny = amount%5;
// The next lines print the coins
if(dollar>=1) {
if(dollar == 1) {
cout<<dollar<<" dollar\n"; }
else {
cout<<dollar<<" dollars\n"; }
}
if(quarter>=1) {
if(quarter== 1) {
cout<<quarter<<" quarter\n";
}
else {
cout<<quarter<<" quarters\n";
}
}
if(dime>=1) {
if(dime == 1) {
cout<<dime<<" dime\n";
}
else {
cout<<dime<<" dimes\n";
}
}
if(nickel>=1) {
if(nickel == 1) {
cout<<nickel<<" nickel\n";
}
else {
cout<<nickel<<" nickels\n";
}
}
if(penny>=1) {
if(penny == 1) {
cout<<penny<<" penny\n";
}
else {
cout<<penny<<" pennies\n";
}
}
}
return 0;
}
Read more about conditions at:
https://brainly.com/question/15683939
We have removed
A
balls from a box that contained
N
balls and then put
B
new balls into that box. How many balls does the box contain now?
Constraints
All values in input are integers.
Input
Input is given from Standard Input in the following format: n a b
Output
Print the answer as an integer.
There were [tex]N[/tex] balls but we took [tex]A[/tex] balls out, so there are now [tex]N-A[/tex] balls. We add [tex]B[/tex] balls and now we have [tex]N-A+B[/tex] balls.
The program that computes this (I will use python as language has not been specified is the following):
n, a, b = int(input()), int(input()), int(input())
print(f"There are {n-a+b} balls in the box")
# Hope this helps
Functions IN C LANGUAGE
Problem 1
Function floor may be used to round a number to a specific decimal place. The statement
y = floor( x * 10 + .5 ) / 10;
rounds x to the tenths position (the first position to the right of the decimal point). The
statement
y = floor( x * 100 + .5 ) / 100;
rounds x to the hundredths position (the second position to the right of the decimal
point).
Write a program that defines four functions to round a number x in various ways
a. roundToInteger( number )
b. roundToTenths( number )
c. roundToHundreths( number )
d. roundToThousandths( number )
For each value read, your program should print the original value, the number rounded to
the nearest integer, the number rounded to the nearest tenth, the number rounded to
the nearest hundredth, and the number rounded to the nearest thousandth.
Input Format
Input line contain a float number.
Output Format
Print the original value, the number rounded to the nearest integer, the number rounded
to the nearest tenth, the number rounded to the nearest hundredth, and the number
rounded to the nearest thousandth
Examples
Example 1
Input 1
24567.8
Output 1
24567.8 24568 24570 24600
Indicate whether the following actions are the actions of a person who will be a victim, or will not be a victim, of phishing attacks.
Replying to an e-mail requesting your user ID and password Phishing victim Not a phishing victim
Answer:
Phishing Victim
Explanation:
Replying to this email could make you a victim of a phishing scam. Phishing attacks are common challenges on security that internet users are faced with. It could lead to others getting hold of sensitive information like your password or bank details. email is one way the hackers used to get this information. replying to such an email could lead one to an unsecure website where information could be extracted
Write a recursive function that calculates the sum 11 22 33 ... nn, given an integer value of nin between 1 and 9. You can write a separate power function in this process and call that power function as needed:
Answer:
The function in Python is as follows:
def sumDig(n):
if n == 1:
return 11
else:
return n*11 + sumDig(n - 1)
Explanation:
This defines the function
def sumDig(n):
This represents the base case (where n = 1)
if n == 1:
The function returns 11, when it gets to the base case
return 11
For every other value of n (n > 1)
else:
This calculates the required sum recursively
return n*11 + sumDig(n - 1)
vacuum tubes produced a large amount of
Answer: suck
Explanation:
sucktion
Code an operation class called ArrayComputing that will ask user to enter a serials of integers with a loop until -99 is entered and after the input it will keep and display the greatest, the least, the sum and the average of the data entries (-99 is not counted as the data). And code a driver class called ArrayComputingApp to run and test the ArrayComputing class, separately.
Must use required/meaningful names for fields, variables, methods and classes.
Must use separate methods to perform each of specified tasks as described.
Must document each of your source code
Answer:
Explanation:
The following is written in Java and creates the ArrayComputing class. It uses the constructor to create the infinite loop that only breaks when the user enters a -99. After every input number it goes adding the correct values to the variables. Once it is done the user can call any of the getter methods to get the variable values as well as calculate the average.
import java.util.Scanner;
class ArrayComputingApp {
public static void main(String[] args) {
ArrayComputing arrayComputing = new ArrayComputing();
System.out.println("Average: " + arrayComputing.getAverage());
System.out.println("Greatest: " + arrayComputing.getGreatest());
System.out.println("Least: " + arrayComputing.getLeast());
System.out.println("Sum: " + arrayComputing.getSum());
}
}
class ArrayComputing {
int greatest, least, sum, average;
int count = 0;
Scanner in = new Scanner(System.in);
public ArrayComputing() {
while (true) {
System.out.println("Enter a number or -99 to exit: ");
int num = in.nextInt();
if (num == -99) {
break;
}
if (num > this.greatest) {
this.greatest = num;
}
if (this.count == 0) {
this.least = num;
} else {
if (num < this.least) {
this.least = num;
}
}
this.sum += num;
this.count += 1;
}
}
public int getAverage() {
this.average = sum / count;
return this.average;
}
public int getGreatest() {
return greatest;
}
public int getLeast() {
return least;
}
public int getSum() {
return sum;
}
}