Learn To Code
Define a derived class , ApartmentBuilding that contains four (4) data members: an integer named numFloors, an integer named unitsPerFloor, a boolean named hasElevator, and a boolean named hasCentralAir. There is a constructor containing parameters for the initialization of the above variables (in the same order as they appear above).
LANGUAGE: C++ CHALLENGE: Assume the existence of a Building class . Define a derived class , ApartmentBuilding that contains four (4) data members: an integer named numFloors, an integer named unitsPerFloor, a boolean named hasElevator, and a boolean named hasCentralAir. There is a constructor containing parameters for the initialization of the above variables (in the same order…
Read MoreDefine a derived class , CameraPhone that contains two data members: an integer named , imageSize, representing the size in megapixels of each picture, and an integer named memorySize, representing the number of gigabytes in the camera’s memory.
LANGUAGE: C++ CHALLENGE: Assume the existence of a Phone class . Define a derived class , CameraPhone that contains two data members: an integer named , imageSize, representing the size in megapixels of each picture, and an integer named memorySize, representing the number of gigabytes in the camera’s memory. There is a constructor that accepts two integer parameters …
Read MoreWrite a recursive, bool-valued function, isPalindrome that accepts a string and returns whether the string is a palindrome.
LANGUAGE: C++ CHALLENGE: A palindrome is a string that reads the same forwards or backwards; for example dad, mom, deed (i.e., reversing a palindrome produces the same string ). Write a recursive, bool-valued function, isPalindrome that accepts a string and returns whether the string is a palindrome.
Read MoreWrite a recursive, bool-valued function, containsVowel, that accepts a string and returns true if the string contains a vowel.
LANGUAGE: C++ CHALLENGE: Write a recursive, bool-valued function, containsVowel, that accepts a string and returns true if the string contains a vowel. A string contains a vowel if: The first character of the string is a vowel, or The rest of the string (beyond the first character ) contains a vowel
Read MoreAssume the existence of a BankAccount class . Define a derived class , SavingsAccount that contains two instance variables : the first a double , named interestRate, and the second an integer named interestType.
LANGUAGE: C++ CHALLENGE: Assume the existence of a BankAccount class . Define a derived class , SavingsAccount that contains two instance variables : the first a double , named interestRate, and the second an integer named interestType. The value of the type variable can be 1 for simple interest and 2 for compound interest. There is also a constructor …
Read MoreWrite the definition of a function called product.
LANGUAGE: C++ CHALLENGE: Write the definition of a function called product . The function receives two int parameters. You may assume that neither parameter is negative. The function returns the product of the parameters . So, product (3,5) returns 15 and product (30,4) returns 120. The function must not use a loop of any kind…
Read MoreWrite a function called fact that recursively calculates the factorial value of its single int parameter.
LANGUAGE: C++ CHALLENGE: Write a function called fact that recursively calculates the factorial value of its single int parameter. The value returned by fact is a long ..
Read MoreRead two text files into arrays and query the arrays for boy and girl names
LANGUAGE: C++ CHALLENGE: Read in boynames.txt and girlnames.txt into separate arrays and search by the user entered boy name or girl name. The most popular names are listed first and the least popular names are listed last. write a program that allows the user to input a name. The program should then read from the…
Read MoreRead in string and evaluate for word count and letter occurrences
LANGUAGE: C++ CHALLENGE: Write a program that will read in a line of text and output the number of words in the line and the number of occurrences of each letter. Define a word to be any string of letters that is delimited at each end by either a whitespace, a period, a comma, or the…
Read MoreC++ Sort Array in ascending Order
LANGUAGE: C++ CHALLENGE: Write a function, sort, that accepts an array of integers , and the number of elements in the array and sorts the array in ascending order (basic sort)
Read MoreC++ Define a class called Odometer that will track fuel and mileage for an automotive vehicle.
LANGUAGE: C++ CHALLENGE: C++ Define a class called Odometer that will track fuel and mileage for an automotive vehicle. The class should have member variables to track the miles driven and the fuel inefficiency of the vehicle in miles per gallon. Include a mutator function to reset the odometer to zero miles, a mutator function…
Read MoreC++ Read In Array with Fewer than 50 integers, sort, print Unique numbers and there number of occurrences.
LANGUAGE: C++ CHALLENGE: C++ Write a program that reads in an array of type int. You may assume that there are fewer than 50 entries in the array. Your program determines how many entries are used. The output is to be a two-column list. the first column is a list of the distinct array elements;…
Read More