Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

Question

Code language Java

1, Add a print statement to say “Multiplication Table” and then prompt the
user to enter an integer. Your program should then prints “times table” for the
numbers from 1 to the given integer (inclusive). That is, for input n, you would print
a table of n rows (lines) each with n columns, where the cell at row i and column
j contains the value i × j. You do need separate rows, but don’t worry about the
columns lining up nicely yet.


2. Add a print statement to say “Prime Testing”.
Using the integer entered by the user above, print out all the prime numbers between
2 and the number squared. E.g., if the user types 12 for the multiplication table part,
you should print all the prime numbers that are not larger than 144.
All integers are either prime or composite. A prime number is one that has no integer
factors other than itself or one. Examples are 2, 3, 5, 7, 11, 13, . . .. A composite
number, by contrast, has multiple factors. Examples are 4, 6, 12, 15, 18, 21, . . ..
Testing whether or not a number is prime is an important application of computing
power. One very simple method is to simply check every possible factor from 2 up to
the number in question.
For example, to test whether or not the value 35 is prime, you can test if 35 % 2 ==
0, then if 35 % 3 == 0, then is 35 % 4 == 0, and so on, up until you find a number
that evenly divides 35 or confirm that no such number exists. You must write this
yourself, and cannot use any library methods for primality testing. 

3, Add another print statement that says “Infinite Series Test”.
Consider the infinite series



This time you should prompt the user to enter a second integer k, and then calculates
and prints the sum of the first k terms of the sequence. Do not use Math.pow. Instead,
compute the value of 2k
incrementally in your loop. Try your program for different
values of k. Do you notice a trend? 

Expert Solution
Check Mark
Step 1

Lets see the solution in the next steps 

Knowledge Booster
Background pattern image
Computer Science
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
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education