Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#include #include using namespace std; int main() { //constants declaration const int DAYS_PER_MONTH = 30; const int ONE_DOG_YEAR = 7; const int ONE_GOLD_FISH_YEAR = 5;

#include #include using namespace std; int main() { //constants declaration const int DAYS_PER_MONTH = 30; const int ONE_DOG_YEAR = 7; const int ONE_GOLD_FISH_YEAR = 5; const int MONTHS_PER_YEAR = 12; const int HOURS_IN_DAY = 24; const int MINUTES_IN_HOUR = 60; const int SECONDS_IN_MINUTES = 60; //varaible declaration string robotName = "Nao"; string visitorName; int age; int num1, num2; string programmerName = "Your Name"; int assignmentNumber = 1; string dueDate = "09/18/18"; int ageInMonths, ageInDays, ageInHours, ageInMinutes, ageInSeconds; int add; int div; float fdiv; //display programmer name and other details cout << "Programmer Name: " << programmerName << endl; cout << "Assignment Number: " << assignmentNumber << endl; cout << "Due date: " << dueDate << endl << endl; //display the script prototype cout << "Hello, welcome to Montgomery College! My name is " << robotName << ". May I have your name?" << endl; cin >> visitorName; cout << "Nice to have you with us today, " << visitorName <<"! Let me impress you with a small game. " << endl << endl << "Give me the age of an important person or a pet to you. Please give me only a number!" << endl; cin >> age; //calculate age in months, days, hours etc ageInMonths = age * MONTHS_PER_YEAR; ageInDays = ageInMonths * DAYS_PER_MONTH; ageInHours = ageInDays * HOURS_IN_DAY; ageInMinutes = ageInHours * MINUTES_IN_HOUR; ageInSeconds = ageInMinutes * SECONDS_IN_MINUTES; //display the prototype script cout << "You have entered " << age << "."; cout << "If this is for a person, the age can be expressed as " << age << " years or " << ageInMonths << " months or about " << ageInDays << " days or about " << ageInHours << " hours or about " << ageInMinutes << " minutes or about " << ageInSeconds << " seconds."; cout << "If this is for a dog, it is " << age * ONE_DOG_YEAR << " years old in human age."; cout << "If this is for a gold fish, it is " << age * ONE_GOLD_FISH_YEAR << " years old in human age."; cout << endl << endl << "Lets play another game, " << visitorName << "." << " Give me a whole number." << endl; cin >> num1; cout << "Very well. Give me another whole number." << endl; cin >> num2; add = num1+num2; div = num1/num2; fdiv = (float)num1 / (float)num2; cout << "Using the operator '+' in C++, the result of " << num1 << " + " << num2 << " is " << add << ". Using the operator '/', the result of " << num1 << " / " << num2 << " is " << div << "; however, the result of " << fixed << setprecision(1) << (float)num1 << " / " << (float)num2 << " is about " << fdiv << "."; cout << endl << "Do you like the games, " << visitorName << "? If you do, you can learn more by taking our classes. If you don't, I am sad. You should talk to our Chairman!" << endl << endl; system("pause"); return 0; } this program is not showing entirely in the control pannel

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications 24th International Conference Dexa 2013 Prague Czech Republic August 2013 Proceedings Part 1 Lncs 8055

Authors: Hendrik Decker ,Lenka Lhotska ,Sebastian Link ,Josef Basl ,A Min Tjoa

2013 Edition

3642402844, 978-3642402845

More Books

Students also viewed these Databases questions