Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Objective Give practice with reading and writing to standard input in C . Give practice with loops and conditionals in C . Give practice with

Objective
Give practice with reading and writing to standard input in C.
Give practice with loops and conditionals in C.
Give practice with functions in C.
Give practice with strings in C.
Story
You have recently been hired to help out with Kaylee and Trans (KaT) Pet Shop. There are 3
foster homes that help take care of cats. Every week they take in a cat. When the week is over,
they bring the cat back, but the home leaves their mark by adding a signature suffix to the name
of the cat.
The cats to adopt are arranged in a row of N, which is at least 3, cozy cages. You may assume
there is exactly 1 cat per cozy cage. The first family adopted the cat in cage 1. The second
family adopted the cat in cage 2. The third family adopted the cat in cage 3. After they bring
their cat back they will adopt a new cat. The foster families typically want to adopt a different cat
for the week so they will move over some number of positions in the list of cages and adopt the
cat in that location. If there is no cat in that cage that week, the family will go catless for the
week (), remain at that position, and then resume counting from that position in the following
week. If they reach the last cage when counting, they move back to the first cage and resume
counting from there.
We know the following about the three foster homes,
The First Family
Adopts the cat in position 1 in the first week
Adopts on Monday
Adds Lee to the end of the name
Moves 2 cages down
The Second Family
Adopts the cat in position 2 in the first week
Adopts on Tuesday
Adds Lyn to the end of the name
Moves 3 cages down
The Third Family
Adopts the cat in position 3 in the first week
Adopts on Wednesday
Adds Eve to the end of the name
Moves 5 cages down
You are pretty sure that none of the original cats have been adopted. These families have been
adopting cats for some time now, and you want to know what are the current cats available for
adoption.
Problem
Given the initial cages and the number of weeks the adoption has occurred determine the
names of the cats present on the Friday of that week.
Input
The first line of input will contain 2 integers, N and K,(3<= N <=500,1<= K <=500) representing
the number of cozy cages and the number of weeks of which the adoption process has
occurred, respectively.
The following N lines will each contain a single string of up to 19 characters representing the
original name of the cat.
Output
Output N lines each containing the current name of the cat in the cozy cage at the end of the K
weeks. If no cat is present print No cat found. instead.

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

Data Mining Concepts And Techniques

Authors: Jiawei Han, Micheline Kamber, Jian Pei

3rd Edition

0123814790, 9780123814791

More Books

Students also viewed these Databases questions

Question

How effective have these groups been in the past?

Answered: 1 week ago

Question

What are their reputations?

Answered: 1 week ago

Question

How serious a response is warranted to this situation?

Answered: 1 week ago