Skip to main content
Create an array that can hold ten integers. Fill up each slot of the array with the number -113. Then display the contents of the array on the screen.Do not use a loop. Also, do not use any variable for the index; you must use literal numbers to refer to each slot.Sample Output
Slot 0 contains a -113
Slot 1 contains a -113
Slot 2 contains a -113
Slot 3 contains a -113
Slot 4 contains a -113
Slot 5 contains a -113
Slot 6 contains a -113
Slot 7 contains a -113
Slot 8 contains a -113
Slot 9 contains a -113
Create an array that can hold ten integers. Fill up each slot of the array with the number -113. Then display the contents of the array on the screen.This time, you must use a loop, to put the values in the array and also to display them. Also, in the condition of your loop, you should not count up to a literal number. Instead you should use the length field of your array.Sample Output
Slot 0 contains a -113
Slot 1 contains a -113
Slot 2 contains a -113
Slot 3 contains a -113
Slot 4 contains a -113
Slot 5 contains a -113
Slot 6 contains a -113
Slot 7 contains a -113
Slot 8 contains a -113
Slot 9 contains a -113
Create an array that can hold ten integers. Fill up each slot of the array with a random number from 1 to 100. Then display the contents of the array on the screen. You must use a loop.And, like last time, you must use the length field of your array and not a literal number (like 10) in the condition of the loop.Sample Output
Slot 0 contains a 45
Slot 1 contains a 87
Slot 2 contains a 39
Slot 3 contains a 32
Slot 4 contains a 93
Slot 5 contains a 86
Slot 6 contains a 12
Slot 7 contains a 44
Slot 8 contains a 75
Slot 9 contains a 50
Create an array that can hold 1000 integers. Fill the array with random numbers in the range 10-99. Then display the contents of the array on the screen. You must use a loop.If you’re careful to only pick random numbers from 10 to 99 and you put two spaces after each number, then your output will line up like mine.And if you’ve forgotten how to pick random numbers in a certain range, you can check out my random ranges visualizer.Sample Output
81  69  34  39  35  19  68  14  93  91  96  90  67  82  15  75  13  34  39  88
89  70  53  31  52  79  89  97  36  56  33  61  67  98  57  85  90  55  82  94
50  91  96  73  60  58  56  46  64  71  79  54  40  79  24  68  21  37  55  33
59  46  95  12  98  12  92  78  94  14  17  16  15  99  36  40  20  69  29  42
88  50  31  60  65  57  79  53  30  84  28  97  66  23  88  97  18  86  44  79
90  63  59  97  11  28  57  88  71  89  42  84  28  55  42  13  16  48  58  68
49  92  53  25  26  25  31  53  91  50  73  80  21  86  87  60  63  59  44  39
59  25  46  11  14  21  52  97  35  27  56  49  75  13  30  57  20  74  56  39
35  46  20  62  21  59  87  43  81  24  75  42  79  26  40  19  92  50  57  32
26  71  10  65  62  98  44  69  60  66  51  72  87  24  82  36  81  69  22  88
68  73  28  49  74  15  19  44  11  11  73  55  23  73  30  94  85  92  11  53
12  69  70  17  51  40  57  28  94  93  93  90  64  45  50  90  65  66  15  42
97  69  48  96  15  11  29  19  90  73  76  33  19  14  37  20  15  69  47  58
24  81  84  34  84  26  20  49  98  16  71  47  75  18  28  26  25  21  39  42
17  58  40  10  29  17  55  35  18  59  20  88  49  42  74  65  75  52  41  93
96  19  82  34  29  71  30  86  91  15  36  85  28  24  43  38  17  76  95  30
31  48  15  96  47  56  67  70  87  16  42  96  21  20  75  70  68  11  21  50
55  51  93  56  20  21  89  49  13  33  18  62  72  95  94  62  88  91  26  46
81  28  70  87  43  30  54  82  54  39  68  54  22  99  61  29  77  19  74  87
32  44  65  32  73  88  58  23  32  23  62  27  45  84  44  33  60  23  62  64
59  90  20  49  33  11  48  90  39  49  64  54  21  52  66  61  18  65  97  59
22  53  18  80  12  67  88  57  73  65  14  82  41  73  22  42  58  69  94  87
11  35  64  81  34  30  41  16  99  42  74  96  92  47  62  49  31  34  24  99
22  76  96  15  25  77  49  71  98  60  17  67  86  52  25  17  25  67  17  26
53  42  40  46  10  36  33  67  15  79  48  69  57  91  29  36  50  71  39  10
22  55  76  93  80  48  74  85  26  64  93  83  33  30  65  34  96  12  44  43
36  13  64  59  23  70  87  73  87  12  96  65  83  79  23  92  56  86  39  57
94  46  62  75  60  12  14  15  82  91  43  85  64  73  79  14  38  46  63  82
17  49  56  22  64  10  84  67  66  85  78  22  72  53  33  18  43  90  94  61
92  52  42  95  32  61  92  24  22  23  57  96  27  45  41  97  24  52  74  23
28  52  94  64  24  47  62  48  46  72  27  50  15  37  10  75  66  53  42  81
69  12  76  84  43  79  89  75  76  89  93  13  32  85  67  24  97  65  14  62
10  47  25  62  73  40  71  66  11  81  22  33  22  90  55  39  26  63  14  45
51  71  68  26  63  71  19  95  95  93  18  17  20  56  28  74  23  85  44  83
54  99  77  57  97  14  13  54  44  35  27  55  29  58  41  35  26  23  64  53
11  55  92  10  42  57  73  59  21  92  24  53  65  60  16  26  53  69  49  61
66  87  34  15  19  85  33  96  16  11  57  11  19  38  86  55  21  12  19  21
75  69  92  45  90  96  67  33  88  99  68  76  22  60  60  11  42  62  44  23
65  74  15  92  47  35  83  79  71  86  44  86  68  97  60  66  14  75  45  56
12  98  11  10  16  38  54  83  51  83  49  62  63  24  68  13  31  13  41  34
59  35  12  88  12  21  55  93  27  92  27  14  39  58  31  39  25  94  83  88
70  69  22  71  41  43  34  45  27  26  77  11  39  32  96  78  67  58  54  84
19  26  96  14  29  92  11  28  68  91  93  74  53  13  84  99  70  11  91  70
75  55  87  16  57  17  58  13  75  79  65  51  75  33  87  54  22  63  48  45
71  79  12  40  52  71  62  38  77  36  88  53  94  88  58  20  28  11  48  59
74  33  52  78  76  38  42  20  80  99  53  64  81  79  16  30  18  46  79  70
43  83  14  71  99  64  84  94  20  54  74  40  37  22  96  34  83  85  11  99
64  21  37  80  68  34  17  87  88  53  29  27  42  44  59  37  52  85  64  34
93  23  35  13  46  14  59  87  42  78  52  89  14  52  37  30  74  22  70  79
18  80  32  34  84  98  68  27  89  30  44  86  57  49  51  65  71  30  37  63
Write a program that creates an array of ten integers. It should put ten random numbers from 1 to 100 in the array. It should copy all the elements of that array into another array of the same size. Then display the contents of both arrays. To get the output to look like mine, you’ll need a several for loops.Create an array of ten integers
  • Fill the array with ten random numbers (1-100)
  • Copy the array into another array of the same capacity
  • Change the last value in the first array to a -7
  • Display the contents of both arrays
Sample Output
Array 1: 45 87 39 32 93 86 12 44 75 -7
Array 2: 45 87 39 32 93 86 12 44 75 50
Prompt the user for a first and last name, and the name for a file. Randomly choose five grades for that person from 1 to 100 and store them in an array that can hold five integers. Then output the first and last name and those five grades to the specified file.Sample Output
Name (first last): Marc Antony
Filename: ettu.txt

Here are your randomly-selected grades (hope you pass):
Grade 1: 54
Grade 2: 90
Grade 3: 18
Grade 4: 37
Grade 5: 62

Data saved in "ettu.txt".
Later, if you look in “ettu.txt” (or whatever you called your file), you should see values like this:
ettu.txt
Marc Antony
54 90 18 37 62
Create an array that can hold ten integers, and fill each slot with a different random value from 1-50. Display those values on the screen, and then prompt the user for an integer. Search through the array, and if the item is present, say so. It is not necessary to display anything if the value was not found. If the item is in the array multiple times, it’s okay if the program prints the message more than once.Sample Output
Array: 45 39 32 12 44 50 26 42 16 20
Value to find: 42

42 is in the array.
Array: 45 39 32 12 44 50 26 42 16 20
Value to find: 43
Array: 24 30 31 24 32 33 34 24 35 36
Value to find: 24

24 is in the array.
24 is in the array.
24 is in the array.
Create an array that can hold ten integers, and fill each slot with a different random value from 1-50. Display those values on the screen, and then prompt the user for an integer. Search through the array, and count the number of times the item is found.Sample Output
Array: 45 39 32 12 44 50 26 42 16 20
Value to find: 42

42 was found 1 times.

Array: 45 39 32 12 44 50 26 42 16 20
Value to find: 43

43 was found 0 times.

Array: 24 30 31 24 32 33 34 24 35 36
Value to find: 24

24 was found 3 times.
Create an array that can hold ten integers, and fill each slot with a different random value from 1-50. Display those values on the screen, and then prompt the user for an integer. Search through the array, and if the item is present, say so. If the value is not in the array, display a single message saying so. Just like the previous assignment, if the value is present more than once, you may display the message as many times as necessary.Sample Output
Array: 45 39 32 12 44 50 26 42 16 20
Value to find: 42

42 is in the array.

Array: 45 39 32 12 44 50 26 42 16 20
Value to find: 43

43 is not in the array.
Create an array that can hold ten integers, and fill each slot with a different random value from 1-50. Display those values on the screen, and then prompt the user for an integer. Search through the array, and if the item is present, give the slot number where it is located. If the value is not in the array, display a single message saying so. If the value is present more than once, you may either display the message as many times as necessary, or display a single message giving the last slot number in which it appeared.Sample Output
Array: 45 39 32 12 44 50 42 26 16 20
Value to find: 42

42 is in slot 6.
Array: 45 39 32 12 44 50 26 42 16 20
Value to find: 43

43 is not in the array.
Array: 24 30 31 24 32 33 34 24 35 36
Value to find: 24

    you may display either

24 is in slot 0.
24 is in slot 3.
24 is in slot 7.

    or

24 is in slot 7.
Write a program that creates an array which can hold ten values. Fill the array with random numbers from 1 to 100. Display the values in the array on the screen. Then use a linear search to find the largest value in the array, and display that value.Sample Output
Array: 45 87 39 32 93 86 12 44 75 50

The largest value is 93
Write a program that creates an array which can hold ten values. Fill the array with random numbers from 1 to 100. Display the values in the array on the screen. Then use a linear search to find the largest value in the array, and display that value and its slot number.Sample Output
Array: 45 87 39 32 93 86 12 44 75 50

The largest value is 93
It is in slot 4
Write a program that creates an array which can hold ten values. Fill the array with random numbers from 1 to 100. Display the values in the array on the screen. Then use a linear search to find the largest value in the array, and display that value and its slot number.Files NeededSample Output
The first array is filled with the following values:
    alpha bravo charlie
After you add in the code you’re supposed to, you should see something more like this:
The first array is filled with the following values:
    alpha bravo charlie delta echo
The second array is filled with the following values:
    11 23 37 41 53
Create three arrays to store data about five people. The first array should be Strings and should hold their last names. The next array should be doubles and should hold a grade average (on a 100-point scale). The last array should be ints, should hold their student id numbers.Give each of the arrays values (using array initializers). Then print the values of all three arrays on the screen.Finally, ask the user for an ID number to lookup. Search through the ID array until you find that ID, and then print out the values from the same slot number of the other two arrays.Sample Output
Values:
    Mitchell 99.5 123456
    Ortiz 78.5 813225
    Luu 95.6 823669
    Zimmerman 96.8 307760
    Brooks 82.7 827131

ID number to find: 307760

Found in slot 3
    Name: Zimmerman
    Average: 96.8
    ID: 307760
Code an interactive, two-player game of Tic-Tac-Toe. You’ll use a two-dimensional array of chars.Starter CodeSample Output
(...a game already in progress)

    X   O
    O X X
    X O

'O', choose your location (row, column): 0 1

    X O O
    O X X
    X O

'X', choose your location (row, column): 2 0

    X O O
    O X X
    X X O

The game is a tie.
Write a program to play a word-guessing game like Hangman.
  • It must randomly choose a word from a list of words.
  • It must stop when all the letters are guessed.
  • It must give them limited tries and stop after they run out.
  • It must display letters they have already guessed (either only the incorrect guesses or all guesses).
Sample Output
-=-=-=-=-=-=-=-=-=-=-=-=-=-

Word:	_ _ _ _ _ _ _ _ _

Misses:

Guess:	e

-=-=-=-=-=-=-=-=-=-=-=-=-=-

Word:	_ e _ _ _ _ _ _ _

Misses:

Guess:	i

-=-=-=-=-=-=-=-=-=-=-=-=-=-

Word:	_ e _ i _ _ _ _ _

Misses:

Guess:	a

-=-=-=-=-=-=-=-=-=-=-=-=-=-

Word:	_ e _ i a _ _ a _

Misses:

Guess:	r

-=-=-=-=-=-=-=-=-=-=-=-=-=-

Word:	_ e _ i a _ _ a _

Misses:	r

Guess:	s

-=-=-=-=-=-=-=-=-=-=-=-=-=-

Word:	_ e _ i a _ _ a _

Misses:	rs

Guess:	t

-=-=-=-=-=-=-=-=-=-=-=-=-=-

Word:	_ e _ i a t _ a _

Misses:	rs

Guess:	n

-=-=-=-=-=-=-=-=-=-=-=-=-=-

Word:	_ e _ i a t _ a n

Misses:	rs

Guess:	o

-=-=-=-=-=-=-=-=-=-=-=-=-=-

Word:	_ e _ i a t _ a n

Misses:	rso

Guess:	l

-=-=-=-=-=-=-=-=-=-=-=-=-=-

Word:	l e _ i a t _ a n

Misses:	rso

Guess:	v

-=-=-=-=-=-=-=-=-=-=-=-=-=-

Word:	l e v i a t _ a n

Misses:	rso

Guess:	h

-=-=-=-=-=-=-=-=-=-=-=-=-=-

Word:	l e v i a t h a n

Misses:	rso

YOU GOT IT!

Play "again" or "quit"? quit