Write a program in a file named SeedFinder.cpp that finds and displays all the seeds of...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a program in a file named SeedFinder.cpp that finds and displays all the seeds of a integer given by the user. Let's define a seed of an integer, n, to be a positive value that equals n when multiplied by its individual digits. For example, 23 is a seed of 138 because 23 x 2 x 3= 138. 111 is an example of a seed of itself because 111x1x1x1=111 Many numbers have no seeds (e.g. 2) and some numbers have multiple seeds (eg, 24 and 32 are seeds of 1921 Implement the following functions as parts of your overall solutions: a getPositivewholeNumber: This function asks the user for a positive whole number [integer) repeatedly until the input is correct. The number is then returned. You can assume that the user will only input whole numbers, but you need to check if they are positive. b checkIfseed. This function takes two parameters: (1) the number with possible seeds and [2] a possible seed to check. The function returns a bool. The function returns true if the possible seed is in fact a seed of the first parameter, otherwise, the function returns false. The function should first check if the number is divisible by the possible seed, otherwise it cannot be a seed and no further checks are necessary. If the number is dividable by the possible seed, multiple the seed by each of its digits using a loop. Finally, compare that product with number. Hint: use the modulus operator to extract the last digit of a number and divide by 10 to remove the last digit of a number. This function should not get any input from the user or display any information (ie, do not use cin or cout in this function) c. findAndDisplaySeeds. This is a void function that accepts a single integer as a parameter. The function should output "The seed(s) of N are:" (but replacing N with the parameter's value) After that, find and display each seed by looping through each possible seed value for the parameter and using checkIfSeed to see which values should be displayed Output the word "none" if no seed values were found. d. The main function should simply display the header"--- Seed Finder ---", call getPositivewholeNumber(), and then findAndDisplaySeeds (). Also, it may define any variables that are necessary. Make sure your programs output matches the format of the example output Sample Output (user input is in yellow) Seed Finder --- Enter a positive whole number: -1 Enter a positive whole number: Enter a positive whole number: 24 lie, do not use cin or cout this function) c. findAndDisplayseeds: This is a void function that accepts a single integer as a parameter. The function should output "The seed(s) of N are:" [but replacing N with the parameter's value). After that, find and display each seed by looping through each possible seed value for the parameter and using checkIfSeed to see which values should be displayed. Output the word "none" if no seed values were found. d. The main function should simply display the header - Seed Finder ---, call get PositivewholeNumber (). and then findAndDisplaySeeds (). Also, it may define any variables that are necessary. Make sure your programs output matches the format of the example output Sample Output (user input is in yellow) Seed Finder Enter a positive whole number: -1 Enter a positive whole number: Enter a positive whole number: 24 The seed(s) of 24 are: 12. Sample Output (user input is in yellow) Seed Finder Enter a positive whole number: 289 The seed(s) of 289 are: none. Sample Output (user input is in yellow) Seed Finder Enter a positive whole number: 549584 The seed(s) of 549584 are: 1696 2862 3392 3816. Write a program in a file named SeedFinder.cpp that finds and displays all the seeds of a integer given by the user. Let's define a seed of an integer, n, to be a positive value that equals n when multiplied by its individual digits. For example, 23 is a seed of 138 because 23 x 2 x 3= 138. 111 is an example of a seed of itself because 111x1x1x1=111 Many numbers have no seeds (e.g. 2) and some numbers have multiple seeds (eg, 24 and 32 are seeds of 1921 Implement the following functions as parts of your overall solutions: a getPositivewholeNumber: This function asks the user for a positive whole number [integer) repeatedly until the input is correct. The number is then returned. You can assume that the user will only input whole numbers, but you need to check if they are positive. b checkIfseed. This function takes two parameters: (1) the number with possible seeds and [2] a possible seed to check. The function returns a bool. The function returns true if the possible seed is in fact a seed of the first parameter, otherwise, the function returns false. The function should first check if the number is divisible by the possible seed, otherwise it cannot be a seed and no further checks are necessary. If the number is dividable by the possible seed, multiple the seed by each of its digits using a loop. Finally, compare that product with number. Hint: use the modulus operator to extract the last digit of a number and divide by 10 to remove the last digit of a number. This function should not get any input from the user or display any information (ie, do not use cin or cout in this function) c. findAndDisplaySeeds. This is a void function that accepts a single integer as a parameter. The function should output "The seed(s) of N are:" (but replacing N with the parameter's value) After that, find and display each seed by looping through each possible seed value for the parameter and using checkIfSeed to see which values should be displayed Output the word "none" if no seed values were found. d. The main function should simply display the header"--- Seed Finder ---", call getPositivewholeNumber(), and then findAndDisplaySeeds (). Also, it may define any variables that are necessary. Make sure your programs output matches the format of the example output Sample Output (user input is in yellow) Seed Finder --- Enter a positive whole number: -1 Enter a positive whole number: Enter a positive whole number: 24 lie, do not use cin or cout this function) c. findAndDisplayseeds: This is a void function that accepts a single integer as a parameter. The function should output "The seed(s) of N are:" [but replacing N with the parameter's value). After that, find and display each seed by looping through each possible seed value for the parameter and using checkIfSeed to see which values should be displayed. Output the word "none" if no seed values were found. d. The main function should simply display the header - Seed Finder ---, call get PositivewholeNumber (). and then findAndDisplaySeeds (). Also, it may define any variables that are necessary. Make sure your programs output matches the format of the example output Sample Output (user input is in yellow) Seed Finder Enter a positive whole number: -1 Enter a positive whole number: Enter a positive whole number: 24 The seed(s) of 24 are: 12. Sample Output (user input is in yellow) Seed Finder Enter a positive whole number: 289 The seed(s) of 289 are: none. Sample Output (user input is in yellow) Seed Finder Enter a positive whole number: 549584 The seed(s) of 549584 are: 1696 2862 3392 3816. Write a program in a file named SeedFinder.cpp that finds and displays all the seeds of a integer given by the user. Let's define a seed of an integer, n, to be a positive value that equals n when multiplied by its individual digits. For example, 23 is a seed of 138 because 23 x 2 x 3= 138. 111 is an example of a seed of itself because 111x1x1x1=111 Many numbers have no seeds (e.g. 2) and some numbers have multiple seeds (eg, 24 and 32 are seeds of 1921 Implement the following functions as parts of your overall solutions: a getPositivewholeNumber: This function asks the user for a positive whole number [integer) repeatedly until the input is correct. The number is then returned. You can assume that the user will only input whole numbers, but you need to check if they are positive. b checkIfseed. This function takes two parameters: (1) the number with possible seeds and [2] a possible seed to check. The function returns a bool. The function returns true if the possible seed is in fact a seed of the first parameter, otherwise, the function returns false. The function should first check if the number is divisible by the possible seed, otherwise it cannot be a seed and no further checks are necessary. If the number is dividable by the possible seed, multiple the seed by each of its digits using a loop. Finally, compare that product with number. Hint: use the modulus operator to extract the last digit of a number and divide by 10 to remove the last digit of a number. This function should not get any input from the user or display any information (ie, do not use cin or cout in this function) c. findAndDisplaySeeds. This is a void function that accepts a single integer as a parameter. The function should output "The seed(s) of N are:" (but replacing N with the parameter's value) After that, find and display each seed by looping through each possible seed value for the parameter and using checkIfSeed to see which values should be displayed Output the word "none" if no seed values were found. d. The main function should simply display the header"--- Seed Finder ---", call getPositivewholeNumber(), and then findAndDisplaySeeds (). Also, it may define any variables that are necessary. Make sure your programs output matches the format of the example output Sample Output (user input is in yellow) Seed Finder --- Enter a positive whole number: -1 Enter a positive whole number: Enter a positive whole number: 24 lie, do not use cin or cout this function) c. findAndDisplayseeds: This is a void function that accepts a single integer as a parameter. The function should output "The seed(s) of N are:" [but replacing N with the parameter's value). After that, find and display each seed by looping through each possible seed value for the parameter and using checkIfSeed to see which values should be displayed. Output the word "none" if no seed values were found. d. The main function should simply display the header - Seed Finder ---, call get PositivewholeNumber (). and then findAndDisplaySeeds (). Also, it may define any variables that are necessary. Make sure your programs output matches the format of the example output Sample Output (user input is in yellow) Seed Finder Enter a positive whole number: -1 Enter a positive whole number: Enter a positive whole number: 24 The seed(s) of 24 are: 12. Sample Output (user input is in yellow) Seed Finder Enter a positive whole number: 289 The seed(s) of 289 are: none. Sample Output (user input is in yellow) Seed Finder Enter a positive whole number: 549584 The seed(s) of 549584 are: 1696 2862 3392 3816. Write a program in a file named SeedFinder.cpp that finds and displays all the seeds of a integer given by the user. Let's define a seed of an integer, n, to be a positive value that equals n when multiplied by its individual digits. For example, 23 is a seed of 138 because 23 x 2 x 3= 138. 111 is an example of a seed of itself because 111x1x1x1=111 Many numbers have no seeds (e.g. 2) and some numbers have multiple seeds (eg, 24 and 32 are seeds of 1921 Implement the following functions as parts of your overall solutions: a getPositivewholeNumber: This function asks the user for a positive whole number [integer) repeatedly until the input is correct. The number is then returned. You can assume that the user will only input whole numbers, but you need to check if they are positive. b checkIfseed. This function takes two parameters: (1) the number with possible seeds and [2] a possible seed to check. The function returns a bool. The function returns true if the possible seed is in fact a seed of the first parameter, otherwise, the function returns false. The function should first check if the number is divisible by the possible seed, otherwise it cannot be a seed and no further checks are necessary. If the number is dividable by the possible seed, multiple the seed by each of its digits using a loop. Finally, compare that product with number. Hint: use the modulus operator to extract the last digit of a number and divide by 10 to remove the last digit of a number. This function should not get any input from the user or display any information (ie, do not use cin or cout in this function) c. findAndDisplaySeeds. This is a void function that accepts a single integer as a parameter. The function should output "The seed(s) of N are:" (but replacing N with the parameter's value) After that, find and display each seed by looping through each possible seed value for the parameter and using checkIfSeed to see which values should be displayed Output the word "none" if no seed values were found. d. The main function should simply display the header"--- Seed Finder ---", call getPositivewholeNumber(), and then findAndDisplaySeeds (). Also, it may define any variables that are necessary. Make sure your programs output matches the format of the example output Sample Output (user input is in yellow) Seed Finder --- Enter a positive whole number: -1 Enter a positive whole number: Enter a positive whole number: 24 lie, do not use cin or cout this function) c. findAndDisplayseeds: This is a void function that accepts a single integer as a parameter. The function should output "The seed(s) of N are:" [but replacing N with the parameter's value). After that, find and display each seed by looping through each possible seed value for the parameter and using checkIfSeed to see which values should be displayed. Output the word "none" if no seed values were found. d. The main function should simply display the header - Seed Finder ---, call get PositivewholeNumber (). and then findAndDisplaySeeds (). Also, it may define any variables that are necessary. Make sure your programs output matches the format of the example output Sample Output (user input is in yellow) Seed Finder Enter a positive whole number: -1 Enter a positive whole number: Enter a positive whole number: 24 The seed(s) of 24 are: 12. Sample Output (user input is in yellow) Seed Finder Enter a positive whole number: 289 The seed(s) of 289 are: none. Sample Output (user input is in yellow) Seed Finder Enter a positive whole number: 549584 The seed(s) of 549584 are: 1696 2862 3392 3816.
Expert Answer:
Answer rating: 100% (QA)
Debug SeedFindercpp 1 2 3 4 int getpositivewholenumber 5 6 7 8 9 10 11 12 13 HAHAAANNNNN2 14 ... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
Write a program in JavaScript that accepts an integer greater than 2 and tells whether it is a prime number. Note that JavaScript has if and while statements with the same syntax as C and Java. The...
-
By using function and array, write a program in C++ to print prime numbers in range 1-100.
-
Write a program in a script file that finds the smallest even integer that is divisible by 13 and by 16 whose square root is greater than 120. Use a loop in the program. The loop should start from 1...
-
4. Jerry intends to use the money from his loan (and his personal savings if necessary) to make an investment in his friend Elaines business. In return, Elaine has predicted the following returns on...
-
When would forming a limited-liability company be more advantageous than creating a C corporation or a partnership?
-
In the accounting for Research and Development (R&D) Credits, what is the key criterion for recognizing these credits as assets?
-
How does one distinguish between negligence and malpractice?
-
You expect to invest your funds equally in four stocks with the following expected returns: Stock Expected Return A........ 16% B........ 14 C........ 10 D........ 8 At the end of the year, each...
-
How does the standard define relevance and reliability? What must an auditor do if conditions indicate that a document may not be authentic or the terms in a document have been modified but that the...
-
Mr. M has been employed as an engineer by A Ltd., a company incorporated in Hong Kong. During the year ended 31 March 2019, Mr. M had the following income and expenditure. A monthly salary of...
-
write pseudocode for the following program. The program will make and modify a shopping cart for a customer (think amazon or any shopping site). The application will allow the user to view and add...
-
fiscal policy variables G and T are independent of the level of income. In the real world, however, this is not the case. Taxes typically depend on the level of income and so tend to be higher when...
-
For both political and macroeconomic reasons, governments are often reluctant to run budget deficits. Here, we examine whether policy changes in G and T that maintain a balanced budget are...
-
In a certain country, the population consists of five blue people and five green people. Each green person has an income of $2 per year. Each blue person has an income of $6 per year. a. Draw the...
-
A company plans the construction of a winter-themed family amusement park in Alberta. The project details are as follows: . $1,000,000 in year 1 and $1,500,000 in year 2 for construction. $500,000 in...
-
Some economists argue that early child care generates an external benefit to society. Consider the following demand and supply le graph for early childhood education. Price ($ per month) $1,300...
-
Evaluate the line integral f (1x - y) dx + (x + y) dy, where C = C UC, here C: + y = 4 and C: x + y = 1.
-
suppose a nickel-contaminated soil 15 cm deep contained 800 mg/kg Ni, Vegetation was planted to remove the nickel by phytoremediation. The above-ground plant parts average 1% Ni on a dry-weight bas...
-
In a low-pass RL filter (a filter that passes signals with low frequencies), the ratio of the magnitudes of the voltages is given by: where is the frequency of the input signal. Write a user-defined...
-
Create the following matrix by using vector notation for creating vectors with the linspace command. Do not type individual elements explicitly. 5555 ||
-
The boiling temperature of water TB at various altitudes his given in the following table. Determine a linear equation in the form TB = mh + b that best fits the data. Use the equation for...
-
You're bouncing up and down on a trampoline. After you have left the trampoline and are moving upward, your apparent weight is A. More than your true weight. B. Less than your true weight. C. Equal...
-
A mountain biker is climbing a steep 20 slope at a constant speed. The cyclist and bike have a combined weight of800 N. Referring to Figure 5.11 for guidance, what can you say about the magnitude of...
-
Rank in order, from largest to smallest, the size of the friction forces in the five different situations (one or more friction forces could be zero). The box and the floor are made of the same...
Study smarter with the SolutionInn App