Java | JSP | JSF Answers

Questions: 4 418

Answers by our Experts: 3 943

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

Compare and use various data types in a java program, declare and use constant and variables and cast and value of one data type to another data type. Write a java program that initialize the following:



"Data Type"


double


short


double


int




"Variable Name"


size


grade


final_grade


final_length




"Value"


125.83d


87


grade


side




Name the class as Data and save the file. Debug syntax and logical errors if there is any in the program. Save the file.




Write a java program that initialize tge diplays values based on the table below. Print all the numbers as whole numbers. Name the class DisplayWholeNumbers.java





"Variable Name"




examScore




averageGrade




seconds_per_minute




length




referenceNumber






"Value"




87




84.67




60




29.7




998883723193101

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

}

}


An e-commerce company plans to give their customers a discount for the Christmas holiday. The discount will be calculated on the basis of the bill amount of the order placed. The discount amount is the product of the sum of all odd digits and the sum of all even digits of the customer’s total bill amount. Write an algorithm to find the discount amount for the given total bill amount.InputThe input consists of an integer billAmount, representing the total bill amount of a customer.OutputPrint an integer representing the discount amount for the given total bill.ConstraintsO <billAmount≤ 109ExampleInput:2514795Output:162Explanation:Odd digits in the given number 2514795 are 5, 1, 7, 9, 5. The sum of these odd digits is 27.Even digits in the given number 2514795 are 2, 4. The sum of these even digits is 6.So, the output is 162

Need help in this task:

Project files https://we.tl/t-P8IORFiRDZ


LATEST TUTORIALS
APPROVED BY CLIENTS