Answer:
Following are the code to this question:
import java.util.*;//import package for user-input
public class U7_L2_Activity Three//defining class U7_L2_Activity Three
{
public static ArrayList<Integer> getOdds(ArrayList<Integer> val)//defining a static method getOdds as an ArrayList
{
ArrayList<Integer> odd = new ArrayList<Integer>();//creating ArrayList Object
int i; //defining integer variable
for(i=0;i<val.size();i++)//defining for loop for calculating odd values
{
if(val.get(i)%2!=0)//defining if block to check odd numbers
{
odd.add(vals.get(i));//add values in odd ArrayList
}
}
return odd;//return ArrayList odd
}
public static void main(String[] asr)//defining main method
{
int l,i;//defining integer variable
Scanner sob = new Scanner(System.in);//creating Scanner calss Object
ArrayList<Integer> num = new ArrayList<Integer>();//creating ArrayList object
System.out.println("Enter length of the ArrayList: ");//print message
l = scan.nextInt();//input length value
System.out.println("Enter ArrayList values: "); //print message
for(i = 0; i < l; i++)//use for to input value
{
num.add(sob.nextInt());//input value
}
System.out.println("Odds list: " + getOdds(num));//calling method getOdds
System.out.println("Original list: " + num);//print array value
}
}
Output:
Enter ArrayList length:
7
Enter values:
2
5
8
6
7
3
12
Odds list: [5, 7, 3]
Original list: [2, 5, 8, 6, 7, 3, 12]
Explanation:
In the above-program inside the class, a static method "getOdds "is declared, that accepts an array list in its parameters, and defined an array list "odd", in this a for loop is defined, that check the odd numbers in the array and add the value in the odd Arraylist, and returns its values.
Inside the main method is defined that creates scanner class object for input array value and pass the value into the method "getodds" and print its return values.
In this program we are going to practice using the Math class by computing some important values on the unit circle. Starting at 0 and going up by
PI/4 radians (or 45 degrees), print out information of the format below.
Radians: (cos, sin)
0.0: 1.0, 0.0
0.79: 0.7, 0.71
1.57: 0.0, 1.0
2.36: -0.71, 0.7
3.14: -1.0, 0.0
3.93: -0.7, -0.71
4.71: 0.0, -1.0
5.5: 0.71, -0.71
Hints:
You’ll need to use the Math.sin, Math.cos methods
and the Math.PI constant!
You’ll also need to loop from 0 to 2*PI
You can round a decimal to 2 decimal places by multiplying by 100, rounding to the nearest int, and then dividing by 100. Here’s an example:
double value = 0.431675;
value = value * 100; // 43.1675
value = Math.round(value) // 43.0
value = value / 100.0; // 0.43
// Or put it all on one line:
value = Math.round(value * 100) / 100.0;
Answer:
The program in Java is:
import java.lang.*;
public class MyClass {
public static void main(String args[]) {
for(int i= 0;i<360;i+=45){
double angle = Math.round(Math.toRadians(i)*100.0)/100.0;
double cosX = Math.round(Math.cos(angle)*100.0)/100.0;
double sinX = Math.round(Math.sin(angle)*100.0)/100.0;
System.out.println(angle+": "+cosX +" "+ sinX);
}
}
}
Explanation:
This line iterates through the angles from 0 to 360 or 0 to 2*Pi
for(int i= 0;i<360;i+=45){
This calculates the angle to radians
double angle = Math.round(Math.toRadians(i)*100.0)/100.0;
This calculats the cosine of the angle rounded to 2 decimal place
double cosX = Math.round(Math.cos(angle)*100.0)/100.0;
This calculats the sine of the angle rounded to 2 decimal place
double sinX = Math.round(Math.sin(angle)*100.0)/100.0;
This prints the required output
System.out.println(angle+": "+cosX +" "+ sinX);
}
Conside following prototype of a function
int minArray(int [], int );
Which of the option is correct way of function CALL assuming following arraydeclaration
int x[5] = {7,4,6,2,3};*
a) minArray(x,5);
b) minArray(x[],10);
c) minArray(x[5],5);
d) minArray(5,x);
Answer:
The answer is "Option a"
Explanation:
Following are the code to this question:
#include <stdio.h>//header file
int minArray(int x[], int n)//defining method minArray that accepts two parameters
{
for(int i=0;i<n;i++)//defining loop for print value
{
printf("%d\n",x[i]);//printf array value
}
}
int main()//defining main method
{
int x[] ={7,4,6,2,3};//defining array that hold values
int n=5;//defining integer variable
minArray(x,5);//calling method minArray
return 0;
}
In this code, a method "minArray" is defined, that accepts two parameters array and an integer variable in its parameter, and in the next step, the for loop is declared, that uses the print method to prints its value.
In the next step, the main method is declared, which declared an array and holds its values and defines an integer variables, and calls the method "minArray".
Write a class called TextProcessor that implements the methods listed below. Your implementation may use the charAt() and length() methods from the String class You must not use any other String methods, and you must not use any of the methods in the Character class. You may not use any integer literal values except for 0 and 1.
The divBySum method is intended to return the sum of all the elements in the int array parameter arr that are divisible by the int parameter num. Consider the following examples, in which the array arrcontains {4, 1, 3, 6, 2, 9}.
The call divBySum(arr, 3) will return 18, which is the sum of 3, 6, and 9, since those are the only integers in arr that are divisible by 3.
The call divBySum(arr, 5) will return 0, since none of the integers in arr are divisible by 5.
Complete the divBySum method using an enhanced for loop. Assume that arr is properly declared and initialized. The method must use an enhanced for loop to earn full credit.
/** Returns the sum of all integers in arr that are divisible by num
* Precondition: num > 0
*/
public static int divBySum(int[] arr, int num)
Answer:
The complete method is as follows:
public static int divBySum(int[] arr, int num){
int sum = 0;
for(int i:arr){
if(i%num == 0)
sum+=i;
}
return sum;
}
Explanation:
As instructed, the program assumes that arr has been declared and initialized. So, this solution only completes the divBySum method (the main method is not included)
This line defines the method
public static int divBySum(int[] arr, int num){
This line declares and initializes sum to 0
int sum = 0;
This uses for each to iterate through the array elements
for(int i:arr){
This checks if an array element is divisible by num (the second parameter)
if(i%num == 0)
If yes, sum is updated
sum+=i;
}
This returns the calculated sum
return sum;
}
I need help, who is a great phone pin lock screen cracker?
Answer:
738159
now it's depend on you.
After Alexandra installed new software, she set it up to perform in a certain way. She is _____. changing the peripherals linking to the hardware setting up a network configuring the software
Answer:
configuring the software
Explanation:
Alexandre is said to have installed a new software to her computer and then proceeds to set it up to perform in a certain way. What she did was to configure the software.
Configuring software in a computer has to do with setting it up to behave in certain ways according to the user.
CSc 2720 - Data Structures: Assignment 1 [100 points] How to Submit: Turn the .java file in Folder Assignment 1 in iCollege no later than 11:00 p.m. ET on 01/27/2021 Notes: 1. Do not use any library for matrix multiplication. 2. Always use comments to explain your program. 3. No copying allowed. If it is found that students copy from each other, all of these programs will get 0. 4. You must use matrix.java as the program name; otherwise, you will lose 10%. Requirements: You are to write a program name matrix.java that makes the dot products of 2 arrays. 1. Your program should prompt the user for the dimensions of the two squares matrices, making sure that the user input is equal to 50. 2. If the above is not met, prompt the user for a new value. 3. Now generate random integer numbers (ranging from 0 to 50) to fill both matrices. 4. Display these two matrices on the screen. 5. Multiply the two matrices and display the result on the screen. 6. Insert a clock to see how long it would take to multiply these two matrices and display the time (with a message to this effect). 7. Prompt the user asking if they want to repeat the program. A simple example of program output (here matrix dimension is 4, your should be 50):
var nums = [1,1, 2, 3, 5, 8, 13, 21];
var copyNums = [1,1, 2, 3, 5, 8, 13, 21];
for(var i=0; i < copyNums.length; i++){
if(copyNums[i] == 1){
insertItem(copyNums,i,"hello");
}
}
This code will create an infinite loop. Why does it create an infinite loop?
Answer:
Explanation:
This code creates an infinite loop because it is detecting that the first value of copyNums is 1, therefore it runs the insertItem code. This code then adds the value "hello" to the array in position i which would be 0. Then moves to the next value of the array, but since the element "hello" pushed the value 1 to the next index then the code just repeats itself with the same value of 1. This continues to happen because every time the value "hello" is added it simply pushes the 1 to the next index and repeats the same code.
Answer:
[tex]var nums = [1,1, 2, 3, 5, 8, 13, 21];
var copyNums = [1,1, 2, 3, 5, 8, 13, 21];
for(var i=0; i < copyNums.length; i++){
if(copyNums[i] == 1){
insertItem(copyNums,i,"hello");
}
}[/tex]
Do you think it’s better for a young designer to use free, open-source art programs or to pay for commercial programs? Explain your answer, but come up with at least one counterargument that forces you to defend your position when you explain why you think one option is better than the other.
Answer:
I think that if you are starting you should use a free, open-source art program. Because starting up with alot of things like this is hard with no money but the resources that we have could help with that. That's why I think the free one is better than paying, especially monthly pay.
Explanation:
Write a program whose input is a string which contains a character and a phrase, and whose output indicates the number of times the character appears in the phrase.
Ex: If the input is:
n Monday
the output is:
1
Ex: If the input is:
z Today is Monday
the output is:
0
Ex: If the input is:
n It's a sunny day
the output is:
2
Case matters.
Ex: If the input is:
n Nobody
the output is:
0
n is different than N.
Learning Python
Explanation:
1
Ex: If the input is:
z Today is Monday
the output is:
0
Ex: If the input is:
n It's a sunny day
the output is:
2
Case matters.
Ex: If the input is:
n Nobody
the output is:
0
n is different than N.
Learning Python
I've included my code in the picture below. Best of luck.
An administrator edits the network firewall configuration. After editing the configuration, the administrator logs the date and time of the edit and why it was performed in the firewall documentation. Which of the following BEST describes these actions?
a. Asset management
b. Baselines
c. Network maps
d. Change management
Answer:
d. Change management
Explanation:
Change management can be defined as a strategic process which typically involves implementing changes (modifications) to an existing process or elements on a computer system.
In this scenario, an administrator edits the network firewall configuration. After editing the configuration, the administrator logs the date and time of the edit and why it was performed in the firewall documentation. Thus, what best describes these actions is change management.
As a network administrator, you would be required to perform changes to your network and network devices in order to get an optimum level of performance.
Why is it important to know how to create a professional email?
So people think you are professional based on what you write.
Answer:
It is important to write a professional email because you need to make a good impression. This also shows that you are determined.
Differentiate between Calling and Called program?
Answer:
The program name in CALL statement called as CALLED program/Sub program. A program can contain as many CALLs required and no restriction on it. In other words, CALLING program can CALL as many subprograms required. CALLED may not have the CALL statement to call another program.
Explanation:
Choose the type of collection created with each assignment statement. collectionA = {5:2} collectionB = (5,2) collectionC = [5, 2]
Answer:
CollectionA is Dictionary
CollectionB is List
CollectionC is Tuple
Explanation:
List is recognized by the square brackets
Tuple by the parentheses
Dictionary by the curly brackets
Answer:
Dictionary collectionA
Tuple collectionB
List collectionC
Explanation:
A dictionary uses curly brackets. A tuple uses parentheses. A list uses square brackets.
Identify the correct characteristics of Python lists. Check all that apply. Python lists are enclosed in curly braces { }. Python lists contain items separated by commas. Python lists are versatile Python data types. Python lists may use single quotes, double quotes, or no quotes.
Answer:
Python lists contain items separated by commas.
Python lists are versatile Python data types.
Python lists may uses single quotes, double quotes, or no quotes.
Explanation:
Python Lists are enclosed in regular brackets [ ], not curly brackets { }, so this is not a correct characteristic.
Answer:
a c d
Explanation:
What is the next line? >>> tupleB = (5, 7, 5, 10, 2, 7) >>> tupleB.count(7) 1 0 5 2
Answer:
The right answer is option 4: 2
Explanation:
Lists are used in Python to store elements of same or different data types.
Different functions are used in Python on List. One of them is count.
Count is used to count how many times a specific value occurs in a list.
The syntax for count is:
listname.count(value)
In the given code,
The output will be 2
Hence,
The right answer is option 4: 2
Answer:
The answer is 2!!!!
Explanation:
Good luck!
6.2 lesson practice
Answer:
I am guessing it would be 20
Explanation:
In the draw canvas text code the last number from the color is probably the font size.
Correct me if I'm wrong
Which results are expected in a personality test but not a skills assessment?
Answer:
openness, conscientiousness, extraversion
Explanation:
A personality test is defined as a test that is used to assess the human personality. It is designed as the techniques to measure characteristics patterns of the traits that various people shows at different situations or environments.
A skill assessment test is used to test the abilities and the skill sets of people to perform a particular tasks given to them. It is measuring the knowledge and skills of a person.
The personality test are carried out to test how human behave and what traits they show in certain conditions. Thus openness, extra version and conscientiousness are some of the traits that people usually shows in a personality test. Thus they are the results that are expected by an individual of a personality test.
Which of the following groups might sign a non-disclosure agreement between them?
the local government and its citizens
a group of employees or contractors
a company and an employee or contractor
two competing businesses or companiesc
Answer: I believe the right answer is between a company and employee or contractor.
Explanation: I think this is the answer because a non-disclosure is a legal contract between a person and a company stating that all sensitive. information will be kept confidential.
Answer:a
Explanation:
Type a statement using srand() to seed random number generation using variable seedVal. Then type two statements using rand() to print two random integers between (and including) 0 and 9. End with a newline. Ex:
5.
7.
Note: For this activity, using one statement may yield different output (due to the compiler calling rand() in a different order). Use two statements for this activity. Also, after calling srand() once, do not call srand() again. (Notes)
1 #include
2 #include //
3 Enables use of rand ()
4 int main(void) ( int seedval;
6.
7. scanf ("%d", &seedval);
8.
9.
10 srand(int seedval);
11 printf("%d\n", srand());
12 printf("%d\n", srand());
13
14 return e;
15 }
Answer:
#include<stdio.h>
#include<stdlib.h>
int main(void){
int seedval;
scanf ("%d", &seedval);
srand(seedval);
printf("%d\n", rand()%10);
printf("%d\n", rand()%10);
return 0;
}
Explanation:
The given code is poorly formatted. So, I picked what is usable from the code to write the following lines of code:
#include<stdio.h>
#include<stdlib.h>
int main(void){
This line declares seedval as integer
int seedval;
This line gets user input for seedval
scanf ("%d", &seedval);
This line calls the srand function to generate random numbers
srand(seedval);
This prints a random number between 0 and 9
printf("%d\n", rand()%10);
This also prints a random number between 0 and 9
printf("%d\n", rand()%10);
return 0;
}
If an ISP assigned you a /28 IPv6 address block, how many computers could be as- signed an address from the block?
Answer:
I think 14 hosts (computer)
Dan notices that his camera does not capture pictures correctly. It appears that less light is entering the camera. Which component of the camera could be responsible for the problem?
Given two input integers for an arrowhead and arrow body, print a right-facing arrow.
Ex: If the input is:
Answer:
I don't know the language this is but here is something that will work for all lang
int num0 = 0;
int num1 = 0;
basically just print the ints in the right dimension
Explanation:
Sorry if I am wrong
I don't know much about this someone else's answer might be better than mine
6. Pattern Displays
Use for loops to construct a program that displays a triangle of Xs on the screen. The
triangle should look like this
X XXXXX
XX XXXX
XXX XXX
XXXX XX
XXXXX X
Answer:
public static void displayPattern()
{
for (int x = 1; x <= 5; x++)
{
for (int i = 0; i <= 6; i++)
{
if (x == i)
{
System.out.print(" ");
} else {
System.out.print("X");
}
}
System.out.println("");
}
}
Don't delete my answer Brainly moderators, you know as well as I do that you'll never be stack overflow so take what you can get.
A drink costs 2 dollars. A taco costs 3 dollars. Given the number of each, compute total cost and assign totalCost with the result. Ex: 4 drinks and 6 tacos yields totalCost of 26.
*/
int main() {
int numDrinks = 0;
int numTacos = 0;
int totalCost = 0;
numDrinks = 4;
numTacos = 6;
/* Your solution goes here */
totalCost = (2 * numDrinks) + (3 * numTacos);
cout << "Total cost: " << totalCost << endl;
return 0;
}
Answer:
See Explanation
Explanation:
The question has been answered; however, the program is not dynamic enough because the output will always be 26.
To make it dynamic, replace the following lines of code:
numDrinks = 4;
numTacos = 6;
with:
cout<<"Number of drinks: ";
cin>>numDrinks;
cout<<"Number of Tacos: ";
cin>>numTacos;
The above lines of code will let the user input different values for numDrinks and numTacos each time the program is executed.
Computing the total cost using code can be represented as follows:
def total_cost(no_of_drinks, no_of_talcos):
totalCost = 2*no_of_drinks + 3*no_of_talcos
return totalCost
print(total_cost(4, 6))
Python code explanation:A function named total_cost is declared and it accept the parameters no_of_drinks and no_of_talcos.
The totalCost is used to store the result of the cost of the total drinks and tacos bought in dollars.
Then, we return the totalCost.
Finally, we use the print statement to call the function with its required parameters.
learn more on python code:https://brainly.com/question/14479908?referrer=searchResults
How does calculate() work?
Answer:
calculate works by determining the amount of something
Explanation:
Cathy connected a keyboard, mouse, and printer to her Computer through a Bluetooth connection. What type of network has she created?
Answer:
Cathy has created a Personal Area Network
Explanation:
Let us define a personal area network.
A personal area network is created by connecting multiple devices of a user and it is panned over a very short distance. Mainly used technology is Bluetooth.
Cathy has used Bluetooth to connect keyboard, mouse and printer to her computer, she has formed a Personal Area Network.
Answer: pan
Explanation: got it right edmentum
Design a flowchart for an algorithm which adds prim numbers starting from 1 up to 50. Change
the flow chart to a pseudocode.
Answer:
Explanation:. ALGORITHM AND FLOW CHART. 1.1 Introduction. 1.2 Problem Solving ... money. After knowing the balance in his account, he/she decides to with draw the ... change it to a sports channel, you need to do something i.e. move to that channel by ... Problem4: Design an algorithm with a natural number, n, as its input which.
A network interface card was installed on Shawn's computer. The function of a network interface card is to _____.
enable his computer to be connected to a network
keep his documents secure
store files that can be shared
speed up his computer
Answer:
The correct answer is Option 1: enable his computer to be connected to a network
Explanation:
Network interface card, as it is clear from the name, is added to the computer system to enable the computer to connect to the internet. If a computer doesn't have network interface card, it cannot connect to the internet.
Hence,
The correct answer is Option 1: enable his computer to be connected to a network
Answer:
enable his computer to be connected to a network
A Process of receiving selecting
organizing interpreting checking and
reacting to sensory stimuli or data
so as to form a meaningful and
coherent picture of the world is
Select one:
a. Attitude
b. Perception
c. Communication
d. Thinking
= Perception
Answer:
I think it’s B based on the answer choices
Explanation: