Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CHANGE THE BELOW CODES FROM C SHARP TO JAVA, REMEMBER TO CREATE THE CLASS FOR DATATABLE IF NECESSARY. class Program { static void Main(string[] args)

CHANGE THE BELOW CODES FROM C SHARP TO JAVA, REMEMBER TO CREATE THE CLASS FOR DATATABLE IF NECESSARY.

class Program

{

static void Main(string[] args)

{

int s1 = 1;

int s2 = 0;

int t1 = 0;

int t2 = 1;

int q;

int t;

int s;

int r;

Console.WriteLine("Please enter mumber to be divided");

int r1 = int.Parse(Console.ReadLine());

Console.WriteLine("Please enter the dividend");

int r2 = int.Parse(Console.ReadLine());

//Console.WriteLine("Quotient: {0}, R1: {1}, R2: {2}, R: {3}, S1: {4}, S2: {5}, S6: {6}, T1: {7}, T2: {8}, T: {9}", q, r1, r2, r, s1, s2, s, t1, t2, t);

DataTable dt = new DataTable();

dt.Columns.Add("q");

dt.Columns.Add("r1");

dt.Columns.Add("r2");

dt.Columns.Add("r");

dt.Columns.Add("s1");

dt.Columns.Add("s2");

dt.Columns.Add("s");

dt.Columns.Add("t1");

dt.Columns.Add("t2");

dt.Columns.Add("t");

while (r2 > 0)

{

q = r1 / r2;

r = r1 - q * r2;

s = s1 - q * s2;

t = t1 - q * t2;

dt.Rows.Add(q, r1, r2, r, s1, s2, s, t1, t2, t);

Console.WriteLine("Quotient: {0}, R1: {1}, R2: {2}, R: {3}, S1: {4}, S2: {5}, S: {6}, T1: {7}, T2: {8}, T: {9}",q,r1,r2,r,s1,s2,s,t1,t2,t);

r1 = r2; r2 = r;

s1 = s2; s2 = s;

t1 = t2; t2 = t;

}

}

}

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

More Books

Students also viewed these Databases questions