Given an int variable n that has been initialized to a positive value and,in addition, int variables k and total that have already been declared,use a while loop to compute the sum of the cubes of the first n counting numbers, and store this value in total. Thus if n equals 4, your code should put 1*1*1 + 2*2*2 + 3*3*3 + 4*4*4 into total. Use no variables other than n, k , and total. Do NOT modify n.

Visual Basic

LANGUAGE: Visual Basic CHALLENGE: Given an int variable n that has been initialized to a positive value and,in addition, int variables k and total that have already been declared,use a while loop to compute the sum of the cubes of the first n counting numbers, and store this value in total. Thus if n equals 4,…

Read More

Given an Integer variable n that has been initialized to a positive value and, in addition, Integer variables k and total that have already been declared, use a While loop to compute the sum of the cubes of the first n whole numbers, and store this value in total. Use no variables other than n,k, and total.

Visual Basic

LANGUAGE: Visual Basic CHALLENGE: Given an Integer variable n that has been initialized to a positive value and, in addition, Integer variables k and total that have already been declared, use a While loop to compute the sum of the cubes of the first n whole numbers,and store this value in total. Use no variables other…

Read More

Given Integer variables k and total that have already been declared, use a While loop to compute the sum of the squares of the first 50 whole numbers, and store this value in total. Thus your code should put 1*1 + 2*2 + 3*3 + … + 49*49 + 50*50 into total. Use no variables other than k and total.

Visual Basic

LANGUAGE: Visual Basic CHALLENGE: Given Integer variables k and total that have already been declared,use a While loop to compute the sum of the squares of the first 50 whole numbers,and store this value in total. Thus your code should put 1*1 + 2*2 + 3*3 + … + 49*49 + 50*50 into total. Use no…

Read More

Given three variables, k, m, n, of type int that have already been declared and initialized, write some code that prints each of them in a 9 position field on the same line. For example, if their values were 27, 987654321, -4321, the output would be: |xxxxxxx27987654321xxxx-4321

C++

LANGUAGE: C++ CHALLENGE: Given three variables, k, m, n, of type int that have already been declared and initialized, write some code that prints each of them in a 9 position field on the same line. For example, if their values were 27, 987654321, -4321, the output would be: |xxxxxxx27987654321xxxx-4321 NOTE: The vertical bar, |, on…

Read More

The class Date has a single constructor that accepts the integer value: a month- (1 for January through 12 for December), a day of the month (1-31), and a year (in that order).

C++

LANGUAGE: C++ CHALLENGE: The class Date has a single constructor that accepts the integer value: a month- (1 for January through 12 for December), a day of the month (1-31), and a year (in that order). Given the Date variable datep, dynamically allocate a Date object with the initial value of March 12, 2006, and assign…

Read More

Given int variables k and total that have already been declared, use a Do…Loop While loop to compute the sum of the squares of the first 50 whole numbers, and store this value in total. Thus your code should put 1*1 + 2*2 + 3*3 + … + 49*49 + 50*50 into total. Use no variables other than k and total.

Visual Basic

LANGUAGE: Visual Basic CHALLENGE: Given int variables k and total that have already been declared, use a Do…Loop While loop to compute the sum of the squares of the first 50 whole numbers,and store this value in total. Thus your code should put 1*1 + 2*2 + 3*3 + … + 49*49 + 50*50 into total.…

Read More

Give that two Integer variables, total and amount have been declared, write a loop that reads non-negative values into amount and adds them into total. The loop termiantes when a value less tha 0 is read into amount. Don’t forget to initialize total to 0. To read a value into amount use a method, getNum() that we provide for you a class named tC: amount = TC.getNum();

Visual Basic

LANGUAGE: Visual Basic CHALLENGE: Give that two Integer variables,total and amount have been declared, write a loop that reads non-negative values into amount and adds them into total. The loop termiantes when a value less tha 0 is read into amount. Don’t forget to initialize total to 0. To read a value into amount use a…

Read More