Design a class called Date that has integer data members to store month, day, and year. The class should have a three-parameter (day-of-month, month, year) default constructor that allows the date to be set at the time a new Date object is created.

C++

LANGUAGE: C++ CHALLENGE: Design a class called Date that has integer data members to store month, day, and year. The class should have a three-parameter (day-of-month, month, year) default constructor that allows the date to be set at the time a new Date object is created. If the user creates a Date object without passing any…

Read More

Write a full class definition for a class named Averager, and containing the following members: An data member named sum of type integer. An data member named count of type integer.

C++

LANGUAGE: C++ CHALLENGE: Write a full class definition for a class named Averager, and containing the following members: An data member named sum of type integer. An data member named count of type integer. A constructor with no parameters. The constructor initializes the data members sum and the data member count to 0. A function named…

Read More

Clunker Motors Inc. is recalling all vehicles from model years 2001-2006. A boolean variable named recalled has been declared. Given a variable modelYear write a statement that assigns true to recalled if the value of modelYear falls within the recall range and assigns false otherwise.

java

LANGUAGE: Java CHALLENGE: Clunker Motors Inc. is recalling all vehicles from model years 2001-2006. A boolean variable named recalled has been declared. Given a variable modelYear write a statement that assigns true to recalled if the value of modelYear falls within the recall range and assigns false otherwise. Do not use an if statement in this…

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 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