Question
Exercise 01: W rite a Java Program to invoke a method/function to display msg on the screen.(Any msg). Exercise 02: Write a Java Program to
Exercise 01:
Write a Java Program to invoke a method/function to display msg on the screen.(Any msg).
Exercise 02:
Write a Java Program to find the sum of all digits and product of all digits of a number using method/function. 1. User must input a number. Number must be 3 digits or
more than that. If user did not enter 3 digits or more
display proper msg saying number is not valid 2. To find the sum of all digits must use while loop.
Exercise 03:
Write a Java Program as follows, 1.Method/Function find prime numbers between 1 to 100
using while loop 2. At a time verify 2 numbers for prime. Only if they both
are prime, need to display twin prime numbers.Ex: (3, 5) ....till 100
3.From main program you have to call the prime function/ method.
Exercise 04:
Write a Java Program, to create a method with passing parameter by value. 1.Create method to swap array values. 2.User must enter 2 array values
3.Pass array values to the method 4.Display array value before and after swapping 5.Must put condition both array length must be greater
than 0 and also both the array length must match. 6.Must pass arrays as argument in the methods
Exercise 05:
Create one class called ShowMessage other than main class. 1.Create one method called displayMessage inside the
ShowMessage class to display msg.(msg can be
anything) 2.Create an object for that ShowMessage class from the
main class. 3.With the help of object display msg on the screen.
Exercise 06:
Create one Java class other than main class. New class must contain following 1.Class name Employee 2.Class must have 4 fields (id, first name, last name and
monthly_salary) 3.Must have constructor 4.Methods to get each field values 5.Methods to set each field values 6.Method to get Annual salary 7.Method to calculate annual increase in salary by specifying the percentage. 8.Method to display Employee details. By Creating object for the above class(Employee), show all the properties.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started