ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 103 Weeks Ago, 3 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 03 May 2017 My Price 9.00

LiFiUnit5.java -­ Main Method

I am having some issues writing a program for my introduction to programming class (CS151).  Attached you will find the same instructions as listed below, just in a word doc.  Any and all help is greatly appreciated!

LiFiUnit5.java -­ Main Method

-Get input for maximum random number into a String variable. Allow a maximum of 8 (see example).

-Use the Integer wrapper class to parse the integer out of the string and store in an integer variable.

-Get input for number of rounds into an integer. Allow a maximum of 8 (see example).

-Create a Header and Data format string to output results as shown in the sample at the bottom.

-Utilizing a for loop, output results meeting following criteria:

      o One line should be output for each round.

             o Each line should contain:

                  -Round Number.

                  - Random number chosen.

                  - The random number raised to the round number.

                     -Utilize Math class to calculate using exponents.

                       Example: Round 2 random number 6 = 62 = 36

        - The modulus of the random number % round.

                     -Modulus returns the remainder, see page 81 in Chapter 3.

                     -Example: 8%3 = 2 (2 is the remainder or modulus)

         -The random number divided by the round number.

                      -Ensure you output the result as a float with 2 decimal places.

- Output “End Run…” after all lines have been output.

 

 

Mimic the output in the sample below exactly. Numbers will change due to random and selection but format will be the same.

 

-Sample output is provided below. Be sure to mimic the layout exactly. Output will vary based on input. 10%

 

 

 

 

 

 

Sample

Max Random Number and Number of Rounds will vary based on

input:

 

Below are different random examples based on the input

given. Your output will vary but the format will be the same.

 

Sample when 8 and 8 are entered.

sample:

 

Please enter the maximum random number to be used (2-8): 8

Please enter the number of rounds (1-8): 8

Round  Rand #  Rand^Round  Modulus  Rand/Round

    1                     7                         7                 0                   7.00

    2                    4                       16                 0                   2.00

    3                    1                          1                  1                   0.33

    4                    7                 2,401                 3                    1.75

    5                    1                           1                 1                    0.20

    6                    2                       64                2                    0.33

    7                    5                 78,125               5                    0.71

    8                   4                 65,536              4                    0.50

End Run…


Sample 2

Max random and number of rounds both entered with values above 8.

 

Please enter the maximum random number to be used (2-8): 12

Random number larger than 8 entered, using max number of 8.

 

 

Please enter the number of rounds (1-8): 9

Rounds larger than 8 entered, using max number of 8.

 

 

 

 

 

Round  Rand #  Rand^Round  Modulus  Rand/Round

           1             5                         5                 0                  5.00

          2             2                         4                 0                   1.00

          3             8                    512                  2                   2.67

          4             1                          1                  1                   0.25

          5             3                    243                 3                   0.60

          6             7              117,649                 1                     1.17

          7             7             823,543                0                    1.00

          8             2                     256                2                    0.25

End Run…

 

 

 

 

Topics covered in chapter
Topics with * are covered in this assignment. Ensure you use every item listed below
with
an * in your completed assignment.
*The API Library
*Match Class
*Wrapper Classes for Primitive Types Character Class
*String Methods
*Formatted Output with the printf Method
*Problem Solving with Random Numbers LiFiUnit5.java - Main Method
Get input for maximum random number into a String variable. Allow a
maximum of 8 (see example).
Use the Integer wrapper class to parse the integer out of the string and store
in an integer variable.
Get input for number of rounds into an integer. Allow a maximum of 8 (see
example).
Create a Header and Data format string to output results as shown in the
sample at the bottom.
Utilizing a for loop, output results meeting following criteria:
o One line should be output for each round.
o Each line should contain:
-Round Number.
- Random number chosen.
- The random number raised to the round number.
Utilize Math class to calculate using exponents.
Example: Round 2 random number 6 = 62 = 36
- The modulus of the random number % round.
Modulus returns the remainder, see page 81 in Chapter 3.
Example: 8%3 = 2 (2 is the remainder or modulus)
-The random number divided by the round number.
Ensure you output the result as a float with 2 decimal places.
Output “End Run…” after all lines have been output.
Mimic the output in the sample below exactly. Numbers will change due to random
and selection but format will be the same.
-Sample output is provided below. Be sure to mimic the layout exactly. Output will
vary based on input. 10% Sample
Max Random Number and Number of Rounds will vary based on
input:
Below are different random examples based on the input
given. Your output will vary but the format will be the same.
Sample when 8 and 8 are entered.
Please enter the maximum random number to be used (2-8): 8
Please enter the number of rounds (1-8): 8
Round Rand # Rand^Round Modulus Rand/Round
1 7 7 2 4 16 3 1 1 4 7 2,401 5 1 1 6 2 64 7 5 78,125 5 0.71 8 4 65,536 4 0.50 End Run… 0 7.00 0 2.00 1 0.33
3 1 1.75
0.20 2 0.33 Max random and number of rounds both entered with values above 8. Please enter the maximum random number to be used (2-8): 12
Random number larger than 8 entered, using max number of 8. Please enter the number of rounds (1-8): 9
Rounds larger than 8 entered, using max number of 8. Round Rand # Rand^Round Modulus Rand/Round
1 5 5 0 5.00 2 2 4 0 1.00 3 8 512 4 1 1 5 3 243 6 7 117,649 1 1.17 7 7 823,543 0 1.00 8 2 256 End Run… 2 2.67 1 0.25
3 2 0.60 0.25

Attachments:

Answers

(11)
Status NEW Posted 03 May 2017 02:05 AM My Price 9.00

-----------

Not Rated(0)