Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please answer below with Java Programming, and list out all the codes and procedures used Question 1 Write a program that asks the user to

Please answer below with Java Programming, and list out all the codes and procedures used

image text in transcribedimage text in transcribed

image text in transcribedimage text in transcribedimage text in transcribed

Question 1 Write a program that asks the user to input three integers. Check the parity of these integers. If the number of even integers is larger than that of the odd ones, the program then displays "EVEN". Otherwise, the program displays "ODD". Note: The inputs by the user are underlined. Enter three integers: 2504 Answer: EVEN Answer: ODD Enter three integers: 21810 Answer: EVEN Question 2 Write a program that prompts the user to input 5 integers. Output the sum of all integers that are divisible by 3 . If no such integer exists, then the program should print "Not found". Note: The inputs by the user are underlined. Enter five integers: 57111521 Answer: 6 Enter five integers: 122118521 Answer: 6 Enter five integers: 2713520 Answer: Not found Enter five integers: \begin{tabular}{llllll} -1 & 29 & -6 & 18 & 33 \\ \hline \end{tabular} Answer: 45 Question 3 Write a program that prompts the user to enter a String. Then, display the total number of question marks (?) and commas (,) in this String. If no question mark or comma exists, then output 0 . Question 4 Calculate the approximation value for function f(x)=(1+x)a using the following formula: (1+x)a1+1!ax+2!a(a1)x2+3!a(a1)(a2)x3++N!a(a1)(aN+1)xN The formula takes three inputs from the user for calculation: (1) an arbitrary value x(1,1); and (2) an arbitrary positive integer a; and (3) an arbitrary positive integer N that defines the approximation accuracy. Note: n!=123n Question 5 Write a program that prompt the user to enter two strings. Then, find the longest common substring of these two strings. Your program should output the length of the longest common substring. For example, the common substrings of "ABABC" and "BABCA" include: \{" A ", " AB ", Note: You are NOT allowed to use any built-in method for string matching (e.g., String.equals() and String.indexOf()). Methods like String.charAt() and String.length() are available. Note: The search is case sensitive. Note: The inputs by user are underlined. Enter the first string: Enter the second string: Answer: 4 Note: The longest common substring is " BABC " Enter the first string: 1Ab2345GffffD Enter the second string: 12345gf Answer: 4 Note: The longest common substring is " 2345 " Enter the first string: CS2360 Enter the second string: 23+60=83 Answer: 2 Note: The longest common substrings are " 23 " and " 60

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Visual Basic6 Database Programming

Authors: John W. Fronckowiak, David J. Helda

1st Edition

ISBN: 0764532545, 978-0764532542

Students also viewed these Databases questions

Question

=+(0

Answered: 1 week ago

Question

Conduct an effective performance feedback session. page 360

Answered: 1 week ago