subject

Develop a Java program that deals with greatest common dominators GCDs of positive integers. GCD of two positive integers is the is the largest positive integer that divides each of those two integers. The program works with the following specifications: a. Write a java method getGCD takes as parameter two integers and returns their greatest common divisor. The GCD could be computed for any two positive numbers. If the one of the two integers (or both) is negative the method should return -1. a. In the main method, β€’ the program reads from the user the number of pairs of integers to get GCD of each pair. β€’ According to the number of pairs, the program prompts the user to enter pairs of integers and saves these numbers in 2 single-dimensional arrays; the first array firstNumbersArray is for the first numbers in the entered pairs, and the second array secondNumbersArray is for the second numbers in the entered pairs. β€’ The program should get the GCD of each pair by calling the method getGCD repeatedly and save the produced GCDs in a third single-dimensional array called GCDsArray. β€’ The program should count the number of positive pairs that it could compute their GCD. β€’ Finally, the program should print all the entered pairs with their GCD and the ratio of the pairs with positive GCDs compared to all entered pairs.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 17:30
The forerunner to cell phones, pdas, and smartphones was
Answers: 1
question
Computers and Technology, 23.06.2019 00:00
What engine component is shown in the above figure?
Answers: 1
question
Computers and Technology, 23.06.2019 06:30
Who can provide you with a new password when you have forgotten your old one? your provide you with a new password in case you forget your old one.
Answers: 3
question
Computers and Technology, 24.06.2019 01:30
How would you cite different books by the same author on the works cited page? moore, jack h. folk songs and ballads. salem: poetry press, 1999. print. moore, jack h. ballads in poetry – a critical review. dallas: garden books, 1962. print. moore, jack h. folk songs and ballads. salem: poetry press, 1999. print. –––. ballads in poetry – a critical review. dallas: garden books, 1962. print. moore, jack h. ballads in poetry – a critical review. dallas: garden books, 1962. print. moore, jack h. folk songs and ballads. salem: poetry press, 1999. print. moore, jack h. ballads in poetry – a critical review. dallas: garden books, 1962. print. –––. folk songs and ballads. salem: poetry press, 1999. print.
Answers: 2
You know the right answer?
Develop a Java program that deals with greatest common dominators GCDs of positive integers. GCD of...
Questions
question
Mathematics, 04.08.2020 17:01
question
Mathematics, 04.08.2020 17:01
question
Business, 04.08.2020 17:01
Questions on the website: 13722361