For the problems below: ● ● Choose the most appropriate type of the loop for the problem. Loop as efficiently as possible. That is, if a result can be "known early," the loop should stop at that point in time. On a BINGO board, the numbers in the B column are between 1 and 15 inclusive, the numbers in the I column are between 16 and 30 inclusive, 31-45 inclusive for the N column, 46-60 inclusive for the G column, and 61-75 inclusive for the O column. Part A: BINGO Line Output a random line of a BINGO board with minimal repeated code. Use the Random Java utility to do this (do not use Math.random()). Note that writing more than one single nextInt () random call would be considered repeating code for this problem. You only need one such call in your code. You do not need to worry about the numbers lining up nicely (we'll learn how to handle this next week). Sample Run 1: BI NGO 1 16 36 49 69

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
Choose the most appropriate type of loop
For the problems below:
●
Choose the most appropriate type of the loop for the problem.
Loop as efficiently as possible. That is, if a result can be "known early," the loop should
stop at that point in time.
On a BINGO board, the numbers in the B column are between 1 and 15 inclusive, the numbers
in the I column are between 16 and 30 inclusive, 31-45 inclusive for the N column, 46-60
inclusive for the G column, and 61-75 inclusive for the O column.
Output a random line of a BINGO board with minimal repeated code. Use the Random Java
utility to do this (do not use Math.random()). Note that writing more than one single
next Int () random call would be considered repeating code for this problem. You only
need one such call in your code. You do not need to worry about the numbers lining up nicely
(we'll learn how to handle this next week).
Sample Run 1:
B
I N G O
1 16 36 49 69
Sample Run 2:
BIN G O
10 20 34 50 67
Sample Run 3:
B
I N G 0
6 28 32 52 75
Sample Run 4:
B I
N G O
Part A: BINGO Line
15 30 31 60
62
A
Transcribed Image Text:For the problems below: ● Choose the most appropriate type of the loop for the problem. Loop as efficiently as possible. That is, if a result can be "known early," the loop should stop at that point in time. On a BINGO board, the numbers in the B column are between 1 and 15 inclusive, the numbers in the I column are between 16 and 30 inclusive, 31-45 inclusive for the N column, 46-60 inclusive for the G column, and 61-75 inclusive for the O column. Output a random line of a BINGO board with minimal repeated code. Use the Random Java utility to do this (do not use Math.random()). Note that writing more than one single next Int () random call would be considered repeating code for this problem. You only need one such call in your code. You do not need to worry about the numbers lining up nicely (we'll learn how to handle this next week). Sample Run 1: B I N G O 1 16 36 49 69 Sample Run 2: BIN G O 10 20 34 50 67 Sample Run 3: B I N G 0 6 28 32 52 75 Sample Run 4: B I N G O Part A: BINGO Line 15 30 31 60 62 A
Part B: Letter Occurrences
Given a phrase of text and a given letter, determine how many times that letter appears in
the text.
Sample Run 1:
Text: supercalifragilisticexpialidocious
Letter: u
u occurs 2 time (s)
Sample Run 2:
Text: supercalifragilisticexpialidocious
Letter: z
z occurs 0 time (s)
Part C: Prime or Not?
A number is a factor of another number if it divides evenly into that number. For example, 2
is a factor of 100, as is 4, 5, 10, 20, 25, 50 and 100. The numbers 1 and the number itself are
always factors of a number. If 1 and the number are the only two factors of the number, then
the number is considered prime.
Allow the user to enter a number, and then print out whether the number is prime or not,
without any excess computation. That is, your program should stop as soon as possible with
only as much computation as is truly necessary to solve the problem.
So ask yourself: how long does your program have to run if the number is not prime? How
long does the program have to run if it is prime? Structure your program so that no additional
computations happen other than those that are absolutely necessary to determine the result
(prime or not).
Transcribed Image Text:Part B: Letter Occurrences Given a phrase of text and a given letter, determine how many times that letter appears in the text. Sample Run 1: Text: supercalifragilisticexpialidocious Letter: u u occurs 2 time (s) Sample Run 2: Text: supercalifragilisticexpialidocious Letter: z z occurs 0 time (s) Part C: Prime or Not? A number is a factor of another number if it divides evenly into that number. For example, 2 is a factor of 100, as is 4, 5, 10, 20, 25, 50 and 100. The numbers 1 and the number itself are always factors of a number. If 1 and the number are the only two factors of the number, then the number is considered prime. Allow the user to enter a number, and then print out whether the number is prime or not, without any excess computation. That is, your program should stop as soon as possible with only as much computation as is truly necessary to solve the problem. So ask yourself: how long does your program have to run if the number is not prime? How long does the program have to run if it is prime? Structure your program so that no additional computations happen other than those that are absolutely necessary to determine the result (prime or not).
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 5 images

Blurred answer
Knowledge Booster
Matrix multiplication
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education