Please explain this code or simulate this.
public SortedLinearArray(int size) {
array = new int[size];
currentSize = 0;
}
public void insertItem(int item) {
if (currentSize < array.length) {
int insertLocation = findLocationInsert(item);
for (int i = currentSize - 1; i >= insertLocation; i--) {
array[i + 1] = array[i];
}
array[insertLocation] = item;
currentSize++;
}
}
private int findLocationInsert(int item) {
for (int i = 0; i < currentSize; i++) {
if (array[i] > item) {
return i;
}
}
return currentSize;
}
public void deleteItem(int item) {
int deleteLocation = findLocationDelete(item);
if (deleteLocation != -1) {
for (int i = deleteLocation + 1; i < currentSize; i++) {
array[i - 1] = array[i];
}
currentSize--;
}
}
private int findLocationDelete(int item) {
for (int i = 0; i < currentSize; i++) {
if (array[i] == item) {
return i;
}
}
return -1;
}
Create an application that receives an internet application from a company’s prospective customers. The following information must be received from the applicant: - Name - Internet Choice - Applicant salary In the event that the “Check application” button is clicked, the complete application result must be displayed in the listbox control of a second form. The label control of the second form must simply indicate whether an application is “approved” or “not approved” If a user has a salary of R2500 or less, then the application cannot be approved, else the application will be approved.
by CodeChum Admin
Now this one's a tad bit tricky, but you can definitely do it!
Instructions:
Input
1. First integer
2. Second integer
3. Third integer
4. Fourth integer
5. Fifth integer
Output
The first five lines will contain message prompts to input the five integers.
The line contains the result.
Enter·integer·1:·2
Enter·integer·2:·3
Enter·integer·3:·3
Enter·integer·4:·5
Enter·integer·5:·4
Result·=·2560000An electric company bases its charges on two rates, customers are charged P25.00 per kilowatt-hour for the first 300 kilowatt-hours used in a month and P30.00 each for all kilowatt-hours used thereafter. Compute for the amount due from a customer after reading the kilowatt-hours used. Assume that there are 100 records of customers.
Draw a flowchart, write an algorithm and design a C++ program for an inventory system that will alert the user to reorder an item based on:
a. The stock-on-hand or an order is below the reorder print.
b. The item is not obsolete.
Use the selection structure.
by CodeChum Admin
Instructions:
Input
The first line contains an integer n which is the size of the array.
The next n lines contains a string on each.
The last line contains an integer which is the index to be accessed and printed.
6
Learning
Programming
made
easy
with
Cody!
5Output
A line containing a string.
Cody!by CodeChum Admin
Instructions:
Input
Two lines containing a string.
fun
PythonOutput
A line containing a string.
Python is really funby CodeChum Admin
Instructions:
Output
The squares and cubes of the elements in the array.
4
1
1
8
27
.
.
.Write a program that allows the user to enter the coal usage at a power station for the first and second week of October in metric tonnes which is as follows:
Week 1: 29,31,29,30,30,28,35
Week 2: 33,37,28,32,31,30,32
List and describe using relevant examples, the five Tuckman's stages of team development