Discuss the concept of parameters. What are parameters for? What is the difference between formal parameters and actual parameters? Give an example in Java code that illustrates formal parameters and actual parameters.
Write a java programme that will compute the future investment at a given rate intereste for specified years.The programme should have a minimum of two classes.
Give an example of a while loop, then provide the equivalent do-while loop and for loop. Then
give a diàerent example of a do-while loop, along with the equivalent while loop and for loop.
Finally, give an example of a for loop, along with the equivalent while loop and do-while loop. Use
your examples to illustrate the advantages and disadvantages of each looping structure, and
describe those advantages and disadvantage
an application named TestSandwich that instantiates one Sandwich object and demonstrates the use of the set and get methods. Save this application as TestSandwich.java.
Can you speak Pig Latin? In Pig Latin, you take the first letter and put it at the end of the word and add the letters “ay” to the end. For example, “pig” becomes “igpay”.
Create a program that takes a word and outputs it in Pig Latin using String methods. You may need the word’s length, a substring that does not include the first letter, and a substring that is just the first letter (you can get the ith letter of a string using substring(i,i+1) so for example the letter at index 3 would be substring(3,4)). using this to start.
public class PigLatin
{
public static void main(String[] args)
{
String word = in.next();
// Use word.substring to construct word in pig latin
String pigLatin =
Given an array of length n, write an algorithm to determine if there are more than 3 instances of the same item in a row.
Example: 1,2,3,4,5,6,7,8,9 returns false
Example: 1,2,3,4,4,4,5,6,7 returns true
Example: 1,2,3,2,3,2,3,2,3 returns false
An insurance company has declared the bonus on yearly basis on two types of
policies or plans, the basis of premium amount on yearly basis paid one time as per
the given criteria:
Premium amount( in Rs.) Child Plan Normal Plan
Minimum 5000 3% 1.5%
5001-20000 5% 3.5%
20001-45000 7% 6.0%
45001 and above 10% 8.5%
Write a program based on above criteria, to input name of person, address, premium
amount( one time), number of years the policy/plan opted for and the type of plan(C
for child and N for normal). Calculate the bonus amount for a year and also for total
number of years the policy opted for. Calculate the maturity amount as follows:
bonus in one year=(Rate percentage/100)*premium.
bonus for number of years= bonus in one year* number of years.
Maturity amount= premium amount + bonus (depending upon the years).
Print name of person, address, premium amount, number of years the opted for,
Name of plan, total bonus and maturity amount.
Question 3. Find and correct the error(s) in each of the following code fragments :
1-The following code should create an integer array and increment all the array elements by 1:
int[] a = new int[5]; for( int i=0; i <= a.length; i++ ) ++a;
2-The following code should compare two integers to determine if they are not equal:
int x = 9, int y = 3; System.out.print( "x != y " + x != y );
"assignmentexpert.com" is professional group of people in Math subjects! They did assignments in very high level of mathematical modelling in the best quality. Thanks a lot