Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

import java.util.*; public class ArrayDemo { public static void main(String[] args) { int []a= new int [5]; for ( int i=0;i <5;i++) { a[i]=(( int

import java.util.*;

public class ArrayDemo {

public static void main(String[] args)

{

int[]a=new int[5];

for(int i=0;i<5;i++)

{

a[i]=((int)(100.0*Math.random()+1));

}

System.out.println("Array values in original order");

for(int i=0; i<5;i++)

System.out.println(a[i]);

Arrays.sort(a);

System.out.println("Array values in ascending order");

for(int i=0; i<5; i++)

System.out.println(a[i]);

System.out.println("Array values in descending order");

for(int j=4; j>=0;j--)

System.out.println(a[j]);

}

}

/*

Array values in original order

99

52

13

9

100

Array values in ascending order

9

13

52

99

100

Array values in descending order

100

99

52

13

9

*/

Using the example above, create a full program called LottoArray with a class called LottoArray

It will have an array of integers for 6 elements

You will assign the 6 elements 6 random integer values that can be any value 1 through 50 inclusive

You will create luckyLotto integer to be the value 7

You will create luckySum to be 35

You will output the 6 random integers of the array in sorted order

You will output whether or not one of the integers is a 7 and if so it will display that you picked the lucky lotto number

You will output whether or not your 6 numbers added to the lucky sum of 35 and display your sum in the output as well.

You will output the lowest value of the lucky numbers and the highest value of the lucky numbers.

You will display how many values were less than the lucky value of 7 and how many values were more than the lucky value of 7

You will display how many values were exactly the number 7

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

5. Why do most antihistamines make people drowsy?

Answered: 1 week ago

Question

Describe Balor method and give the chemical reaction.

Answered: 1 week ago

Question

How to prepare washing soda from common salt?

Answered: 1 week ago