Write an if/else statement that adds 1 to the variable minors if the variable age is less than 18, adds 1 to the variable adults if age is 18 thorugh 64, and adds 1 to the variable seniors if age is 65 or older.

Visual Basic

LANGUAGE: Visual Basic CHALLENGE:  Write an if/else statement that adds 1 to the variable minors if the variable age is less than 18, adds 1 to the variable adults if age is 18 thorugh 64, and adds 1 to the variable seniors if age is 65 or older.

Read More

Online Book Merchants offers premium customers 1 free book with every purchase of 5 or more books and offers 2 free books with every purchase of 8 or more books.  It offers regular customers 1 free book with every purchase of 7 or more books, and offers 2 free books with every purchase of 12 or more books.  Write a statement that assigns free Books the appropriate value based on the values of the bool variable is Premium Customer and the int variable n books Purchased

Visual Basic

LANGUAGE: Visual Basic CHALLENGE: Online Book Merchants offers premium customers 1 free book with every purchase of 5 or more books and offers 2 free books with every purchase of 8 or more books.  It offers regular customers 1 free book with every purchase of 7 or more books, and offers 2 free books with every…

Read More

Given an int variable named yes Count and another int variable named no Count and a char variable named response, write the necessary code to read a value from the text box text Box into response and then carry out the following:  if the character typed in is a y or a Y then increment yes Count and print out “YES WAS RECORDED”.  if the character typed in is an n or an N then increment no Count and print out “NO WAS RECORDED”.  If the input is invalid just print the message “INVALID” and do nothing else.

Visual Basic

LANGUAGE: Visual Basic CHALLENGE: Given an int variable named yes Count and another int variable named no Count and a char variable named response, write the necessary code to read a value from the text box text Box into response and then carry out the following:  if the character typed in is a y or a Y…

Read More

Write a Select Case statement that tests the value of the integer variable semester Average and assigns a grade to the string variable grade based upon the usual criteria (i.e., greater than or equal to 90 is an A, between 80 and 89 inclusively is a B, etc).  If the average falls outside the range of 0 and 100, grade should be assigned the empty string and the message “Invalid semester average” should be displayed in a message box.

Visual Basic

LANGUAGE: Visual Basic CHALLENGE: Write a Select Case statement that tests the value of the integer variable semester Average and assigns a grade to the string variable grade based upon the usual criteria (i.e., greater than or equal to 90 is an A, between 80 and 89 inclusively is a B, etc).  If the average falls outside…

Read More

Write an if/else statement that adds 1 to the variable minors if the variable age is less than 18, adds 1 to the variable adults if age is 18 through 64 and adds 1 to the variable seniors if age is 65 or older.

Visual Basic

LANGUAGE: Visual Basic CHALLENGE: Write an if/else statement that adds 1 to the variable minors if the variable age is less than 18, adds 1 to the variable adults if age is 18 through 64 and adds 1 to the variable seniors if age is 65 or older.

Read More

Write a Select Case statement that tests the value of the Char variable response and performs the following actions:  if response is y, the message “Your request is being processed” is printed.  if response is n, the message “Thank you anyway for your consideration” is printed.  if response is h, the message “Sorry, no help is currently available is printed.  for any other value of response, the message “Invalid entry; please try again” is printed.

Visual Basic

LANGUAGE: Visual Basic CHALLENGE:  Write a Select Case statement that tests the value of the Char variable response and performs the following actions:  if response is y, the message “Your request is being processed” is printed.  if response is n, the message “Thank you anyway for your consideration” is printed.  if response is h, the message “Sorry,…

Read More

Write an if/else statement that compares the double variable pH with 7.0 and makes the following assignments to the bool variables neutral, base, and acid: false, false, true if pH is less than 7. false, true, false if pH is greater than 7. true, false, false if pH is equal to 7

Visual Basic

LANGUAGE: Visual Basic CHALLENGE: Write an if/else statement that compares the double variable pH with 7.0 and makes the following assignments to the bool variables neutral, base, and acid:  false, false, true if pH is less than 7.  false, true, false if pH is greater than 7. true, false, false if pH is equal to 7

Read More

Given int variables k and total that have already been declared, use a while loop to compute the sum of the squares of the first 50 counting 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 while loop to compute the sum of the squares of the first 50 counting 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 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