computer
computer
3. Write a Java program to print the first 15 numbers of the Pell series. In
mathematics, the Pell numbers are an infinite sequence of integers. The
Sequence of Pell numbers starts with 0 and 1, and then each Pell number is the
sum of twice the previous Pell number and the Pell number before that.: Thus,
70 is the companion to 29, and 70 = 2 x 29 + 12 = 58 + 12. The first few terms of
the sequences are: 0, 1, 2, 5, 12, 29, 70, 169, 408, 985, 2378, 5741, 13860…
4. Using a switch statement , write a menu driven program to find the sum of the
following series.
Series 1:
S = 1 + 2 - 3 + 4 - 5 + 6 - 7 + 8 - 9 + ……………… -15
Series 2:
S = (X+1)2+(X+2)3+(X+3)4+(X+4)5+…………… +(X+N)N+1
Member methods:
Courier() : default constructor .
void input() : to accept name , weight, contact number
void cal() : to compute total charges for a parcel as per given
criteria. (Note : service tax Rs. 300 to be paid by all customer irrespective of
weight as part of total charges. )
1 to 100gm 65/=
Write the main method to create an object of the class and call the above
member methods.
Write the main method to create an object of the class and call the above member
methods.
Member methods:
void input() : stores the Principal, rate , time
void cal() : calculate the interest and amount prepaid
void display() : display the principal interest and amount to be paid
Time rate of interest
for one year 6.5%
for 2 years 7.5%
for 3 years 8.5%
for 4 years and more 9.5%
(Note : Time to be taken only in whole years)
9 An Abundant number is a number for which the sum of its proper factors is
greater than the number itself. An deficient number is a number for which the
sum of its proper factors is smaller than the number itself . Write a program to
input a number and check and print whether it is an Abundant or deficient
number or not.
Example:
10 A Dudeney number is a positive integer that is a perfect cube such that the
sum of its digits is equal to the cube root of the number. Write a program to
input a number and check and print whether it is a Dudeney number or not.
Example:
Sum of digits = 5 + 1 + 2 = 8
Cube root of 512 = 8
As Sum of digits = Cube root of Number
hence 512 is a Dudeney number.
write a program read the data calculate and display the following
a) Average marks obtained by each student
b) Print the roll number and average marks of the students whose average is
above 80
c) Print roll number and the average marks of the students whose average is
below 80
13 Write a program in Java to accept a String from the user. Print all the letters
of the word in alphabetical order.
Sample Input: computer
Sample Output: cemoprtu
17. Write a program that encodes a word into Piglatin. To translate a word into a
Piglatin word, convert the word into uppercase and then place the first
vowel of the original word as the start of the new word along with the
remaining alphabets. The alphabets present before the vowel being shifted
towards the end followed by “AY”.
Sample Input (1) : London, Sample Output (1) : ONDONLAY
Sample Input (2) : Olympics, Sample Output (2) : OLYMPICSAY
18 . Write a program that takes a sentence and count and print number of
vowels, consonants, numeric digits and special characters in a sentence.
Assume #,$,%,&,@ are special characters and ignore other special
characters.
20 Write a program in Java to accept a word. Program should checks the string
for the presence of consecutive letters. If two letters are consecutive at any
position then the function prints "It is a magic string", otherwise it prints "It
is not a magic string".
Sample Input: computer
Sample Output: It is not a magic string
Sample Input: DELHI
Sample Output: It is a magic string
-----------------------------------------------