Allan Hancock College Java Programming Project
this is the first fileimport java.util.Random;
//—————————————————————————// DO NOT MAKE ANY CHANGES TO THIS CLASS
//
// Any changes you make to this class will not be used for grading.
//—————————————————————————public class Main
{
public static void main(String[] args)
{
Random prng = new Random();
int min, max;
// random bounds by default
min = prng.nextInt(50);
max = prng.nextInt(50) + 50;
// override with command line args
if (args.length >= 2)
{
try
{
min = Integer.parseInt(args[0]);
max = Integer.parseInt(args[1]);
}
catch (Exception e)
{
System.err.println(“Command line arguments threw an
exception!”);
System.exit(1);
}
}
// create object
Sequence seq = new Sequence(min, max);
// use class
System.out.println(“Sequence bounds:”);
System.out.println(min + “, ” + max);
System.out.println(“Sequence listed:”);
printArray(seq.list());
System.out.println(“Sequence backwards:”);
printArray(seq.backwards());
System.out.println(“Sequence evens:”);
printArray(seq.evens());
System.out.println(“Sequence squares:”);
printArray(seq.squares());
System.out.println(“Sequence summation:”);
System.out.println(seq.summation());
}
public static void printArray(int[] stuff)
{
for (int x : stuff)
System.out.print(x + “, “);
System.out.println();
}
}
this is the second file
public class Sequence
{
private int mMin = 0;
private int mMax = 0;
public Sequence(int min, int max)
{
//TODO: assign the arguments to the class member variables
}
public int[] list()
{
//TODO: return array of the consecutive integers between the bounds
(inclusive)
// i.e. the first number is the min bound and the last number is the
max bound
return new int[0];
}
public int[] backwards()
{
//TODO: return array of the consecutive integers between bounds in
descending order
// i.e. the first number is the max bound and the last number is the
min bound
return new int[0];
}
public int[] evens()
{
//TODO: return array of only even integers in the sequence
// the array should be the exact correct size containing only the
even numbers
return new int[0];
}
public int[] squares()
{
//TODO: return array of sequence integers squared
// i.e. square each integer in the sequence
return new int[0];
}
public int summation()
{
//TODO: return the summation of the sequence
// i.e. add all the sequence integers together and return the result
return 0;
}
}
Top-quality papers guaranteed
100% original papers
We sell only unique pieces of writing completed according to your demands.
Confidential service
We use security encryption to keep your personal data protected.
Money-back guarantee
We can give your money back if something goes wrong with your order.
Enjoy the free features we offer to everyone
-
Title page
Get a free title page formatted according to the specifics of your particular style.
-
Custom formatting
Request us to use APA, MLA, Harvard, Chicago, or any other style for your essay.
-
Bibliography page
Don’t pay extra for a list of references that perfectly fits your academic needs.
-
24/7 support assistance
Ask us a question anytime you need to—we don’t charge extra for supporting you!
Calculate how much your essay costs
What we are popular for
- English 101
- History
- Business Studies
- Management
- Literature
- Composition
- Psychology
- Philosophy
- Marketing
- Economics