Write a linear search to find an InventoryItem by Description and tell whether that InventoryItem is in the set or not.
Sort the Array by using a Bubble Sort, Select Sort, or another sort you know of (and your instructor may have shown the Insert Sort in lecture) to sort the array by ItemID. Then loop through the array printing the values of each InventoryItem to show they are now in order.
Then ask the user for a ItemID and write a Binary Search to tell
Take your Array of InventoryItems from assignment 11 and add a ItemID as an Integer and change the test data in the program to have them. (This would be like an ID in a database and would be a number like 452 or 535. It wouldn’t be anything about the data in that object. It gives us another integer value to work with.) Make sure the test data doesn’t have the 5 InventoryItem ItemIDs in order yet at the start.
a parking garage charges a ksh60.00 minimum fee to park for up to three hours. the garage charges an additional ksh.15.00 per hour for each hour or part thereof in excess of three hours. the maximum charge for any given 24-hour period is ksh.375.00. assume that no car parks for longer than 24 hours at a time. write an application that calculates and displays the parking charges for each customer who parked a car in this garage yesterday. you should enter in a jtextfield the hours parked for each customer. the program should display the charge for the current customer and should calculate and display the running total of yesterday’s receipts. the program should use the method calculate charges to determine the charge for each customer
Write a Program that will ask the user to accept 5
integers, select an arithmetic operation for odd
and even, and perform the corresponding
operation.
Enter the first number: 34
Enter the second number: 25
Enter the third number: 62
Enter the fourth number: 13
Enter the fifth number: 27
Choose which operation you want to perform:
1. Addition
2. Subtraction
Enter the operation of odd: 1
Enter the operation of even: 2
The sum of odd numbers is: 65
The difference of even numbers is: -28
Write a program for Presidential Elections, the user will enter his votes based on the code for each candidate. The program will add the total votes for each candidate and proclaim the winner whoever got the most number of votes. The user will stop in accepting votes if the user entered letter ‘Q’ to quit. Type ‘V’ to vote and ‘R’ to view the result.
Sample Output
After the Enqueue operations:
1. Element Front: 10
2. Element rear: 30
3. Elements in the Queue: 10 15 20 25 30
4. Number of Elements in the Queue: 5
The dequeued element is 10.
The dequeued element is 15.
After the Dequeue operations:
1. Element Front: 20
2. Element rear: 30
3. Elements in the Queue: 20 25 30
4. Number of Elements in the Queue: 3
COMPLETE THE CODE
package myqueue_J;
public class MyQueue_J {
public int data;
public MyQueue_J next;
public static MyQueue_J front=null;
public static MyQueue_J rear=null;
public static MyQueue_J temp=null;
public MyQueue_J(int d, MyQueue_J n) {
data=d;
next=n;
}
public static void enqueue(int d){
MyQueue_J temp = new MyQueue_J(d, null);
Insert to perform enqueue operation
}
public static void dequeue(){
Insert to perform dequeue operation
}
public static int printQueue(){
int ctr=0;
Insert to display the elements in the queue
}
public static void main(String[] args) {
Insert to perform the desired output
}
}
2. Search and Rescue
by CodeChum Admin
Make a program that will accept an integer and loop for the same number of times as that of the inputted integer and input random integers and add it to the array/list one by one, per line. Afterwards, make your program accept another random integer.
Using that final integer, compare from your array/list if the final integer's value is also present in your current array/list. If so, print "Present"; otherwise, print "None".
Start coding now!
Input
The first line contains the size of the array/list.
The next lines contain the integers.
The last line contains an integer to be searched.
5
3
21
2
5
23
2
Output
A line containing a string.
Present
A new taxi service based on electric vehicles is offering
services within a metro city. Following is the fare chart
including the type of taxi used to commute and price per
kilometer. Write a java program to calculate total fare
depending on the distance travelled in kilometers.
Note: Use if Control statement
Angle from the positive x axis Quadrant
Between 0 and 90 degrees I
Between 90 and 180 degrees II
Between 180 and 270 degrees III
Between 270 and 360 degrees IV
Type Fare
Micro Php15.00/Km
Macro Php35.50/Km
Shared Php8.50/Km
The quadrant in which line drawn from the origin resides
is determined by the angle that the line makes with the
positive x axis as follows:
Using this information, write a Java method that accepts the
angle of the line as user input and determines and displays
the quadrant appropriate to the input data. (Note: if the
angle is exactly 0, 90, 180, or 270 degrees the corresponding
line does not reside in any quadrant but lies on an axis).
Note: Use if Control statement