subject

•write a static method named containdigit that accepts two integer parameters a, and b.– assume that a is a positive integer (> 0) and b is single-digit numbers from 0-9 inclusive.– your method should return; • true if a contains b at among its digits, and• false otherwise.– for example containdigit (3415, 1) should return true.– note: you can not use a string to solve this problem.• write a class called lab13 with main method, in which– create two integer variables: • one is a random number in the range of [1000,],• the other one is a single digit reading from the console (using scanner); – call method containdigit with above two variables; – print out your name, the two numbers like: • my name is "…", and 2345 contains 7: false– note: to check all digits in the number, you should use while or do-while loop. write a method called showtwos that shows the factors of 2 in a given random integer in the range of [16,128] (by using of while loop). for example, consider the following calls: showtwos(7); showtwos(18); showtwos(68); showtwos(120); these calls should produce the following output: 7 = 718 = 2 * 968 = 2 * 2 * 17120 = 2 * 2 * 2 * 15question(friday): • write a static method named containdigit that accepts two integer parameters a, and b.• assume that a is a positive integer (> 0) and b is single-digit numbers from 0-9 inclusive.• your method should return; • true if a contains b at among its digits, and• false otherwise.• for example containdigit (421235, 1) should return true.• note: you can not use a string to solve this problem.• write a class called lab13 with main method, in which• create two integer variables: • one is a random number in the range of [1,],• the other one is a single digit reading from the console (using scanner); • call method containdigit with above two variables; • print out your name, the two numbers like: • my name is "…", and 234553 contains 6: false• note: to check all digits in the number, you should use while or do-while loop. write a method called gcd that accepts two random integers in the range of [32,256] as parameters and returns the greatest common divisor (gcd) of the two numbers (by using of while loop).the gcd of two integers a and b is the largest integer that is a factor of both a and b. one efficient way to compute the gcd of two numbers is to use euclid’s algorithm, which states the following: gcd (a, b) _ gcd (b, a % b)gcd (a, 0) _absolute value of a

ansver
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 13:00, ohnoitsabby5431
The documents a system at the end of the design phase, identifies any changes since the beginning of the project, and includes testing and verification of all system requirements and features. functional baseline operational baseline allocated baseline product baseline
Answers: 1
image
Computers and Technology, 21.06.2019 21:00, kitkatwolf
Analyze the following code. int x = 1; while (0 < x) & & (x < 100) system. out. println(x++); a. the loop runs forever. b. the code does not compile because the loop body is not in the braces. c. the code does not compile because (0 < x) & & (x < 100) is not enclosed in a pair of parentheses. d. the numbers 1 to 99 are displayed. e. the numbers 2 to 100 are displayed.
Answers: 3
image
Computers and Technology, 22.06.2019 11:30, genyjoannerubiera
What does a cascading style sheet resolve a conflict over rules for an element? a. the rule affecting the most content wins b. the rule affecting the most content loses c. the rule with the most specific selector loses d. the rule with the most specific selector wins
Answers: 2
image
Computers and Technology, 23.06.2019 07:00, bskyeb14579
Why is investing in a mutual fund less risky than investing in a particular company's stock? a. mutual funds only invest in blue-chip stocks. b. investments in mutual funds are more liquid. c. mutual funds hold a diversified portfolio of stocks. d. investments in mutual funds offer a higher rate of return.
Answers: 2
You know the right answer?
•write a static method named containdigit that accepts two integer parameters a, and b.– assume that...

Questions in other subjects: