In a university, there is a certain system of credits. Each of student is given a ‘credit limit’ which specifies the maximum credits of a subject they can take. A student can take any number of subjects which are under his/her credit limit.
There are N students and K subjects.Each subject has a specified number of credits .when student choose a subject ,it becomes a (student,subject)pair.
Find the maximum number of possible(subject,student)pairs for the given credit limits and subject credit requirements.
Input1:K denoting the number of subjects
Input2:An array of K elements each denoting the credits to take a subject
Input3:N denoting the number of students
Input4:An array of N elements each denoting the credit limit of a student.
Output:Your should return the maximumnumber of possible required pairs.
Example1:
Inpput1:3
Input2:{44,45,56,39,2,6,17,75}
Input3:1
Input4:{54}
Output:6
6.10.
Write a program that takes data, a word at a time and reverses the words of the line.
Sample input/output dialogue: Input string value: birds and bees
Reversed: bees and birds
6.9.(Write a program using string functions)
Write a program that takes nouns and forms their plurals on the basis of these rules:
a. If a noun ends in “y”, remove the”y” and add “ies”
b. If a noun ends in "s”, “ch” or “sh”, add "es”
c. In all other cases, just add “s”
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
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
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