1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
n200080 [17]
3 years ago
10

Java: Programming Question: Reverse OrderWrite a program that reads ten integers into an array; define another array to save tho

se 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.
Computers and Technology
1 answer:
Ghella [55]3 years ago
6 0

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!

You might be interested in
When will your stony brook email address become your default or preferred email address for official stony brook communications?
Leona [35]

The stony brook email address will become the default or preferred email address for official stony brook communications as from Aug. 14.

<h3>What is the email about?</h3>

This is known to be the primary campus email address.

Note that it is the address that the University sends official email notifications and it is said to become the 'preferred' or the default or preferred email address for official stony brook communications as from Aug. 14.

Learn  more about a email from

brainly.com/question/24688558

#SPJ1

4 0
3 years ago
Design a class named Cake. Data fields include two string fields for cake flavor and icing flavor and numeric fields for diamete
kkurt [141]

Using the computer language in pseudocode to write a function code that  declares two Cake objects and sets and displays their values.

<h3>Writting the code in pseudocode:</h3>

<em>- cake flavor: string</em>

<em>- icing flavor: string</em>

<em>-diameter: num</em>

<em>-price: num</em>

<em>+set cake flavor (cake flavor : string) : void</em>

<em>+set icing flavor (icing flavor: string) : void</em>

<em>+set Diameter(size : num) : void</em>

<em>+set Price(price : num) : void</em>

<em>+get cake flavor () : string</em>

<em>+get cing flavor () : string</em>

<em>+get Diameter() : num</em>

<em>+get Price() : num</em>

<em>Answer A=</em>

<em>Pseudocode:</em>

<em>class Cake</em>

<em>Declarations</em>

<em>private string cake flavour</em>

<em>private string icing flavor</em>

<em>private num diameter</em>

<em>private num price</em>

<em>public void set Cake flavour (string Cake flavour)this. Cake flavour = Cake flavour</em>

<em>return</em>

<em>public void set icing flavour (string icing flavour)this. icing flavour = icing flavour</em>

<em>return</em>

<em>public void set Diameter(num size)</em>

<em>diameter = size</em>

<em>return</em>

<em>public void set Price(num price)</em>

<em>this price = price</em>

<em>return</em>

<em>public string get Cake flavour ()</em>

<em>return Cake flavour</em>

<em>public string get icing flavour ()</em>

<em>return icing flavour</em>

<em>public num get Diameter()</em>

<em>return diameter</em>

<em>public num get Price()</em>

<em>return price</em>

<em>end Class</em>

<em>start</em>

<em>Declarations</em>

<em>Cake my Cake</em>

<em>Cake your Cake</em>

<em>myCake.set cake flavour (“chocalate”)</em>

<em>myCake.set icing flavour (“peppermint”)</em>

<em>myCake.setDiameter(15)</em>

<em>myCake.setPrice(18)</em>

<em>myCake.set cake flavour (“pineapple”)</em>

<em>myCake.set icing flavour (“orange ”)</em>

<em>yourCake.setDiameter(20)</em>

<em>yourCake.setPrice(25)</em>

<em>output “Cake 1 info:”</em>

<em>output myCake.get cake flavour ()</em>

<em>output myCake.get icing flavour ()</em>

<em>output myCake.getDiameter()</em>

<em>output myCake.getPrice()</em>

<em>output Cake 2 info:”</em>

<em>output yourCake.get cake flavour ()</em>

<em>output yourCake.get icing flavour ()</em>

<em>output yourCake.getDiameter()</em>

<em>output yourCake.getPrice()stop</em>

See more about pseudocode at brainly.com/question/13208346

#SPJ1

5 0
2 years ago
Define a function pyramid_volume with parameters base_length, base_width, and pyramid_height, that returns the volume of a pyram
olga_2 [115]

Answer:

Following are the program in Python programming language

def pyramid_volume(base_length,base_width,pyramid_height):

base_area=base_length*base_width

volume=base_area*pyramid_height*(1/3)

return volume

print('volume for 4.5,2.1,3.0 is:',pyramid_volume(4.5,2.1,3.0))

Explanation:

Here, we define a function "pyramid_volume()" and pass an arguments "base_length,base_width,pyramid_height"

inside that program we have calculated the area of the pyramid and after that we have calculated the volume of that pyramid and return the volume.

Outside of the function we have called the function by passing the arguments.

4 0
4 years ago
Your objective is to create a set of files to be used as ‘flags’ that will be stored on computers used in a ‘capture the flag’ c
Semenov [28]

The following are the steps involved in the Process validation to the industry standard,

1)     Design of the process

2)     Qualification of the process

3)     Verification of the process

Explanation:

Validation is the process of finding whether the process meets its expected outcome.

1)     Construct knowledge about the process to be performed and establish a final design.

2)     Evaluation of the designed process is being done at this stage to rectify the errors and changes can be done.

Test the process to check whether the expected goal of the process being designed is achieved or not.

5 0
4 years ago
A circuit has a resistance of 680 ohm and a current of 0.025 A. What is the voltage of the circuit
uysha [10]
V = IR

V = 680 * 0.025

Therefore

V = 17


If this is an exam-type question, don't forget to include your units too!

<span>Ω Ohms for Resistance
</span>V Volts for Voltage
A Amperes for Current

5 0
3 years ago
Other questions:
  • .Write an if-else statement for the following:
    12·2 answers
  • Manny has created more than one hundred bookmarks. When he looks at the menu, he has to scroll through a very long list of bookm
    15·1 answer
  • When driving a truck is fuel crucial
    9·1 answer
  • When would it be easier to use Cut and Paste over Drag and Drop? Explain?
    6·1 answer
  • I need help ASAP Asap asap!!!
    11·1 answer
  • If you suspect corrupted system files are causing issues, what command can be run to search for and replace the corrupted files?
    13·1 answer
  • Which tool determines whether or not applications, devices, and computers will work with a new operating system, while maintaini
    13·1 answer
  • 12. How many different documents can<br> you have open at one time?
    8·1 answer
  • What should you do if you do not understand the directions on a test?
    12·2 answers
  • Hey someone who's willing to answer this question plz do. <br> I will give you all my points
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!