The Galactic Federation is implementing a new security protocol for access to classified information. They have designed a unique identification system to ensure the authenticity of the access codes entered by agents. The purpose is to verify whether an access code is correct or incorrect based on a specific set of rules. Access codes consist of 10 characters, including both letters and numbers. The validation mechanism is described as follows: Take the sum of the ASCII values of the characters at odd positions (1st, 3rd, 5th, etc.) in the access code. Take the product of the ASCII values of the characters at even positions (2nd, 4th, 6th, etc.) in the access code. If the product has more than two digits, sum the digits to obtain a single-digit result. If the sum from step 1 and the result from step 2 add up to a prime number, the access code is considered valid; otherwise, it is invalid. Example 1: Let us check whether the access code "A2B4C6D8E0" is valid or not. Step 1. Sum of ASCII values at odd positions: A(65) + B(66) + C(67) + D(68) + E(69) = 335 Step 2. Product of ASCII values at even positions: 2(50) * 4(52) * 6(54)* 8(56) * 0(48) = 0 Step 3. Sum of results: 335 +0=335 335 is not a prime number. The access code "A2B4C6D8E0" is invalid. Example 2: Another example where the access code "X3Y5Z7W9V1" is valid: Step 1. Sum of ASCII values at odd positions: X(88) + Y(89) + Z(90) + W(87) + V(86) = 440 Step 2. Product of ASCII values at even positions: 3(51)*5(53)*7(55) *9(57) * 1(49) = 10395 -> 1+0+3+9+5=18 Step 3. Sum of results: 440 +18=458 458 is a prime number. The access code "X3Y5Z7W9V1" is valid. Requirement: Write a program that reads access codes from user input and classifies them as "valid" or "invalid" based on the described validation steps. The program should have two arrays of strings for valid and invalid access codes. Arrays should be empty initially. The array sizes should be set as 15, assuming that the user will enter at most 15 access codes. The program should continue asking for an access code until the user enters "EXIT" as the access code. If the access code is valid, it should be added to the "valid codes" array. If the access code is invalid, it should be added to the "invalid codes" array. After the user enters "EXIT," the program should display the valid and invalid codes arrays and stop.

Np Ms Office 365/Excel 2016 I Ntermed
1st Edition
ISBN:9781337508841
Author:Carey
Publisher:Carey
Chapter3: Performing Calculations With Formulas And Functions
Section3.2: Cell References And Formulas
Problem 4QC
icon
Related questions
Question
This is Final Warning ⚠️ Don't post AI generated answer or plagiarised answer. If I see these things I'll give you multiple downvotes and will report immediately.
The Galactic Federation is implementing a new security protocol for access to
classified information. They have designed a unique identification system to ensure
the authenticity of the access codes entered by agents. The purpose is to verify
whether an access code is correct or incorrect based on a specific set of rules.
Access codes consist of 10 characters, including both letters and numbers.
The validation mechanism is described as follows:
Take the sum of the ASCII values of the characters at odd positions (1st, 3rd, 5th, etc.)
in the access code.
Take the product of the ASCII values of the characters at even positions (2nd, 4th, 6th,
etc.) in the access code. If the product has more than two digits, sum the digits to
obtain a single-digit result.
If the sum from step 1 and the result from step 2 add up to a prime number, the access
code is considered valid; otherwise, it is invalid.
Example 1:
Let us check whether the access code "A2B4C6D8E0" is valid or not.
Step 1. Sum of ASCII values at odd positions:
A(65) + B(66) + C(67) + D(68) + E(69) = 335
Step 2. Product of ASCII values at even positions:
2(50) * 4(52) * 6(54) * 8(56) * 0(48) = 0
Step 3. Sum of results:
335 +0=335
335 is not a prime number. The access code "A2B4C6D8E0" is invalid.
Example 2:
Another example where the access code "X3Y5Z7W9V1" is valid:
Step 1. Sum of ASCII values at odd positions:
X(88) + Y(89) + Z(90) + W(87)+ V(86) = 440
Step 2. Product of ASCII values at even positions:
3(51)*5(53)*7(55) *9(57) * 1(49) = 10395 -> 1+0+3+9+5=18
Step 3. Sum of results:
440 +18=458
458 is a prime number. The access code "X3Y5Z7W9V1" is valid.
Requirement:
Write a program that reads access codes from user input and classifies them as
"valid" or "invalid" based on the described validation steps. The program should have
two arrays of strings for valid and invalid access codes. Arrays should be empty
initially. The array sizes should be set as 15, assuming that the user will enter at most
15 access codes. The program should continue asking for an access code until the
user enters "EXIT" as the access code. If the access code is valid, it should be added
to the "valid codes" array. If the access code is invalid, it should be added to the
"invalid codes" array. After the user enters "EXIT," the program should display the
valid and invalid codes arrays and stop.
Transcribed Image Text:The Galactic Federation is implementing a new security protocol for access to classified information. They have designed a unique identification system to ensure the authenticity of the access codes entered by agents. The purpose is to verify whether an access code is correct or incorrect based on a specific set of rules. Access codes consist of 10 characters, including both letters and numbers. The validation mechanism is described as follows: Take the sum of the ASCII values of the characters at odd positions (1st, 3rd, 5th, etc.) in the access code. Take the product of the ASCII values of the characters at even positions (2nd, 4th, 6th, etc.) in the access code. If the product has more than two digits, sum the digits to obtain a single-digit result. If the sum from step 1 and the result from step 2 add up to a prime number, the access code is considered valid; otherwise, it is invalid. Example 1: Let us check whether the access code "A2B4C6D8E0" is valid or not. Step 1. Sum of ASCII values at odd positions: A(65) + B(66) + C(67) + D(68) + E(69) = 335 Step 2. Product of ASCII values at even positions: 2(50) * 4(52) * 6(54) * 8(56) * 0(48) = 0 Step 3. Sum of results: 335 +0=335 335 is not a prime number. The access code "A2B4C6D8E0" is invalid. Example 2: Another example where the access code "X3Y5Z7W9V1" is valid: Step 1. Sum of ASCII values at odd positions: X(88) + Y(89) + Z(90) + W(87)+ V(86) = 440 Step 2. Product of ASCII values at even positions: 3(51)*5(53)*7(55) *9(57) * 1(49) = 10395 -> 1+0+3+9+5=18 Step 3. Sum of results: 440 +18=458 458 is a prime number. The access code "X3Y5Z7W9V1" is valid. Requirement: Write a program that reads access codes from user input and classifies them as "valid" or "invalid" based on the described validation steps. The program should have two arrays of strings for valid and invalid access codes. Arrays should be empty initially. The array sizes should be set as 15, assuming that the user will enter at most 15 access codes. The program should continue asking for an access code until the user enters "EXIT" as the access code. If the access code is valid, it should be added to the "valid codes" array. If the access code is invalid, it should be added to the "invalid codes" array. After the user enters "EXIT," the program should display the valid and invalid codes arrays and stop.
Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Public key encryption
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Np Ms Office 365/Excel 2016 I Ntermed
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:
9781337508841
Author:
Carey
Publisher:
Cengage