Write a Java program to sort an array of given integers using the Bubble sorting Algorithm ????
Consider the following program segment:
public class Ch7_PrExercise4
{
public static void main(String[] args)
{
int num;
double dec;
.
.
.
}
public static int one(int x, int y)
{
.
.
.
}
public static double two(int x, double a)
{
int first;
double z;
.
.
.
}
}
a. Write the definition of method one so that it returns the sum of
x and y if x is greater than y; otherwise, it should return x minus 2
times y.
b. Write the definition of method two as follows:
i. Read a number and store it in z.
ii. Update the value of z by adding the value of a to its previous value.
iii. Assign the variable first the value returned by method one with
the parameters 6 and 8.
iv. Update the value of first by adding the value of x to its previous
value.
v. If the value of z is more than twice the value of first, return z;
otherwise, return 2 times first minus z.
c. Write a Java program that tests parts a and b. (Declare additional variables
in the method main, if necessary.)
1. All the banks operating in India are controlled by RBI. RBI has set a well defined guideline (e.g. minimum interest rate, minimum balance allowed, maximum withdrawal limit etc) which all banks must follow. For example, suppose RBI has set minimum interest rate applicable to a saving bank account to be 4% annually; however, banks are free to use 4% interest rate or to set any rates above it.
Write a java program to implement bank functionality in the above scenario. Note: Create few classes namely Customer, Account, RBI (Base Class) and few derived classes (SBI, ICICI, PNB etc). Assume and implement required member variables and functions in each class.
Create an Alien class. Include at least three protected data members of your
choice, such as the number of eyes the Alien has. Include a constructor that
requires a value for each data field and a toString() method that returns a
String containing a complete description of the Alien. Save the file as
Alien.java.
1. Write a recursive function, power, that takes as parameters two integers x and y such that x is nozero and return xy. You can use the following recursive function definition to calculate xy. If y>= 0,
1 if y=0
power(x, y) = x if y=1
x*power(x,y-1) if y>1
if y<0,
power(x, y) = 1/power(x, -y)
Explain your own example programming application in which you can effectively use a multidimensional array (or sequence type) to organize the data.
Here, we will simulate a competition between two characters with the benefit of loops and methods.
Prepare a numeric variable to represent the health or energy level of game character 1. 'full' amount of energy
Prepare a numeric variable to represent the health or energy level of game character 2. Set its value to the ’full’ amount of energy
Amend or edit given code PaySlip.java so that if the input file does not exist, the program handles the FileNotFoundException, outputs an appropriate message, and terminates normally.
Use composition of transformations to find the composite matrix to convert the
object With the points : (2,1), (4,1), (4,3), (2,3)
into the object with the points : ( -3,11), (-2,10), (2,14), (0,15)