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

Use java method to find minimum among entered five numbers


Correct the following code make it run easily and explain each step that what is happening in the code.Also attach the picture of the code when you code successfully runs...


public class DLL {private Node start;private Node end;private int count;public DLL()

{start = end = null;count = 0;}

public void insertAtStart(Data d)

{Node tn = new Node(d, null, null);

if (count == 0) {start = end = tn;} else {tn.next = start;start.prev = tn;start = tn;}

count++;} 

public void insertAtEnd(Data d) {if (count == 0) {insertAtStart(d);}

else {Node tn = new Node(d, null, end);

end.next = tn;end = tn;count++;}}

public void insertAt(Data d, int index) {if (count == 0 || index == 0) {insertAtStart(d);} else if (index >= count) {insertAtEnd(d);} else {Node temp = start;for (int i = 0; i < index; i++, temp =temp.next);Node tn = new Node(d, temp, temp.prev);

temp.prev.next = tn;temp.prev = tn;}}}

public class Node {Data d;Node next;Node prev;public Node(Data d, Node n, Node p) {this.d = d;next = n;prev = p;}}


Write an algorithm to find the total number of units of memory allocated/deallocated by the server one after processing all the request

 

 The class ExpenseLedger will record all the expenses you make. You record an expense by giving it a serial number, a description and the money you spent on this item. So you need to create a class ExpenseItem with serial, description and amount. Now in the ExpenseLedger class you need to build a collection that will hold the instance of ExpenseItem. Provide the following methods in the ExpenseLedger 

void addExpense(description, amount): You should be able to figure out the serial of the expense yourself. This method will create an expense item and add it to the ledger int removeSmallExpenses(double amt):This method will find the expense items that are smaller or equal to the amount amt and then remove these items from the list. Note that multiple items can be smaller than this value and thus each of these should be removed. Also this method should return the number of items removed. double totalExpenditure(): This method will calculate the total expenditure recorded in the ledger so far.


Groupings


by CodeChum Admin



Did you know that you can also reverse lists and group them according to your liking with proper code? Let's try it to believe it.





Instructions:



Create a variable that accepts a positive odd integer.


Create an empty list. Then, using loops, add random integer values into the list one by one. The number of values to be stored is dependent on the inputted odd integer on the first instruction.


Reverse the order of the list. Then, print out the list's new order in this manner:


[first-half values]-[middle value]-[second-half values], just like that of the sample output. Make use of list slicing that you’ve learned from the past lessons to easily achieve this segment.


Input



The first line contains an odd positive integer.


The next lines contains an integer.



5


1


3


4


5


2


Output



A line containing a list.



[2,5]-[4]-[3,1]

Create a frame. Place two textboxes in the frame using any appropriate layout. Then place four buttons with the button title +, -, * and /. If the user should put two numeric values in the text fields and click any of the button, then a corresponding calculation ( addition, subtraction, multiplication or division) should be shown in a JOptionPane Message Dialogue popup. If the user mistakenly provides any non numerical values in the textbox then a message "Input should be numerical. Please try again" should be shown in a 


JOptionPane Message Dialogue popup.



An example program if only addition and subtraction buttons has been given attached. It doesn't check for wrong input type. In your submission you must check for wrong input type and a message should be displayed accordingly


Write a java program to create an Account class and define constructors in it. Inherit Saving_Bank_Accountclass andCurrent_Bank_Account class from the Account class. Override constructors of Account class in Saving_Bank_Account and Current_Bank_Account classes. Define appropriate methods to operate these accounts. Make necessary assumptions. Give proper comment in your program to increase redability.



Provide the following methods in the ExpenseLedger 1. void addExpense(description, amount): You should be able to figure out the serial of the expense yourself. This method will create an expense item and add it to the ledger 2. int removeSmallExpenses(double amt):This method will find the expense items that are smaller or equal to the amount amt and then remove these items from the list. Note that multiple items can be smaller than this value and thus each of these should be removed. Also this method should return the number of items removed. 3. double totalExpenditure(): This method will calculate the total expenditure recorded in the ledger so far. You can do this by iterating through the expenses list and adding all the amounts to find the total expenditure so far. 4. Override the toString method so that the ledger is printed in a well formatted way  


I absolutely need to know which numbers from 1 to 1000 are considered perfect. From what I recall, a perfect number is a positive integer that is equal to the sum of all its divisors other than itself.


Example:

6 is a perfect number because 6 = 1 + 2 + 3 


Output

A single line containing the perfect numbers separated by a space.


Note: The sample output below contains "dots" which are just representations (or dummies) for the actual values.

6·28·.·.·.




You probably have encountered Triangle pattern problems before when you started learning programming. Let’s see how well you do with numbers this time. Try to look at the examples closely and think of an algorithm that replicates the outputs. Go for it!


Input

A single line containing an integer n.

9

Output

The output generated based on the inputted integer n.

1
23
456
789
LATEST TUTORIALS
APPROVED BY CLIENTS