CSC160 (UG20) 01
    TPS 2: Variables
    Skip To Content
    Dashboard
    • Login
    • Dashboard
    • Calendar
    • Inbox
    • Help
    Close
    • My Dashboard
    • CSC160 (UG20) 01
    • Assignments
    • TPS 2: Variables
    SP 2021 (UNDG)
    • Home
    • Assignments
    • Modules
    • TC/WC Appt Scheduler
    • Collaborations
    • WSJ Context
    • EvaluationKIT Course
    • EvaluationKIT
    • Barnes & Noble Bookstore

    TPS 2: Variables

    • Due Feb 10, 2021 by 10am
    • Points 1
    • Submitting a file upload
    • File Types doc and docx
    • Available after Feb 10, 2021 at 9am

    See TPS 1: Command Line for instructions on how to update your TPS document if you've forgotten. Here's the question to answer:

    Consider the following program that converts human years to dog years. If the user enters their age as 18, it should display "You are 85 in dog years." (using the formula 10.5 dog years for the first two human years, then 4 dog years per human year thereafter). However, it prints "You are 84 in dog years". Identify why that happens and how to fix it.

    #include <iostream>
    using namespace std;

    int main()
    {
        const int FIRST_TWO_YEARS_FACTOR = 10.5;
        const int REMAINING_YEARS_FACTOR = 4;
        int humanAge;

        cout << "How old are you (must be at least 2)?" << endl << "> ";
        cin >> humanAge;

        cout << "You are "
            << FIRST_TWO_YEARS_FACTOR*2 + (humanAge-2)*REMAINING_YEARS_FACTOR
            << " in dog years." << endl;

        return 0;
    }

    Submit your TPS document here (you should be able to submit it directly through Drive if you're only logged into your Endicott Gmail account in your browser).

    1612969200 02/10/2021 10:00am
    Additional Comments:
    Rating max score to > pts

    Rubric

     
     
     
     
     
     
     
         
    Can't change a rubric once you've started using it.  
    Find a Rubric
    Find Rubric
    Title
    You've already rated students with this rubric. Any major changes could affect their assessment results.
    Title
    Criteria Ratings Pts
    Edit criterion description Delete criterion row
    This criterion is linked to a Learning Outcome Description of criterion
    threshold: 5 pts
    Edit rating Delete rating
    5 to >0 pts
    Full Marks
    blank
    Edit rating Delete rating
    0 to >0 pts
    No Marks
    blank_2
    This area will be used by the assessor to leave comments related to this criterion.
    pts
      / 5 pts
    --
    Additional Comments
    Total Points: 5 out of 5