Create a program that allows the user to pick and enter a low and a high number. Your program should generate 10 random numbers between the low and high numbers picked by the user. Store these 10 random numbers in a 10 element array and output to the screen.
In java code please.
Answer:
import java.util.Scanner;
import java.util.Arrays;
import java.util.Random;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.print("Enter low: ");
int low = scan.nextInt();
System.out.print("Enter high: ");
int high = scan.nextInt();
scan.close();
int rndnumbers[] = new int[10];
Random r = new Random();
for(int i=0; i<rndnumbers.length; i++) {
rndnumbers[i] = r.nextInt(high-low+1) + low;
}
for(int i=0; i<rndnumbers.length; i++) {
System.out.printf("%d: %d\n", i, rndnumbers[i]);
}
}
}
List the operating system you recommend, and write a sentence explaining why.
Answer:
The type of operating system I reccommend really depends on how you use computers
Explanation:
If you want strict productivity/gaming: Windows
If you are a programmer/pen tester: Linux
If you want an easy interface: MacOS X
If you believe in God's third temple: Temple OS
Windows is probably the best for most users due to its balance of a simple interface and its many capabilities. It is also the best OS for gaming due to lack of support in many other OS's.
Linux is pretty much terminal-based with an interface if you need help. Only use this if you know your way around computers well. However, this OS allows you to use many tools that are impossible to use on another OS. This is the OS that many programmers, hackers, and other computer people use due to its coding-oriented environment.
If you like simple then use MacOS. The only problem is that it's only available on apple devices, so you have to pay a pretty penny to use it. This is also a unix-based OS meaning it has SOME linux capabilities.
RIP Terry A. Davis. Temple OS was designed to be the 3rd temple of God prophesized in the bible and created by Terry Davis ALONE over a bunch of years. He made this OS after receiving a revelation from God to make this. According to Davis, all other Operating Systems are inferior and Temple OS is the OS that God uses.
Which type of chart would best display data on the flavors of ice cream that customers prefer?
Answer: pie chart
Explanation: cause i said so
Pie chart is a type of chart would best display data on the flavors of ice cream that customers prefer.
What do you mean by Pie chart?A circular statistical visual with slices illustrating numerical proportion is called a pie chart. Each slice's arc length in a pie chart corresponds to the quantity it represents.
Although it was given that name because it resembles a slice of pie, there are other ways to serve it. The Statistical Breviary by William Playfair, published in 1801, is largely credited with creating the first known pie chart.
In the business sector and in the media, pie charts are used a lot. They have been criticized, though, and many experts advise against using them since it can be challenging to compare data from one pie chart to another or between numerous pie charts, according to study.
Learn more about Pie chart, here
https://brainly.com/question/9979761
#SPJ6
Package Newton’s method for approximating square roots (Case Study: Approximating Square Roots) in a function named newton. This function expects the input number as an argument and returns the estimate of its square root. The program should also include a main function that allows the user to compute the square roots of inputs from the user and python's estimate of its square roots until the enter/return key is pressed.An example of the program input and output is shown below:Enter a positive number or enter/return to quit: 2 The program's estimate is 1.4142135623746899 Python's estimate is 1.4142135623730951 Enter a positive number or enter/return to quit: 4 The program's estimate is 2.0000000929222947 Python's estimate is 2.0 Enter a positive number or enter/return to quit: 9 The program's estimate is 3.000000001396984 Python's estimate is 3.0 Enter a positive number or enter/return to quit
The python program that calculates the volume and the square of the volume is as follows
radius = float(input("Radius: "))
volume = (4.0/3.0) * (22.0/7.0) * radius**3
sqrtVolume = volume**0.5
print(f'The volume is {volume} units cubed')
print(f'The square root of that number is {sqrtVolume}')
How to write the program?The complete program written in Python where comments are used to explain each line is as follows
This gets the radius
radius = float(input("Radius: "))
#This calculates the volume
volume = (4.0/3.0) * (22.0/7.0) * radius**3
#This calculates the square root of the volume
sqrtVolume = volume**0.5
#This prints the volume
print(f'The volume is {volume} units cubed')
#This prints the square root of the volume
print(f'The square root of that number is {sqrtVolume}')
Therefore, The python program that calculates the volume and the square of the volume is as follows
radius = float(input("Radius: "))
volume = (4.0/3.0) * (22.0/7.0) * radius**3
sqrtVolume = volume**0.5
Read more about python programs at
brainly.com/question/26497128
#SPJ2
What styles can the calendar be printed in? Check all that apply.
Quick
Daily style
Weekly Agenda style
Weekly Calendar style
Monthly Agenda style
Monthly style
Bifold style
Trifold style
Answer:
Daily style
Weekly Agenda style
Weekly Calendar style
Monthly style
Trifold style
or
B, C, D, F, H
Write a function endpoints that takes a list of numbers (eg. [5, 10, 15, 20, 25]) and returns a new list of only the first and last elements of the given list (eg. [5, 25]). If the input list is [5], the returned should be [5,5]. The function should return an empty list if an empty list is passed in. The function should not use any variables besides the passed in argument list_.
def endpoints(it) -> list: # YOUR CODE HERE raise NotImplementedError() ] ### BEGIN TESTS assert endpoints([5, 10, 15, 20, 251) -- 15, 25] **# END TESTS U # BEGIN TESTS assert endpoints([5]) - (5, 51 *** END TESTS [] ### BEGIN TESTS assert endpoints(0) -- 0 #*# END TESTS
I included a picture of my code below. Best of luck with your assignment.
Segmentation Faults Recall what causes segmentation fault and bus errors from lecture. Common cause is an invalid pointer or address that is being dereferenced by the C program. Use the program average.c from the assignment page for this exercise. The program is intended to find the average of all the numbers inputted by the user. Currently, it has a bus error if the input exceeds one number. Load average.c into gdb with all the appropriate information and run it. Gdb will trap on the segmentation fault and give you back the prompt. First find where the program execution ended by using backtrace (bt as shortcut) which will print out a stack trace. Find the exact line that caused the segmentation fault.
Q13. What line caused the segmentation fault?
Q14. How do you fix the line so it works properly?
You can recompile the code and run the program again. The program now reads all the input values but the average calculated is still incorrect. Use gdb to fix the program by looking at the output of read_values. To do this, either set a breakpoint using the line number or set a breakpoint in the read_values function. Then continue executing to the end of the function and view the values being returned. (To run until the end of the current function, use the finish command).
Q15. What is the bug? How do you fix it?
//average.c
#include
/*
Read a set of values from the user.
Store the sum in the sum variable and return the number of values
read.
*/
int read_values(double sum) {
int values=0,input=0;
sum = 0;
printf("Enter input values (enter 0 to finish):\n");
scanf("%d",&input);
while(input != 0) {
values++;
sum += input;
scanf("%d",input);
}
return values;
}
int main() {
double sum=0;
int values;
values = read_values(sum);
printf("Average: %g\n",sum/values);
return 0;
}
Answer:
See Explanation
Explanation:
Q13. Line that caused the segmentation fault?
The segmentation fault was caused by line 15 i.e. scanf("%d",input);
Q14. How the line was fixed?
The reason for the segmentation fault is that the instruction to get input from the user into the integer variable "input" was not done correctly.
The correction to this is to modify scanf("d",input) to scanf("%d",input);
Q15. The bug?
The bug is that the method needs to return two value; the sum of the inputted numbers and the count of the inputted numbers.
However. it only returns the count of the inputted number.
So, the average is calculated as: 0/count, which will always be 0
How it was fixed?
First, change the method definition to: void and also include an array as one of its parameters.
void read_values(double sum, double arr []) {
Next:
assign sum to arr[0] and values to arr[1]
In the main method:
Declare an array variable: double arr [2];
Call the read_values function using: read_values(sum,arr);
Get the sum and values using:
sum = arr[0];
values = arr[1];
Lastly, calculate and print average:
printf("Average: %g\n",sum/values);
See attachment for complete modified program
usually it is a rectangular box placeed or underneath your desk
Answer:
Uh... there is no question here.
Explanation:
No question to answer.
— If NOT temp == 32.0 Then. Set temp = 32.0. End If.
What is the error
Answer:
im sorry so sorry i needed the pts
Explanation:
What is the value of the variable answer after the following code is executed?
String strl = "apple", str2 = "banana";
boolean answer = stri.equals(str2) && (stri.length() < str2.length());
true
false
Answer:
false
Explanation:
where did the command line first get its beginning?
Answer:
About twenty years ago Jobs and Wozniak, the founders of Apple, came up with the very strange idea of selling information processing machines for use in the home. The business took off, and its founders made a lot of money and received the credit they deserved for being daring visionaries. But around the same time, Bill Gates and Paul Allen came up with an idea even stranger and more fantastical: selling computer operating systems. This was much weirder than the idea of Jobs and Wozniak. A computer at least had some sort of physical reality to it. It came in a box, you could open it up and plug it in and watch lights blink. An operating system had no tangible incarnation at all. It arrived on a disk, of course, but the disk was, in effect, nothing more than the box that the OS came in. The product itself was a very long string of ones and zeroes that, when properly installed and coddled, gave you the ability to manipulate other very long strings of ones and zeroes. Even those few who actually understood what a computer operating system was were apt to think of it as a fantastically arcane engineering prodigy, like a breeder reactor or a U-2 spy plane, and not something that could ever be (in the parlance of high-tech) "productized."
is English-like, easy to learn and use. uses short descriptive word to represent each of the machine-language instructions. is computer's native language. translates the entire source code into a machine-code file. processes one statement at a time, translates it to the machine code, and executes it. is a program written in a high-level programming language. is a program that translates assembly-language code into machine code.
Answer:
The appropriate choice is "Assembly Language ".
Explanation:
Such assembly languages were indeed low-level software packages designed for something like a mobile device or indeed any programmable machine. Written primarily throughout assembly languages shall be constructed by the assembler. Each assembler seems to have its programming languages, which would be focused on a particular computational physics.Which term refers to a solution to a large problem that is based on the solutions of smaller subproblems. A. procedural abstraction B. API C. modularity D. library
Answer:
procedural abstraction
Explanation:
The term that refers to a solution to a large problem that is based on the solutions of smaller subproblems is A. procedural abstraction.
Procedural abstraction simply means writing code sections that are generalized by having variable parameters.
Procedural abstraction is essential as it allows us to think about a framework and postpone details for later. It's a solution to a large problem that is based on the solutions of smaller subproblems.
Read related link on:
https://brainly.com/question/12908738
What does the term "death by powerpoint" refer to when dealing with Powerpoint presentations?
Answer:
Death by PowerPoint is a phenomenon caused by the poor use of presentation software. Key contributors to death by PowerPoint include confusing graphics, slides with too much text and presenters whose idea of a good presentation is to read 40 slides out loud.
Explanation:
Hope this helps :)
6. Which is not considered a storage device a. USB Flash Drive b. External hard Drive c. MS-Windows d. Internal Hard Drive e. Memory Cards
Answer:
MS-Windows
Explanation:
MS-Windows is an operating system not a storage device.
Write a program, named sortlist, that reads three to four integers from the command line arguments and returns the sorted list of the integers on the standard output screen. You need to use strtok() function to convert a string to a long integer. For instance,
Answer:
In C++:
void sortlist(char nums[],int charlent){
int Myarr[charlent];
const char s[4] = " ";
char* tok;
tok = strtok(nums, s);
int i = 0;
while (tok != 0) {
int y = atoi(tok);
Myarr[i] = y;
tok = strtok(0, s);
i++;
}
int a;
for (int i = 0; i < charlent; ++i) {
for (int j = i + 1; j < charlent; ++j) {
if (Myarr[i] > Myarr[j]) {
a = Myarr[i];
Myarr[i] = Myarr[j];
Myarr[j] = a;
} } }
for(int j = 0;j<charlent;j++){ printf(" %d",Myarr[j]); }
}
Explanation:
This line defines the sortlist function. It receives chararray and its length as arguments
void sortlist(char nums[],int charlent){
This declares an array
int Myarr[len];
This declares a constant char s and also initializes it to space
const char s[4] = " ";
This declares a token as a char pointer
char* tok;
This line gets the first token from the char
tok = strtok(nums, s);
This initializes variable i to 0
int i = 0;
The following while loop passes converts each token to integer and then passes the tokens to the array
while (tok != 0) {
int y = atoi(tok); -> Convert token to integer
Myarr[i] = y; -> Pass token to array
tok = strtok(0, s); -> Read token
i++;
}
Next, is to sort the list.
int a;
This iterates through the list
for (int i = 0; i < charlent; ++i) {
This iterates through every other elements of the list
for (int j = i + 1; j < charlent; ++j) {
This condition checks if the current element is greater than next element
if (Myarr[i] > Myarr[j]) {
If true, swap both elements
a = Myarr[i];
Myarr[i] = Myarr[j];
Myarr[j] = a;
} } }
The following iteration prints the sorted array
for(int j = 0;j<charlent;j++){ printf(" %d",Myarr[j]); }
}
See attachment for illustration of how to call the function from main
Write the Number class that can be used to test if the number is odd, even, and perfect. A perfect number is any number that is equal to the sum of its divisors. Write the NumberAnalyzer class that has an ArrayList of Number to determine how many numbers in the list are odd, even, and perfect.
Answer:
Explanation:
The following code is written in Python. It creates a class that takes in one ArrayList parameter and loops through it and calls two functions that check if the numbers are Perfect, Odd, or Even. Then it goes counting each and printing the final results to the screen.
class NumberAnalyzer:
def __init__(self, myArray):
perfect = 0
odd = 0
even = 0
for element in myArray:
if self.isPerfect(element) == True:
perfect += 1
else:
if self.isEven(element) == True:
even += 1
else:
odd += 1
print("# of Perfect elements: " + str(perfect))
print("# of Even elements: " + str(even))
print("# of Odd elements: " + str(odd))
def isPerfect(self, number):
sum = 1
i = 2
while i * i <= number:
if number % i == 0:
sum = sum + i + number / i
i += 1
if number == sum:
return True
else:
return False
def isEven(self, number):
if (number % 2) == 0:
return True
else:
return False
1. What does it mean for a website to be "responsive"?
This function finds the minimum number in a list. What should be replaced with in order for this function to operate as expected?
Answer choices:
A. numList[i] = min;
B. min = numList[i];
C. min = numList;
D. numList = min;
Answer: a
Explanation:
Just took the test
Write a C program that does the following: Creates a 100-element array, either statically or dynamically Fills the array with random integers between 1 and 100 inclusive Then, creates two more 100-element arrays, one holding odd values and the other holding even values (copied from the original array). These arrays might not be filled completely. Prints both of the new arrays to the console.
Answer:
Following are the code to this question:
#include <iostream>//header file
using namespace std;
int main()//main method
{
int axb[100];//defining 1-array of 100 elements
int odd_axb[100], even_axb[100];//defining two array that holds 100-elements
int i,size=0,size1=0;
for(i = 0; i < 100; i++)//defining for loop to assign value in array
{
axb[i] = rand() % 100 + 1;//using rand method to assign value with random numbers between 1 and 100
}
for(i = 0; i < 100; i++)//defining for loop that seprates array value in odd and even array
{
if(axb[i] % 2 == 0)//checking even condition
{
even_axb[size++] = axb[i];//holding even number
}
else//else block
{
odd_axb[size1++] = axb[i];//holding Odd number
}
}
//printing values
cout << "Odd array: ";//print message
for(i = 0; i <size1; i++)//use for loop for print odd numbers
{
cout << odd_axb[i]<<" ";//printing values
}
cout <<"\n\n"<< "Even array: ";//print message
for(i = 0; i <size; i++)//use for loop for print even_axb numbers
{
cout << even_axb[i] << " ";//printing values
}
return 0;
}
Output:
Odd array: 87 87 93 63 91 27 41 27 73 37 69 83 31 63 3 23 59 57 43 85 99 25 71 27 81 57 63 71 97 85 37 47 25 83 15 35 65 51 9 77 79 89 85 55 33 61 77 69 13 27 87 95
Even array: 84 78 16 94 36 50 22 28 60 64 12 68 30 24 68 36 30 70 68 94 12 30 74 22 20 38 16 14 92 74 82 6 26 28 6 30 14 58 96 46 68 44 88 4 52 100 40 40
Explanation:
In the above-program, three arrays "axb, odd_axb, and even_axb" is defined, that holds 100 elements in each, in the next step, three integer variable "i, size, and size1" is defined, in which variable "i" used in the for a loop.
In the first for loop, a rand method is defined that holds 100 random numbers in the array, and in the next, for-loop a condition statement is used that separates even, odd number and store its respective array, and in the last for loop, it prints its store values
You are implementing a wireless network in a dentist's office. The dentist's practice is small, so you choose to use an inexpensive consumer-grade access point. While reading the documentation, you notice that the access point supports Wi-Fi Protected Setup (WPS) using a PIN. You are concerned about the security implications of this functionality. What should you do to reduce risk
Answer:
You should disable WPS in the access point's configuration.
Explanation:
Encryption is a form of cryptography and typically involves the process of converting or encoding informations in plaintext into a code, known as a ciphertext. Once, an information or data has been encrypted it can only be accessed and deciphered by an authorized user.
Some examples of encryption algorithms are 3DES, AES, RC4, RC5, and RSA.
In wireless access points, the encryption technologies used for preventing unauthorized access includes WEP, WPA, and WPA2.
In this scenario, you notice that an access point supports Wi-Fi Protected Setup (WPS) using a PIN and you are concerned about the security implications of this functionality. Therefore, to reduce this risk you should disable Wi-Fi Protected Setup (WPS) in the access point's configuration.
This ultimately implies that, the wireless access point will operate in an open state and as such would not require any form of password or PIN for use.
. What projects would Excel best be used for?
Answer:
Projects that require spreadsheet organization and/or calculations between data
Explanation:
That is why Excel is a spreadsheet program
what is musical technology specifically, the origins of its genesis & its importance to the baroque era
Answer:
There were three important features to Baroque music: a focus on upper and lower tones; a focus on layered melodies; an increase in orchestra size. Johann Sebastian Bach was better known in his day as an organist. George Frideric Handel wrote Messiah as a counterargument against the Catholic Church
A car dealership needs a program to store information about the cars for sale. For each car, they want to keep track of the following information number of doors (2 or 4), whether the car has air conditioning, and its average number of miles per gallon. Which of the following is the best design?
a. Use classes: Doors, Airconditioning, and MilesPerGallon, each with a subclass Car.
b. Use a class Car, with subclasses of Doors, Airconditioning, and MilesPerGallon.
c. Use a class Car with three subclasses: Doors, Airconditioning, and MilesPerGallon.
d. Use a class Car, with fields: numDoors, hasAir, and milesPerGallon.
e. Use four unrelated classes: Car, Doors, Airconditioning, and MilesPerGallon.
Answer:
The answer is "Choice d".
Explanation:
In this topic, the option d, which is "Use a class Car, with fields: numDoors, hasAir, and milesPerGallon" is right because the flag, if air-conditioned, of its numbers of doors, was its average kilometers per gallon, qualities of either an automobile, in which each one is a basic value so that they're being fields of a class of cars.
The best design for the given program will be;
D: Use a class Car, with fields: numDoors, hasAir, and milesPerGallon.
What is the best design for the program?In this question, the best design for the program to keep track of the number of doors (2 or 4), whether the car has air conditioning, and its average number of miles per gallon is to "Use a class Car, with fields: numDoors, hasAir, and milesPerGallon"
That option is right because has classified the cars with the accurate parameters to be searched which are its numbers of doors, average miles per gallon, air condition.
Read more about programming at; https://brainly.com/question/22654163
Veronica is looking for a reliable website with information about how old you have to be to use social media. What should she look for?
Answer:
The URL of the website
Explanation:
Look for .gov and .edu as they are often reliable sources
The return value is a one-dimensional array that contains two elements. These two elements indicate the rows and column indices of the largest element in the two-dimensional array. Write a test program that prompts the user to enter a two-dimensional array and displays the location of the largest element in the array.
Answer:
In Java:
import java.util.Scanner;
import java.util.Arrays;
public class Main {
public static void main(String args[]) {
Scanner input = new Scanner(System.in);
int row, col;
System.out.print("Rows: "); row = input.nextInt();
System.out.print("Cols: "); col = input.nextInt();
int[][] Array2D = new int[row][col];
System.out.print("Enter array elements: ");
for(int i =0;i<row;i++){
for(int j =0;j<col;j++){
Array2D[i][j] = input.nextInt();
} }
int[] maxarray = findmax(Array2D,row,col);
System.out.println("Row: "+(maxarray[0]+1));
System.out.println("Column: "+(maxarray[1]+1));
}
public static int[] findmax(int[][] Array2D,int row, int col) {
int max = Array2D[0][0];
int []maxitem = new int [2];
for(int i =0;i<row;i++){
for(int j =0;j<col;j++){
if(Array2D[i][j] > max){
maxitem[0] = i;
maxitem[1] = j; } } }
return maxitem;
}
}
Explanation:
The next two lines import the scanner and array libraries
import java.util.Scanner;
import java.util.Arrays;
The class of the program
public class Main {
The main method begins here
public static void main(String args[]) {
The scanner function is called in the program
Scanner input = new Scanner(System.in);
This declares the array row and column
int row, col;
This next instructions prompt the user for rows and get the row input
System.out.print("Rows: "); row = input.nextInt();
This next instructions prompt the user for columns and get the column input
System.out.print("Cols: "); col = input.nextInt();
This declares the 2D array
int[][] Array2D = new int[row][col];
This prompts the user for array elements
System.out.print("Enter array elements: ");
The following iteration populates the 2D array
for(int i =0;i<row;i++){
for(int j =0;j<col;j++){
Array2D[i][j] = input.nextInt();
} }
This calls the findmax function. The returned array of the function is saved in maxarray
int[] maxarray = findmax(Array2D,row,col);
This prints the row position
System.out.println("Row: "+(maxarray[0]+1));
This prints the column position
System.out.println("Column: "+(maxarray[1]+1));
The main method ends here
}
The findmax function begins here
public static int[] findmax(int[][] Array2D,int row, int col) {
This initializes the maximum to the first element of the array
int max = Array2D[0][0];
This declares maxitem. The array gets the position of the maximum element
int []maxitem = new int [2];
The following iteration gets the position of the maximum element
for(int i =0;i<row;i++){
for(int j =0;j<col;j++){
if(Array2D[i][j] > max){
maxitem[0] = i; -- The row position is saved in index 0
maxitem[1] = j; -- The column position is saved in index 1} } }
This returns the 1 d array
return maxitem;
}
Giving brainliest if you answer question.
I need help on these three questions I would really appreciate it
Answer:
True
c
void
Explanation:
I dont know how i know this...
x = 2. x+=15
Int returns number Boolean returns true of false . . . void return none.
alendar year. The current calendar is called the Gregorian calendar, was introduced in 1582. Every year divisible by four was created to be a leap yer, with exception of the years ending with 00 (that is, those divisible by 100) and not divisible by 400. For instance, the years 1600 and 2000 are leap years, but 1700, 1800, and 1900 are not. Write a ptogram that requests a year as input states wether it is a leap year.
Answer
Tough question.
i dont know
Explanation:
Play now? Play later?
You can become a millionaire! That's what the junk mail said. But then there was the fine print:
If you send in your entry before midnight tonight, then here are your chances:
0.1% that you win $1,000,000
75% that you win nothing
Otherwise, you must PAY $1,000
But wait, there's more! If you don't win the million AND you don't have to pay on your first attempt,
then you can choose to play one more time. If you choose to play again, then here are your chances:
2% that you win $100,000
20% that you win $500
Otherwise, you must PAY $2,000
What is your expected outcome for attempting this venture? Solve this problem using
a decision tree and clearly show all calculations and the expected monetary value at each node.
Use maximization of expected value as your decision criterion.
Answer these questions:
1) Should you play at all? (5%) If you play, what is your expected (net) monetary value? (15%)
2) If you play and don't win at all on the first try (but don't lose money), should you try again? (5%) Why? (10%)
3) Clearly show the decision tree (40%) and expected net monetary value at each node (25%)
Answer:
wow what a scam
Explanation: