C++
Declare a structure whose tag name is Server and that contains the following fields: manufacturer, a string, model and serialnum, both also strings, year, an int, clockSpeed, a double, cores, an int, ram, an int and finally storage an int.
LANGUAGE: C++ CHALLENGE: Declare a structure whose tag name is Server and that contains the following fields: manufacturer, a string, model and serialnum, both also strings, year, an int, clockSpeed, a double, cores, an int, ram, an int and finally storage an int.
Read MoreGiven the declaration of a structure whose tag is DATE write the declaration of the following variables enrolled_on, paid_on, and completed_on, each of which is of type DATE.
LANGUAGE: C++ CHALLENGE: Given the declaration of a structure whose tag is DATE write the declaration of the following variables enrolled_on, paid_on, and completed_on, each of which is of type DATE.
Read MoreWrite a function max that has two C string parameters and returns the larger of the two.
LANGUAGE: C++ CHALLENGE: Write a function max that has two C string parameters and returns the larger of the two.
Read MoreAssume that x is a variable that has been declared as an int and been given a value.
LANGUAGE: C++ CHALLENGE: Assume that x is a variable that has been declared as an int and been given a value. Assume that twice is a function that receives a single integer parameter and returns twice its value. (So if you pass 7 to twice it will return 14. Thus the expression twice(7) has the…
Read MoreAssume the availability of a function named oneMore. This function receives an integer and returns one more than its parameter. So, pass oneMore(12 ) and it will return 13.
LANGUAGE: C++ CHALLENGE: Assume the availability of a function named oneMore. This function receives an integer and returns one more than its parameter. So, pass oneMore(12 ) and it will return 13. DO NOT DEFINE this function– just assume it is available. YOUR TASK: write an expression whose value is 5 but in your expression you can…
Read MoreWrite a for loop that prints the integers 1 through 40, separated by spaces or new lines. You may use only one variable, count which has already been declared as an integer.
LANGUAGE: C++ CHALLENGE: Write a for loop that prints the integers 1 through 40, separated by spaces or new lines. You may use only one variable, count which has already been declared as an integer.
Read MoreAssume that two parallel arrays have been declared and initialized: healthOption an array of type char that contains letter codes for different healthcare options and annualCost an array of type int.
LANGUAGE: C++ CHALLENGE: Assume that two parallel arrays have been declared and initialized: healthOption an array of type char that contains letter codes for different healthcare options and annualCost an array of type int. The i-th element of annualCost indicates the annual cost of the i-th element of healthOption. In addition, there is an char…
Read MoreWrite the definition of a function named fscopy that does a line-by-line copy from one stream to another.
LANGUAGE: C++ CHALLENGE: Write the definition of a function named fscopy that does a line-by-line copy from one stream to another. This function can be safely passed two fstream objects, one opened for reading, the other for writing. In addition, it gets a bool argument that is true if the output lines are to be…
Read MoreProject 18: Broken Keypad. The keypad on your oven is used to enter the desired baking temperature and is arranged like the digits on a phone
LANGUAGE: Java CHALLENGE: Project 18: Broken Keypad. The keypad on your oven is used to enter the desired baking temperature and is arranged like the digits on a phone: 123 456 789 0 Unfortunately the circuitry is damaged and the digits in the leftmost column no longer function. In other words, the digits 1, 4,…
Read MoreConsider this data sequence: “3 11 5 5 5 2 4 6 6 7 3 -8”. Any value that is the same as the immediately preceding value is considered a CONSECUTIVE DUPLICATE.
LANGUAGE: Java CHALLENGE: Consider this data sequence: “3 11 5 5 5 2 4 6 6 7 3 -8”. Any value that is the same as the immediately preceding value is considered a CONSECUTIVE DUPLICATE. In this example, there are three such consecutive duplicates: the 2nd and 3rd 5s and the second 6. Note that…
Read MoreDeclare an fstream object named a_log. Using a_log, check if the file activityLog exists. If the file activityLog does not already exist, open it for writing using a_log; otherwise open the file activityLog2 for writing using a_log.
LANGUAGE: C++ CHALLENGE: Declare an fstream object named a_log. Using a_log, check if the file activityLog exists. If the file activityLog does not already exist, open it for writing using a_log; otherwise open the file activityLog2 for writing using a_log.
Read MoreWrite the definition of a function square, which receives an integer parameter and returns the square of the value of the parameter.
LANGUAGE: C++ CHALLENGE: Write the definition of a function square, which receives an integer parameter and returns the square of the value of the parameter. So if the parameter ‘s value is 7, the function returns the value 49. If the parameter ‘s value happens to be 25, the functions returns the value 625. If…
Read More