7168computer Decrypted
7168computer Decrypted
com/
int x = 5, y = 12, z;
z = (x>= y ? x – y : y – x );
(e) if String x = “Computer”, y = “Applications”; [4]
What do the following functions return for:
i) x.compareTo(y);
ii) y.indexOf(y.charAt(8));
iii) x.length( ) > y.length( );
iv) y.indexOf(‘i’,4);
(f) Explain Function. Write the syntax of user defined function. [4]
(g) Difference between default and parameterized constructor. [2]
Question 4 [15]
Define a class Stock having the following description:
Data members are name, quantity, rate
Member functions are i) public void input( ) [To input name, quantity and rate]
ii) public void sell(int x) [reduce x quantity from stock after checking stock]
iii) public void add(int y) [ add y quantity into stock]
iv) public void display( ) [display current stock position]
Question 5 [15]
A man is paid the hourly rate (R) for the first 35 hours, he works in a week. There after, he is paid at 1.5
time that hourly rate (R) for the next 25 hours he works in a week, and at twice the hourly rate (R) for a
further 10 hours in a week. He is not allowed to work for more than 70 hours in a week.
click here to get best result for ever in .........
http://www.orkut.co.in/Main#AlbumZoom.aspx?uid=10115953594578600157&pid=1213502575205&ai
d=1213477056&p=0$pid=1213502575205
Taking the number of hours worked (H) and the rate per hour (R) as inputs, the weekly wages (W) are
to be calculated and printed. Write a JAVA program for the above situation and print the weekly wages.
Question 6 [15]
Write a program to input a number and display sum of first and last digit only.
e.g. input num = 3459 output sum = 3 + 9 = 12
num = 568 output sum = 5 + 8 = 13
Question 7 [15]
Write a program to input value of x and n. Display sum of following series
x x3 x5 x 2n1
sum ........
1! 2 ! 3 ! n!
www.icseguess.com
Other Educational Portals
www.cbseguess.com | www.ignouguess.com | www.aipmtguess.com | www.aieee.com | www.niosguess.com |
www.iitguess.com | www.indiaguess.com
http://www.icseguess.com/
Question 8 [15]
Write a program to input a name and display name in following format.
e.g. Input name = “Amit Kumar Verma” Output “Verma, A.K.”
name = “Ajay Yadav” Output “Yadav, A.”
Question 9 [15]
Write a program to input a string. Convert all vowels in lower case and all consonant in Upper case.
(A string may be upper, lower and special characters)
e.g. Input st = “WELCome TO School” Output “WeLCoMe To SCHooL”
----------x---------x----------x---------
www.icseguess.com
Other Educational Portals
www.cbseguess.com | www.ignouguess.com | www.aipmtguess.com | www.aieee.com | www.niosguess.com |
www.iitguess.com | www.indiaguess.com