Question: Project 1 Mission Statement Submit these two java files. Your mission is to upgrade the Random class by adding the following 4 methods AND test

Project 1 Mission Statement

Submit these two java files.

Your mission is to upgrade the Random class by adding the following 4 methods AND test each of the 4 methods 40 times. # new method functionality example

1. new method -nextInt(int low, int high) Returns a random number which is an integer value between the range of low to high. nextInt(5, 9) returns one of 5, 6, 7, 8, 9 (assume low

public class NewRandom extends Random

nextDouble()

nextBoolean()

nextFloat()

nextInt()

nextInt(Int n)

nextBytes(byte[] bytes)

Longs()

nextGaussian()

// add your methods here // method 1 // method 2 . . . }

// overloads Random's nextInt() to return a random number between low and high, both inclusive. [low, high]

public int nextInt(int low, int high) { call one of the methods in the Random class return n; }

/ returns a random lowercase character. public char nextChar() { //use method 1; //do not use ASCII value(code) return (char) n; }

// returns a random lowercase character. // do not use ASCII value(code)

public char nextChar(char from, char to) { // check three cases if (from to) { //use method 1; } if(from == to) { . . . } }

// returns a random lowercase character.

public char nextCharExcept(char c) { // use method 1 and/or method 2 and/or method 3 }

// returns a random ID (length = 7). // do not use ASCII value(code)

public String nextID() { // use method 1 . . . } return ID; } ID Rule: 1) ID must be 8 characters in length. 2) ID must have lower-case AND upper case. 3) ID must start with a letter like [a-z A-Z] 4) Usernames must have at least one number like [0-9] 5) Usernames must have at least one of any special character.

Project 1 Mission Statement Submit these two java files. Your mission is

Test Main program example:

public class NewRandomTest { public static void main(String[] args) { NewRandom rand = new NewRandom(); int test=40; System.out.println(" Method 1: nextInt(5, 9)"); for (int i = 0; i

Write a main test program. You must test all the 4 methods with all the example data shown on slide \# 4 . You must call each method 40 times using the given example data. (see next s

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!