Exercise1:(34 points) 1. Generate 30 random numbers from the following range: (1
ID: 3700790 • Letter: E
Question
Exercise1:(34 points) 1. Generate 30 random numbers from the following range: (10 points ) 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40 For each of the numbers do the following: 2. Print the "displayvalue" For most numbers the "display value" is the number itself. However, all multiples of 10 should be represented as roman numerals: 10 .. X 20 .. XX 30 .. XXX 40 .. XL All “display values" (numbers and roman numerals) should be printed in tabular form Each row should have 5 equally spaced columns that are left-aligned (see sample output) There should be no leading spaces at the beginning of a row and exactly one space between the roman numel XXX (30) and the next "display values" . 3. At the end print all done It should be printed in a separate line directly below the previous output. Below you can see the results I got from running my program Notice: because the numbers are random, your output is likely to look different from mine Sample Output XX22 34 16 X XXX 14 38 XL 34 38 X XX34 28 12 34 18 X 24 XXL 32 12 12 24 24 XXX 34 all doneExplanation / Answer
In java, the above solution can be achieved as:
Refer the comments for a better understanding
Output:
32 36 14 24 14
36 12 38 XXX 24
14 28 28 14 34
24 XX 14 26 38
14 14 X 24 12
12 16 22 XX XXX
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.