2 147
مشترکین
+324 ساعت
+87 روز
+1430 روز
آرشیو پست ها
2 147
Today's Practice Question:
Define a class to accept a name (in first name & last name format), then display that name in short format. (Example - SACHIN TENDULKAR becomes S. TENDULKAR)
2 147
Practice Question:
Using the switch-case statement, write a menu-driven program to do the following:
(a) To generate and print letters from A to Z and their Unicode.
Letters Unicode
A 65
B 66
. .
. .
. .
Z 90
(b) Display the following pattern using iteration (looping) statement:
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
2 147
Number program for Practice:
Design a class to generate and display first 10 terms of Fibonacci series.
Fibonacci series is the series in which except first two integers, the sum of the two consecutive numbers is the third number.
First few terms of this series are : 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, ...
2 147
class program for practice
Bank charges interest for the vehicle loan as given below:
Number of years Rate of interest
Up to 5 years 15%
More than 5 and up to 10 years 12%
Above 10 years 10%
Write a program to model a class with the specifications given below:
Class name: Loan
Data Members Purpose
int time Time for which loan is sanctioned
double principal Amount sanctioned
double rate Rate of interest
double interest To store the interest
double amt Amount to pay after given time
Member Methods Purpose
void getdata() To accept principal and time
void calculate() To find interest and amount.
Interest = (Principal*Rate*Time)/100
Amount = Principal + Interest
void display() To display interest and amount
2 147
class program for practice
Bank charges interest for the vehicle loan as given below:
Number of years Rate of interest
Up to 5 years 15%
More than 5 and up to 10 years 12%
Above 10 years 10%
Write a program to model a class with the specifications given below:
Class name: Loan
Data Members Purpose
int time Time for which loan is sanctioned
double principal Amount sanctioned
double rate Rate of interest
double interest To store the interest
double amt Amount to pay after given time
Member Methods Purpose
void getdata() To accept principal and time
void calculate() To find interest and amount.
Interest = (Principal*Rate*Time)/100
Amount = Principal + Interest
void display() To display interest and amount
2 147
Function Overloading Practice Question
Design a class to overload a function series() as follows:
(a) void series(int x, int n): to display the sum of the series given below:
x1 + x2 + x3 + … + xn terms
(b) void series(int p): to display the following series:
0, 7, 26, 63, … p terms.
(c) void series(): to display the sum of the series given below:
1/2 + 1/3 + 1/4 + … + 1/10.
2 147
String Practice question
Write a program in Java to accept a word/a String and display the new string after removing all the vowels present in it.
Sample Input: COMPUTER APPLICATIONS
Sample Output: CMPTR PPLCTNS
2 147
Array question to practice
Write a program in Java to store 10 numbers (including positive and negative numbers) in a Single Dimensional Array (SDA). Display all the negative numbers followed by the positive numbers without changing the order of the numbers.
Sample Input:
15 21 -32 -41 54 61 71 -19 -44 52
Sample Output:
-32, -41, -19, 44, 15, 21, 54, 61, 71, 52
