Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

7- Write a JAVA method to realize the following algorithm : INPUT : Two integer values $x, y>=1$ BODY of algorithm : Define two columns

image text in transcribed

7- Write a JAVA method to realize the following algorithm : INPUT : Two integer values $x, y>=1$ BODY of algorithm : Define two columns for the two inputs $\mathrm{X}$ and $\mathrm{Y}$ and then follow the following instructions : REPEAT Doubling the value in the $\mathrm{X}$ column ; Halving the value in the $\mathrm{Y}$ column (ignoring fractions ); UNTIL the value in the Y column is 1 ; OUTPUT : The sum of the values in the $\mathrm{X}$ column which correspond to odd values in the $\mathrm{Y}$ column ; EXAMPLE : INPUT : $\mathrm{X}=68 ; \mathrm{Y}=97$; \begin{tabular}{|CC|} \hline $\mathbf{X}$ & $\mathbf {Y}$ \ \hline 68 & 97 \hline 136 & 48 \ \hline 272 & 24 V \hline 544 & 12 V \hline 1088 & 6 \hline 2176 & 3 \hline 4352 & 1 \hline \end{tabular) OUTPUT : $$ 68+2176+4352=6596 $$ CS.VS.914

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

Practical Database Programming With Visual Basic.NET

Authors: Ying Bai

1st Edition

0521712351, 978-0521712354

More Books

Students also viewed these Databases questions

Question

What do you understand by Mendeleev's periodic table

Answered: 1 week ago

Question

=+What is the most that you should pay to complete development?

Answered: 1 week ago