Computers and Technology

4.2 Code Practice: Question 2 Instructions
Write a loop that continually asks the user what pets the user has until the user enters rock, in which case the loop ends. It should
acknowledge the user in the following format. For the first pet, it should say you have a dog with a total of 1 pet(s) if they enter dog, and
so on
cate
Sample Run
What pet do you have? lemur
what pet do you have? parrot
what pet do you have? cat
what pet do you have? rock
Sample Output
You have a lemur with a total of 1 pet(s)
You have a parrot with a total of 2 pet(s)
You have a cat with a total of 3 pet(s)

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 01:40, hanjonez
Writing a modular program in visual c++. i am new to this and not sure what i am missing. i am getting the following error: baddate. cpp: in function ‘int main()’: baddate. cpp: 50: 3: error: ‘else’ without a previous ‘if’elsehere are the instructions and code: writing a modular program in c++in this lab, you add the input and output statements to a partially completed c++ program. when completed, the user should be able to enter a year, a month, and a day. the program then determines if the date is valid. valid years are those that are greater than 0, valid months include the values 1 through 12, and valid days include the values 1 through 31.notice that variables have been declared for you. write the simulated housekeeping() function that contains the prompts and input statements to retrieve a year, a month, and a day from the user. include the output statements in the simulated endofjob() function. the format of the output is as follows: month/day/year is a valid date. ormonth/day/year is an invalid date. execute the program entering the following date: month = 5, day = 32, year = 2014. record the output of this program. execute the program entering the following date: month = 9, day = 21, year = 2002. record the output of this /* program name: baddate. cppfunction: this program determines if a date entered by the user is valid. input: interactiveoutput: valid date is printed or user is alerted that an invalid date was entered*/#include bool validatedate(int, int, int); using namespace std; int main(){// declare variablesint year; int month; int day; const int min_year = 0, min_month = 1, max_month = 12, min_day = 1, max_day = 31; bool validdate = true; // this is the work of the housekeeping() method// get the year, then the month, then the daycout< < "enter the year"< > year; cout< < "enter the month"< > month; cout< < "enter the day"< > day; // this is the work of the detailloop() method// check to be sure date is validif(year < = min_year) // invalid yearvaliddate = false; else if (month < min_month || month > max_month) // invalid monthvaliddate = false; else if (day < min_day || day > max_day) // invalid dayvaliddate = false; // this is the work of the endofjob() method// test to see if date is valid and output date and whether it is valid or notif(validdate == true); {// output statementcout<
Answers: 1
image
Computers and Technology, 23.06.2019 07:00, lin550
Why were most movies from the late 1890s until the early 1930s only filmed in black and white? there were only a few people who could afford the technology to produce color motion pictures back then. audiences did not want color motion pictures until later. the film used to make color motion pictures often overheated, which was a safety hazard, so it was generally not allowed. color films had to be hand-colored, frame by frame.
Answers: 3
image
Computers and Technology, 23.06.2019 23:00, minosmora01
How do you know if the website is secure if you make a purchase
Answers: 2
image
Computers and Technology, 24.06.2019 07:50, treytonmesser
Write a defining table and then a program that determines if you can sleep in or not. your program should get all its input from your computer’s clock. on all weekdays (monday through friday) that are not holidays, your program should output “get up! ” on all other days (weekends and holidays), your program should output “sleep in.” the three holidays that your program must check for are january 1 (new year’s day), july 4 (u. s. independence day), and december 25 (christmas). you don’t need to include other holidays in your program because most other holidays do not occur on a fixed day each year.
Answers: 1
Do you know the correct answer?
4.2 Code Practice: Question 2 Instructions
Write a loop that continually asks the user what p...

Questions in other subjects:

Konu
Mathematics, 12.02.2021 06:40
Konu
Mathematics, 12.02.2021 06:40
Konu
Mathematics, 12.02.2021 06:40
Konu
Mathematics, 12.02.2021 06:40
Konu
Mathematics, 12.02.2021 06:40