Shaurya
Shaurya
2. Duck Number. 06
18. To display the largest and the smallest value in a 4x4 28-29
array.
19. To define a class Stock along with some specifica ons. 30-31
Thank you.
[SHAURYA GUPTA]
COMPUTER PROGRAMS
(1) void joystring(String s)- with one string argument in lowercase, change the first
le er of every word to uppercase. Display the new string.
Sample Input: cloud compu ng means internet based compu ng
Output: Cloud Compu ng Means Internet Based Compu ng
(2) void joystring(String str, int p)- with one string argument and one integer argument.
It displays all the uppercase character if p is 1(one) otherwise it displays all the lowercase
characters.
(i) 1 (ii) A B C D E
* * ABCD
23 ABC
* ** AB
456 A
Variable
Descrip ons
String n[] To declare an array of size 10
int i To accept values in the array
String s To store the name to be searched
int a It is used as a flag
int i To workout the loop
int i To print the array element which starts with Mr
Ques on 17: Define a class to accept values into a 3×3 array and check if it is a
special array. An array is a special array if the sum of the even elements = sum
of the odd elements.
13 2 23 4
The highest value in the array is :120
52 61 71 18 The smallest value in the array is :2
Data Members
String tle To store the tle of the book
String author To store the author name of the book
String pub To store the publisher of the book
int noc To store the number of copies of the book
Member Func ons
Stock() Default constructor to ini alize all the data
members.
void getdata() To accept tle, author, publisher’s name and
the number of copies.
void (String t, String a, String p, int n) To check the existence of the book by
comparing tle, author’s and publisher’s
name. Also check whether number of
noc>=n.
If yes, maintain the balance noc-n,
otherwise the message “Book is not
available or stock is under flowing.”
Define a class Stock with the above specifica ons and write the main method to create an
object of the class and call the above member methods.
Price Discount
Upto 15000 5%
15001-25000 8%
25001-50000 10%
More than 50000 12%
void display() To display the details in the given format:
Item name Item price Net amount
xxx xxx xxx
Define a class SmartShop with the above specifica ons and write the main method to
create an object of the class and call the above member methods.