Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Camilla's team maintains an archaeology application used primarily by academics, researchers, and field guides. One window of the application displays a data grid of biographical

Camilla's team maintains an archaeology application used primarily by academics, researchers, and field guides. One window of the application displays a data grid of biographical information about various historical rulers along with archaeological data thereabout. Each ruler has a
regnal name, which is one or more "name parts" (each separated by a single space) followed by a Roman numeral. Examples of regnal names that may appear on this page are Pedro VII (one "name part") and Alexander Pontus XV (multiple "name parts"). Note that the Roman numeral portion is always present, and it is always the last contiguous sequence of characters. Roman numerals are converted into decimal numerals using the standard procedure:
The letter / represents 1, V represents 5, X represents 10, L represents 50, C represents 100, D represents 500, and M represents 1000
When two letters appear next to one another and the first is the same as the second, or represents a larger decimal value that the second, the values are added; for example, the Roman numeral XV is 10+5=15 When two letters appear next to one another and the first represents a smaller decimal value than the second, the value of the first is subtracted from the value of the second; for example, the Roman numeral IX is 10-1-9
As a larger example, the Roman numeral MMCDXLVIII is 1000+1000+(500-100)+(50-10)+5+1+1+1=2448
Strings such as WXL, which may be valid under "alternate" translation rules, are invalid Roman numerals under the standard translation procedure
Problem Statement
Assume that every regnal name contains a valid Roman numeral as its regnal number. Implement the following function in the code editor that sorts the rulers' names ascending, first by regnal number and then by (case-sensitive) regnal name Assume that every regnal name contains a valid Roman numeral as its regnal number. Implement the following function in the code editor that sorts the rulers' names ascending, first by regnal number and then by
(
case
-
sensitive
)
regnal name.
/
/
/
aparam names The unordered collection of regnal names. A complete regnal name may appear more than once in the
/
/
/
collection.
/
/
/
apre ap names is not empty.
/
/
/
areturns A new b
llection containing the same contents as ep name but in ascending sorted order, first by regnal
/
/
/
number and then by regnal name.Consider the list of 5 rulers [Nicholas VIII, Hypapsos XXIV, Garibald Yosef II, Nicholas C, Michelfranko XXIV
In decimal, Nicholas VIII translates into Nicholas 8
In decimal, Hypapsos XXIV translates into Hypapsos
In decimal, Garibald Yosef II translates into Garibald Yosef 2
In decimal, Nicholas C translates into Nicholas 100
In decimal, Michelfranko XXIV translates into Michelfranko 24
The function should therefore return [Garibald Yosef II, Nicholas VIII, Hypapsos XXIV, Michelfranko XXIV, Nicholas C ].
STDIN
5
names.size()
==5
Nichdas VIII
FUNCTION
names =={
Expect
Nicholas VIII, Hypapsos XXIV, Garibald Yosef II, Nicholas C, Michelfranko XXIV
Hypapsos XXIV
Garibald Yosef II
Nicholas C
Michelfranko XXIV

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

Flash XML Applications Use AS2 And AS3 To Create Photo Galleries Menus And Databases

Authors: Joachim Schnier

1st Edition

0240809173, 978-0240809175

More Books

Students also viewed these Databases questions

Question

What are the classifications of Bank?

Answered: 1 week ago

Question

How do Data Types perform data validation?

Answered: 1 week ago

Question

How does Referential Integrity work?

Answered: 1 week ago