6.8.
Write a program that will accept the currency value and the name of the country and will
display the equivalent in U.S. dollar, based on the given list:
COUNTRY CURRENCY U.S EQUIVALENT
British Pound 0.6 U.S. dollar
Canadian Dollar 1.3 U.S. dollar
Japanese Yen 140 U.S. dollar
German Mark 1.7 U.S. dollar
Philippines Peso 53 U.S. dollar
Write a program to overload operators in the same program by writing suitable operator member
functions for following expression:
O7= ((O1 % O2)>(O3 || O4) - (O5>O6)) [Here O1,O2,O3,O4,O5,O6 and O7 are objects of a class
“overloading”, and this class is having one integer data member]
6.6.
Write a program using string functions that will accept the name of the country as input value and will display the corresponding capital. Here is the list of the countries and their
capitals.
COUNTRY CAPITAL
Canada Ottawa
United States Washington D.C.
U.S.S.R. Moscow
Italy Rome
Philippines Manila
Write a program to take input for n number of doctor records and write records of all cardiologists in
a file named: “record1”. Also write records of all those doctors in another file named: “record2” who are
taking salary more than INR 80,000. After writing records in both files, merge their contents in another
file: “finalrecord” and read all records of “finalrecord” file and display on screen. [Attributes of doctor:
doc_id, doc_name, doc_specialization, doc_salary]
6.5.
Write a simple decryption program using string functions which will apply the Substitution Method. Here is the given Substitution Table.
Substitution Table:
* A
$ E
/ I
+ O
-‐ U
Encrypted message: m$$t m$ *t 9:00 *.m. /n th$ p*rk
Decrypted message: meet me at 9:00 a.m. in the park
6.4.
Write a simple encryption program using string functions which apply the substitution method. Here is the given Substitution Table.
Substitution Table: A *
E $
I /
O +
U -‐
Sample input/output dialogue:
Enter message: meet me at 9:00 a.m. in the park
Encrypted message: m$$t m$ *t 9:00 *.m. /n th$ p*rk
6.3.
Write a program using string function that determines if the input word is a palindrome.
A palindrome is a word that produces the same word when it is reversed.
Sample input/output dialogue:
Enter a word: AMA
Reversed: AMA “It is a palindrome”
Enter a word: STI
Reversed: ITS “It is not a palindrome
6.2.
Write a program using string functions that accepts a coded value of an item and display its equivalent tag price.
The base of the key is: 0 1 2 3 4 5 6 7 8 9 -‐-‐-‐-‐-‐
X C O M P U T E R S
Sample input/output dialogue: Enter coded value: TR.XX
Tag price: 68.00
6.1.
Write a program using standard string functions that accepts a price of an item and display its coded value.
The base of the key is: X C O M P U T E R S 1 2 3 4 5 6 7 8 9
Sample input/output dialogue: Enter price: 489.50
Coded value: PRS.UX
You are given an array of N non-negative integers: A1, A2, ..., AN. An alternating subsequence is a subsequence in which the indices of any two consecutive elements differ by exactly two in the original array. That is, if Ai1, Ai2, ..., Aik is some subsequence, then for it to be an alternating subsequence, (i2 - i1 = 2), (i3 - i2 = 2), and so on should all hold true. Among all alternating subsequences, find the one which has maximum sum of elements, and output that sum.