Question
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started