Computer Networking: A Top-Down Approach (7th Edition)
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN: 9780133594140
Author: James Kurose, Keith Ross
Publisher: PEARSON
Bartleby Related Questions Icon

Related questions

Question
Write a Java program
Q1. Write a String method called "isEven" that takes n as parameter of integer type, and
returns “even" if n is even and returns "odd" otherwise. Test your method using suitable
(10%)
data in the main method.
Q2. Write a value-returning method "isVowel" that returns the value true if a given
character is a vowel, and otherwise returns false.
In the main method, take characters form the user until he enters "#" and print “vowel" or
"not vowel" according to the method output.
(25%)
Q3. Write a method “checkPrime" to check whether a number is a prime number or not,
the method takes an integer argument and returns a true if the argument was prime and
false otherwise.
In the main method, repeat checking for any number entered by the user, until he enters
0.
Hint: Use the modulo operator % to find the remainder from division.
(25%)
Example output:
Please type a number: 7
The number is prime.
Please type a number: 2
The number is not prime.
Please type a number: 0
expand button
Transcribed Image Text:Q1. Write a String method called "isEven" that takes n as parameter of integer type, and returns “even" if n is even and returns "odd" otherwise. Test your method using suitable (10%) data in the main method. Q2. Write a value-returning method "isVowel" that returns the value true if a given character is a vowel, and otherwise returns false. In the main method, take characters form the user until he enters "#" and print “vowel" or "not vowel" according to the method output. (25%) Q3. Write a method “checkPrime" to check whether a number is a prime number or not, the method takes an integer argument and returns a true if the argument was prime and false otherwise. In the main method, repeat checking for any number entered by the user, until he enters 0. Hint: Use the modulo operator % to find the remainder from division. (25%) Example output: Please type a number: 7 The number is prime. Please type a number: 2 The number is not prime. Please type a number: 0
Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Computer Networking: A Top-Down Approach (7th Edi...
Computer Engineering
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:PEARSON
Text book image
Computer Organization and Design MIPS Edition, Fi...
Computer Engineering
ISBN:9780124077263
Author:David A. Patterson, John L. Hennessy
Publisher:Elsevier Science
Text book image
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:9781337569330
Author:Jill West, Tamara Dean, Jean Andrews
Publisher:Cengage Learning
Text book image
Concepts of Database Management
Computer Engineering
ISBN:9781337093422
Author:Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:Cengage Learning
Text book image
Prelude to Programming
Computer Engineering
ISBN:9780133750423
Author:VENIT, Stewart
Publisher:Pearson Education
Text book image
Sc Business Data Communications and Networking, T...
Computer Engineering
ISBN:9781119368830
Author:FITZGERALD
Publisher:WILEY