Plz answer humble reqstttt
Primorial(p#) is defined to be a product of prime numbers less than or equal to p. (15)
For eg. 3# =2*3=6 5# =2*3*5=30 Design a class primo_numb with two methods
to check whether entered number is prime number or not
to print the primorial of that number.
Answers
MOCK TEST
SECTION B
(Attempt any four. All programs should be written in Java environment. Algorithm and flowchart are not required. Program should be furnished with variable listing. Give comments wherever required.)
5. Primorial(p#) is defined to be a product of prime numbers less than or equal to p. (15)
For eg. 3# =2*3=6 5# =2*3*5=30 Design a class primo_numb with two methods
i) to check whether entered number is prime number or not
to print the primorial of that number.
6. Write a program to store 20 countries name and capitals name in array CA[] and CO[]. When the user inputs a country name the program displays the Capital name, If the country name is not present then the program shows an appropriate error message.
Eg Input India output Delhi
7. Define a class salary described as below:
Data members: name, Address, Phone, Subject Specialization, Monthly Salary, Income Tax
Member methods:
To accept the details of a teacher including the monthly salary
To display the details of the teacher.
To compute the annual Income Tax as 5% of the annual salary above Rs. 1,75,000/-
Write a main method to create object of a class and call the above member method.
8. Write a program using function isauto () to
Print the automorphicic numbers between two ranges
Check if a number is automorphic or not.
9. Write a program in java to input a sentence and find out the smallest and longest word .
eg This is our school
output – smallest is
longest school
Write a menu driven program to display the following pattern.
i) displaying the following structure
// A
// B C D
// E F G H I
// J K L M N O P
ii) displaying the following structure
// A
// A B C
// A B C D E
10. Write a program to store 20 countries name and capitals name in array CA[] and CO[]. When the user inputs a country name the program displays the Capital name, If the country name is not present then the program shows an appropriate error message.
11. Write a class to accept a number and check whether it is a Prime-palindrome number or Armstrong number based on user’s choice.
Prime-palindrome number - a number is a prime no. and palindrome no. Eg. 101
Armstrong number - Sum of the cubes of the digits = number Eg. 153[15]
12. Write a class to input a string (combination of letters and digits) and replace the repeated characters with an asterisk (‘*’) sign. Then display both old and newly created string
13. Write a program to display hcf and lcm of any two nos.