The Interstellar Health Organization (IHO) has developed a new method for categorizing space viruses based on their genetic sequences. Each virus is assigned a unique sequence identifier, and the IHO wants to create a program to classify these sequences as either "safe" or "hazardous." The classification mechanism is as follows: 1. Calculate the sum of the digits of the sequence. 2. If the sum is divisible by 5, add 5 to it. 3. Check if the result is a perfect square. If it is, the sequence is considered safe; otherwise, it's considered hazardous. Example 1: Sequence: 123456 Step 1. Sum of digits: 1+2+3+4+5+6=21 Step 2.21 is not divisible by 5. Step 3. Result: 21 is not a perfect square; therefore, the sequence 123456 is hazardous. Example 2: Sequence: 987654 Step 1. Sum of digits: 9+8+7+6+5+4=39 Step 2.39 is divisible by 5, so add 5 to it: 39 + 5 = 44 Step 3. Result: 44 is not a perfect square; therefore, the sequence 987654 is hazardous. Your task is to create a program that reads sequence identifiers from user input and categorizes them as "safe" or "hazardous." The program should have two arrays to store safe and hazardous sequences, each with a maximum size of 20. The program should continue asking for sequences until the user enters O, at which point it should display the arrays and terminate. Error handling for non-numeric inputs is not required.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
I know you guys are using AI. Don't you dare give me AI generated answer. This is warning ⚠️
The Interstellar Health Organization (IHO) has developed a new method for
categorizing space viruses based on their genetic sequences. Each virus is assigned
a unique sequence identifier, and the IHO wants to create a program to classify these
sequences as either "safe" or "hazardous."
The classification mechanism is as follows:
1. Calculate the sum of the digits of the sequence.
2. If the sum is divisible by 5, add 5 to it.
3. Check if the result is a perfect square. If it is, the sequence is considered safe;
otherwise, it's considered hazardous.
Example 1:
Sequence: 123456
Step 1. Sum of digits: 1+2+3+4+5+6=21
Step 2. 21 is not divisible by 5.
Step 3. Result: 21 is not a perfect square; therefore, the sequence 123456 is
hazardous.
Example 2:
Sequence: 987654
Step 1. Sum of digits: 9+8+7+6+5+4=39
Step 2.39 is divisible by 5, so add 5 to it: 39 + 5 = 44
Step 3. Result: 44 is not a perfect square; therefore, the sequence 987654 is
hazardous.
Your task is to create a program that reads sequence identifiers from user input and
categorizes them as "safe" or "hazardous." The program should have two arrays to
store safe and hazardous sequences, each with a maximum size of 20. The program
should continue asking for sequences until the user enters O, at which point it should
display the arrays and terminate. Error handling for non-numeric inputs is not
required.
Transcribed Image Text:The Interstellar Health Organization (IHO) has developed a new method for categorizing space viruses based on their genetic sequences. Each virus is assigned a unique sequence identifier, and the IHO wants to create a program to classify these sequences as either "safe" or "hazardous." The classification mechanism is as follows: 1. Calculate the sum of the digits of the sequence. 2. If the sum is divisible by 5, add 5 to it. 3. Check if the result is a perfect square. If it is, the sequence is considered safe; otherwise, it's considered hazardous. Example 1: Sequence: 123456 Step 1. Sum of digits: 1+2+3+4+5+6=21 Step 2. 21 is not divisible by 5. Step 3. Result: 21 is not a perfect square; therefore, the sequence 123456 is hazardous. Example 2: Sequence: 987654 Step 1. Sum of digits: 9+8+7+6+5+4=39 Step 2.39 is divisible by 5, so add 5 to it: 39 + 5 = 44 Step 3. Result: 44 is not a perfect square; therefore, the sequence 987654 is hazardous. Your task is to create a program that reads sequence identifiers from user input and categorizes them as "safe" or "hazardous." The program should have two arrays to store safe and hazardous sequences, each with a maximum size of 20. The program should continue asking for sequences until the user enters O, at which point it should display the arrays and terminate. Error handling for non-numeric inputs is not required.
Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY