Ask Question
1 April, 05:40

Create an algorithm that will convert dog years to human years using the assumption that 1 dog year = 7 human years. Prompt the user to enter the dog's age in years. Multiply the dog's age by 7 to calculate the human age equivalent of the dog's age. For example, if a dog's age is 2, the calculation should be human age equivalent = 2 * 7, which evaluates to the human equivalent of 14 years old. Output the result to the screen. Write the algorithm using pseudocode, and create a desk check using at least one set of test data.

+2
Answers (1)
  1. 1 April, 06:36
    0
    Algorithm:

    1. Declare and initialize variable one_dog_year=7.

    2. Ask user to give dog age.

    2.1 Read the dog age and assign it to variable "dog_age".

    3. Create a variable "human_age" to store the equivalent human age.

    3.1 Calculate equivalent human age as "human_age=one_dog_year*dog_age".

    4. Print the equivalent human age of dog age.

    7. End the program.

    / / here is algorithm implemented in c++

    #include

    using namespace std;

    int main ()

    {

    / / initialize one dog year

    int one_dog_year=7;

    int dog_age;

    int equi_h_age;

    cout<<"Enter the dog age:";

    / / read the dog age

    cin>>dog_age;

    //calculate the equivalent human age

    equi_h_age=dog_age*one_dog_year;

    cout<<"equivalent human age is : "<
    return 0;

    }

    Output:

    Enter the dog age:2

    equivalent human age is : 14
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Create an algorithm that will convert dog years to human years using the assumption that 1 dog year = 7 human years. Prompt the user to ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers