Java: Programming Question: Reverse OrderWrite a program that reads ten integers into an array; define another array to save those ten numbers in the reverse order. Display the original array and new array. Then define two separate methods to compute the maximum number and minimum number of the array.Sample Run:Please enter 10 numbers: 1 3 5 8 2 -7 6 100 34 20The new array is: 20 34 100 6 -7 2 8 5 3 1The maximum is: 100The minimum is: -7Bonus: Determine how many numbers are above or equal to the average and how many numbers are below the average.

Answers

Answer 1

import java.util.Scanner;

import java.util.Arrays;

public class JavaApplication47 {

   public static void main(String[] args) {

       Scanner scan = new Scanner(System.in);

       System.out.print("Please enter 10 numbers: ");

       String [] nums = scan.nextLine().split(" ");

       int newNums[] = new int [nums.length];

       int w = 0, total = 0, above = 0, below = 0;

       for (int i=(nums.length-1); i>=0;i--){

           newNums[w] = Integer.parseInt(nums[i]);

           w++;

       }

       System.out.println("The old array is: "+Arrays.toString(nums));

       System.out.println("The new array is: "+Arrays.toString(newNums));

       Arrays.sort(newNums);

       System.out.println("The maximum is: "+newNums[9] + "\nThe minimum is: "+newNums[0]);

       for (int i : newNums ){

           total += i;

       }

       total = total / 10;

       for (int i : newNums){

           if (i >= total){

               above += 1;

           }

           else{

               below += 1;

           }

       }

       System.out.println("There are "+above+" numbers above or equal to the average.");

       System.out.println("There are "+below+" numbers below the average.");

   }

   

}

I hope this helps!


Related Questions

The HTTP protocol operates at which layer?

Answers

Answer:

application layer i believe

Answer:

The HyperText Transfer Protocol (HTTP), is the Web's application-layer protocol, is at the heart of the Web

Explanation:

Write a recursive function called sum_values that takes in a list of integers and an index of one element in the list and returns the sum of all values/elements in the list starting with the element with the provided index and ending with the last element in the list.

Answers

Answer:

Explanation:

The following code is written in the Java programming language and actually takes in three parameters, the first is the list with all of the int values. The second parameter is the starting point where the adding needs to start. Lastly is the int finalSum which is the variable where the values are all going to be added in order to calculate a final int value. Once the recursive function finishes going through the list it exits the function and prints out the finalSum value.

   public static void sum_Values(ArrayList<Integer> myList, int startingPoint, int finalSum) {

           if (myList.size() == startingPoint) {

               System.out.println(finalSum);

               return;

           } else {

               finalSum += myList.get(startingPoint);

               sum_Values(myList, startingPoint+1, finalSum);

           }

           

   }

Write code that creates a text area displaying 10 rows and 15 columns. The text area should be capable of displaying scroll bars, when necessary. It should also perform word style line wrapping.

Answers

Answer:

<textarea wrap="hard" cols="30" rows="5"></textarea>

Explanation:

A textarea element or tag is a form tag element of a HTML file. It is used to ask for input value from a user in a webpage. The textarea tag has an opening and a closing tag.

The 'cols' attribute is used to set the column length while the 'rows' attribute sets the row length of the textarea element. The 'wrap' attribute has three options namely; soft, hard, and off. 'soft' adds the textarea wrapping, 'hard' sets off the box wrapping but only wraps each line, while the 'off' option removes all wrapping in the tag.

Which of the following is NOT a reason to include comments in programs
A. Comments help the computer decide whether certain components of a program are important.
B. Comments help programmers debug issues in their own code
C. Comments help document how code was written for other programmers to use
D. Comments enable programmers to track their work throughout the development process

Previous page Submit

Answers

Answer:

C. Comments help document how code was written for other programmers to use.

Explanation:

I think it i C.

Answer:

A. Comments help the computer decide whether certain components of a program are important.

- just took the test and got it right. hope this helps!!

How do I fix my mistake in the code, do not give me a bs answer like “I don’t know sorry” if you do not know just move on because I will report it like I have before.

Answers

The problem lies within your if statement. You're using a single equals sign when you should be using two.

if (operation == 1)

Two equal signs is a comparison operator. It checks to see if one value equals another value. In your case, its checking if operation equals 1. But, this only solves half the problem. Operation is a string and you need to compare it to a string.

if (operation == "1")

I hope this helps!

Many believe that U.S. tax policy should provide a level playing field for traditional retail businesses, mail order companies, and online merchants. What form of ebusiness challenge is this statement referring to?
A. Adhering to taxation rules.
B. Ensuring consumer protection.
C. Identifying limited market segments.
D. Managing consumer relationships.

Answers

Answer:

A. Adhering to taxation rules.

Explanation:

This is because, when there is no level playing field for different segments of the business in terms of U.S tax policy, there will surely be challenges in "Adhering to taxation rules."

Given that the statement might imply that there are different rules applicable to different sectors of business, this will make it difficult for the different firms or players involved to follow the taxation rules.

Hence, stating that many believe that U.S. tax policy should provide a level playing field for traditional retail businesses, mail order companies, and online merchants, indicated that the e-business challenge is "Adhering to taxation rules."

Copy the formula from cell c5 to the range c6- c11

Answers

Answer:

Where is cell c5

Explanation:

what is suitable equipment to meet customer needs from
1 stand alone pcs
2 networked pcs
3 servers
4 network equipment
5 operating system
6 application software

Answers

uh i think it’s uh carrot

(Decimal to binary) Write a recursive method that converts a decimal number into a binary number as a string. The method header is public static String dec2Bin(int value) Write a test program that prompts the user to enter a decimal number and displays its binary equivalent.

Answers

Answer and Explanation:

import java.util.Scanner;

public class convertToBinary {

public static String declToBin(int value){

if(value == 1){

return declToBin((value/2) + "" + (value%2);

}

else{

declToBin((value/2) + "" + (value%2);

}

}

public static void main(String args[]){

int number;

Scanner change = new Scanner(System.in);

System.out.print("Enter decimal value: ");

number = change.nextInt();

System.out.println(declToBin(number));

}

}

The recursive function declToBin(int value) keeps executing code until value==1. Recursive functions reduces lines of code and makes it more efficient.

Note: Decimal is number in base 10(denary). To convert a decimal number to base 2(binary), we keep dividing the decimal number entered by the user by 2 until the result is zero(when the number divided is one)

We use the Java programming language here. First we import the Scanner object(import.java.util.Scanner). We use the method nextint() from the object to convert the string value entered by the user to int value( because our declToBin function takes an int parameter).

Is this statement true or false? You can apply only one of these at a time: underline, bold, or italics. true false

the correct answer is false ​

Answers

I think false not sure but let other people help u answer and u can decide

Answer:

its false

Explanation:

Write an application named Hurricane that outputs a hurricane’s category based on the user’s input of the wind speed. Category 5 hurricanes have sustained winds of at least 157 miles per hour. The minimum sustained wind speeds for categories 4 through 1 are 130, 111, 96, and 74 miles per hour, respectively. Any storm with winds of less than 74 miles per hour is not a hurricane. If a storm falls into one of the hurricane categories, output This is a category # hurricane, with # replaced by the category number. If a storm is not a hurricane, output This is not a hurricane.

Answers

Answer:

def Hurricane(wind_speed):

   if wind_speed >= 157:

       print("Category 5 hurricane")

   elif wind_speed >= 130:

       print("Category 4 hurricane")

   elif wind_speed >= 111:

       print("Category 3 hurricane")

   elif wind_speed >= 96:

       print("Category 2 hurricane")

   elif wind_speed >= 74:

       print("Category 1 hurricane")

   else:

       print("Not a hurricane")

Hurricane(121)

Explanation:

The function "Hurricane" in the python code accepts only one argument which is the recorded speed of a hurricane. The nested if-statement evaluates the speed of the hurricane and output the appropriate category of the hurricane based on the speed.

Java Eclipse homework. I need help coding this

Challenge 14A - BaseConverter

Package: chall14A
Class: BaseConverter

Task: Create a program that takes user input as a decimal and converts it to either an octal, binary, or hexadecimal base:

1. Show a title on the screen for the program.
2. Ask the user if they want to run the program.
3. Create a menu for the user to choose the base to convert to.
4. Take decimal (base10) from user and print out the number in the new base.

Answers

import java.util.Scanner;

public class BaseConvertor {

   

   public static void main(String[] args) {

       Scanner scan = new Scanner(System.in);

       System.out.println("Welcome to Base Convertor! This program will convert numbers into different bases of your choosing.");

       System.out.print("Do you still want to run the program? ");

       String ans = scan.next();

       if (ans.toLowerCase().equals("yes")){

           System.out.println("1. Octal");

           System.out.println("2. Binary");

           System.out.println("3. Hexadecimal");

           System.out.print("Type the number of the base you want to conver to: ");

           int base = scan.nextInt();

           System.out.print("Enter your number: ");

           int num = scan.nextInt();

           if (base == 1){

               

               String newNum = Integer.toOctalString(num);

               System.out.println(num+" in Octal is "+newNum);

           }

           else if (base == 2){

               String newNum = Integer.toBinaryString(num);

               System.out.println(num+" in Binary is "+newNum);

           }

           else if (base == 3){

               String newNum = Integer.toHexString(num);

               System.out.println(num+" in Hexadecimal is "+newNum);

           }

                   

       }

       else{

           System.out.println("Have a good day!");

       }

   }

   

}

I hope this helps!

Write a sed command that will display all lines of the birthday file that do not contain the string March. What was the sed command?

Answers

Answer:

sed '/march/{d;}' birthdays.txt > result .txt

Explanation:

sed syntax is basically:

sed '/expression/{command;command;...;}' inputfile > outputfile

First, for the expression part, we use /march/ to match all lines containing that string. Then for the command part, we only use {d} command to delete every matching line found.The third part contains the input file to process, I have named it birthdays.txt, but it could have been any other file needed.Finally "> result .txt" makes the script output to be saved into a file named result.txt

Write a code for function main, that does the following: creates a variable and assign it the value True. uses a while loop which runs as long as the variable of the previous step is True, inside the while loop, get three integer numbers n1, n2 and n3 from the user and

Answers

Answer:

def main():

   is_true = True

   while is_true == False:

       try:

           num1 = int(input("Enter first number: ")

           num2 = int(input("Enter second number: ")

           num3 = int(input("Enter third number: ")

       except ValueError:

           print("Input must be an integer number")

       is_true = bool(input("do you want to end loop? True/False: "))

main()

Explanation:

The python main function above continuously creates three integer numbers in a while loop statement until a false input is received from the user.

Builder Software is used to create _____? answers: 3d digital art design for cameras audio special effects

Answers

Answer:

HTML website without inputting manual codes

Explanation:

A Builder Software in computer engineering or science is a general name of the software that is designed to give users the ability to build HTML websites without inputting the manual codes themselves. The software comes with tools that help to create the user interface without adding code.

Example of Builder Software is Squarespace, Wix, Dudamonile, Weebly, OnDevice, RedTim, etc.

Answer:

I think it's used to create 3-D digital art

Explanation:

write an essay about yourself based on the dimensions of ones personality​

Answers

I don’t think that we can answer this question, since it’s based on yourself.

A computer is using a fully associative cache and has 216 bytes of memory and a cache of 64 blocks, where each block contains 32 bytes.

Required:
a. How many blocks of main memory are there?
b. What is the format of a memory address as seen by the cache, that is, what are the sizes of the tag and offset fields?
c. To which cache block will the memory address F8C9 (subscript) 16 map?

Answers

1) The number of blocks of main memory that are there are;

2^16/32 = 2^16/2^5 = 2^11

2) The format of a memory address as seen by the cache,that is the sizes of the tag and offset fields are;

16 bit addresses with 11 bits also in the tag field and the 5 bits in the word field.

3) The cache block that the memory address F8C9 (subscript) 16 map;

Since it is an associative cache, it can actually map anywhere.

That is, it has the ability of mapping anywhere.

Consider the use of 1000-bit frames on a 1-Mbps satellite channel with a 270-ms delay. What is the maximum link utilization for,
a. Stop-and-wait flow control?
b. Continuous flow control with a window size of 7?
c. Continuous flow control with a window size of 127?

Answers

i feel as if it would be B.

An IT suspects that an unauthorized device is connected to a wireless network. This is a result of pastry sharing on a device brought from home. What is put in place to stop such activity.

1- Media Access Control Filtering

2- Channel Overlap

3-WiFi Protected Access 2

4- collision Domain

Answers

Answer:

3. WiFi Protected Access 2

Explanation:

Given that Wi-Fi Protected Access 2 often referred to as WAP 2 is a form of computer security or privacy measure to ensure that Wireless networks are furnished with powerful security of data network access control.

Hence, when a user employed or utilize WPA2. It gives such a user a high degree of maximum certainty of controlling the users that can have access to his wireless network.

Hence, in this case, what is put in place to stop such activity is Wi-Fi Protected Access 2

Which of the following is an input device on a toaster?
O the heating element
the tray
O the start button
the electrical outlet

Answers

The electrical outlet
The start button the electrical oulet

Write the function appendEvens() which, given two arrays, adds all of the even elements from the first to the second. You may assume the second has enough space.

Answers

Answer:

function appendEvens( arr1, arr2) {

   for (let i in arr1){

       if (i%2 == 0){

           arr2.push(i);

       }

   }

}

Explanation:

The defined javascript function "appendEvens" is a function that returns undefined. It accepts two arrays and pushes the even numbers from the first array to the second.

Which items are placed at the end of a
document
O Header
O Footer
O Foot Note
O End note​

Answers

Answer:

End note, I think plz tell me if im wrong thank you

Complete the sentence.
Python is a_____
level language compared to bytecode.

Answers

Python is an interpreted, object-oriented, high-level programming language with dynamic semantics.

Python is a high level language compared to bytecode.

Why Python is a high level programming language?

Hence, being an interpreted language, which is not subject to processor, makes Python a high-level language. Also, Python offers convenience of code readability -- which makes the syntax of the program much easier and shorter, resulting in less coding steps for developers than imposed by Java or C++.

Which type of language is Python?

Python is an interpreted, interactive, object-oriented programming language. It incorporates modules, exceptions, dynamic typing, very high level dynamic data types, and classes.

To learn more about python, refer

https://brainly.com/question/24700944

#SPJ2

You used range in definite loops earlier in the course. The output of the range function is a sequence, which is a list of integers.


range(3) creates which sequence of numbers?



[1, 2, 3]


[0, 1, 2, 3]


[1, 2, 3, 4]


[0, 1, 2]

kAka pEe POoPOOoO

Answers

Answer:
It is D [0,1,2,]
Explanation:
PeE KakA PoOpOo GAGAGAGAGAGAGAGAGAGAGGAGAGAGAGAGAGAGAGAA

The output of the range function is a sequence, which is a list of integers. The range created in the sequence of number is [0, 1, 2]. Hence option D is correct.

What are integers?

Integers are defined as a whole number that can be positive, negative, or zero and is not a fraction. Your integer can be written in a number of different ways. Write your integer, for instance, in standard form (such as 63), extended form (such as 100+50+2, which would be 152 in standard form), or written form (such as one thousand two hundred thirteen).

Pass range start and stop values () such as range (0, 6). Here, start is equal to 0 and stop is equal to 6. Send range the step value () the move Put the increment in. For accessing each integer, use a for loop. To iterate and access a series of numbers returned by a range(), use a for loop.

Thus, the output of the range function is a sequence, which is a list of integers. The range created in the sequence of number is [0, 1, 2]. Hence option D is correct.

To learn more about integers, refer to the link below:

https://brainly.com/question/15276410

#SPJ2

It is easier to make an object move across the screen by using the tweening function rather than creating each individual frame of the movement.

True

False

Answers

Uhhhh I believe it’s true if it’s wrong I’m srry ....

The two types of attack on an encryption algorithm are cryptanalysis, based on properties of the encryption algorithm, and _________ which involves trying all possible keys.

Answers

Answer:

Brute force

Explanation:

The two types of attack on an encryption algorithm are cryptanalysis, based on properties of the encryption algorithm, and brute force which involves trying all possible keys.

In brute force attacks there is the issue of using different keys and this is because the attacker is trying to guess the passwords used in the system in order to have it compromised.

Answer:

D.  

triple Data Encryption Standard (DES)

Explanation:

                                       Sincerely : Baby weeb

Switched backbone networks:_____.a. always use a ring topology.b. require much more management that do routed backbone networks.c. use a star topology with one device, usually a switch.d. are the least common type of BN used in one building.e. switch the traffic based on layer 3 addresses.

Answers

Answer:

c

Explanation:

spongo  

What is the function of the operating system of a computer?

It allows the CPU to communicate with input and output devices.
It executes commands from other computer hardware.
It lets the user communicate with the mouse.
It processes information from the hard drive to allow programs to run.

Answers

Answer:

It allows the CPU to communicate with input and output devices.

Explanation:

Plzzzzzzzzzzzzz give me brainiest

PLS HELP I WILL MARK BRAINLIEST

Answers

Answer:

C

Explanation:

Animal cells each have a centrosome and lysosomes, whereas plant cells do not. Plant cells have a cell wall, chloroplasts and other specialized plastids, and a large central vacuole, and animal cells do not.

The project sponsor has asked Franz to hold a kickoff meeting for their project. What is the purpose of a
kickoff meeting?
Select an answer:
Introduce the team to the project, processes, and to one another.
Obtain approval for the team to start work on their assignments.
Provide an opportunity for the sponsor to talk about the project,
Obtain approval of the project plan.

Answers

Answer:

Introduce the team to the project

Explanation:

You never want to get ahead always start slown and easy for the team so none gets left behind also can i get brainliest

The purpose of the kickoff meeting is Introduce the team to the project, processes, and to one another.

The information regarding the kickoff meeting is as follows:

In this, the team members get to know each other.It helps team members to understand the objectives of the project.Also it permits the stakeholders for understanding the risk, assumptions, etc.

Learn more: brainly.com/question/17429689

Other Questions
Read the following statements and select theconditional statements. Check all that apply.If my car starts, I can drive to workIt is inconvenient when the car does not start.If my car does not start, I will ride the bus toworkI purchased this car used, and it is notreliable what are the three subsections of movement PLEASE HELP Rewrite without parentheses. -3y^4(6y^3 -7y^2 - 3y)( click/tap on image to see.) D. 10 + 11k can someone plzz help meeee plzzzz help me please? i needa help. am bad at maths. who is the father of computer A. Abraham Lincoln B. Charles Babbage According to the passage, Chaplin got the idea for the film Modern Times from Iman and Mark went out for lunch. Part A: Their food and beverages cost $21.75, and there was a 7% meals tax. How much was the bill? A. $1.52 B. $15.23 C. $23.27 D. $23.49 Part B: After adding a tip, the total lunch cost was $27.19. What percent tip did Iman and Mark leave? A. 25% B. 18% C. 14% D. 10% pls help with this science homework Respond to the quote in 3-5 complete sentences. Think about what the quote means and how you can or have applied it to your life.----------------------------------------------------------------------------------------------------------------------------The world is a dangerous place;Not because of those who do evil, But because of those who look on and do nothing.:-Albert Einstein Find the prime factorization of 196. Use a method of your choice. List your final answer using exponents. Is mortgage a long term liability, capital, current assets , fixed assets, current liability? Fire And Ice by Robert Frost Some say the world will end in fire, Some say in ice. From what Ive tasted of desire I hold with those who favor fire. But if it had to perish twice, I think I know enough of hate To say that for destruction ice Is also great And would suffice. how many syllables are in it PLEASEEE HELPPP I NEED THIS TODAY!! if you are the chairperson of Nepal DisabledWomen Association ,what plan would you make for the disabled women's welfare and make them independent?PLEASE GIVE YOUR OWN ANSWER please help me in this question What are the two possible methods for countering an argument? Different periods in human history are named for the materials used to make tools. Dr. Franklin is searching through layers of soil, looking for tools made by humans. After screening the top layer of soil, he uses a magnet to help speed up the search.Which type of location is Dr. Franklin most likely searching? A) a cave from before the Stone AgeB) a Stone Age caveC) a Bronze Age battle siteD) an Iron Age farm answer number 19 pls Cules son las ventajas y desventajas de la monarqua militar? Ayuda! No encuentro la informacin en ninguna parte