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

Write a statement to draw a rounded rectangle with the following features:

Width = 200 Corner horizontal diameter = 20

Height = 100 Corner vertical diameter = 40

Select the suitable upper-left corner of the rectangle. 


 Creating a user defined Exception “FileFormatException” by extending IOException as following way

class FileFormatException extends IOException {

public FileFormatException ( ) { }

public FileFormatException ( String gripe ){

super (gripe);

}

And using that custom exception as follows:

String readData( BufferReader in ) throws FileFormatException {

……. 

while ( ……) { 

if ( ch = = -1) // EOF encountered 

{

if ( n < len )

throw new FileFormatException ( ) ; 

}

………

}

return s ;

i) What are the differences between throw and throws? ii) Analyze the above code and write down your comments on whether the procedure is correct ways to use exception or not.


Write a java program that executes three threads. First thread displays Good Morning everyone second. Second thread displays Hello every two seconds and the third thread displays Welcome in every three seconds. Create the three threads by extending the thread class. 


Write a program to print out all Armstrong numbers between a range of numbers entered by user. The following is a sample of output:

Sample 1

enter the range of numbers :10 100

the Armstrong numbers are:

No Armstrong Numbers found:


sample 2

enter the range of numbers : 100 2000

the Armstrong Numbers are :

153

370

371

407

1634



StudentAccount

      

     -studentName: String

     -studentCourse: String

     -balance: double

      

     +StudentAccount()

     +StudentAccount(String,String,double)

     +getters()

     +setters()

     +toString(): String

     +pay(double): double

     +addFees(double): double

     +refund(): void



Code the StudentAccount class according to the class diagram


There is a binary tree given to you. In which each of the node represents the student in the class.
You are playing a game in which you need to team up with one of student in class. Team can be
formed in such a way that in a team both of the students can’t have same parent in tree and should
be at the same level in binary tree.
Input: we have given you some pair of students you need to find that is the team valid or not.
Output: ‘Yes’ if the team is valid or ‘No’ if the team is invalid.
(a) Optimal solution of O(n) for checking the team validity.
(b) How many tree traversal is required for the solution of the above problem.
Marking Scheme: Total 15 marks-> 10 for part (a)( Algorithm explanation + Pseudo-code +
runtime and data structure used)+ 5 for part (b)(explanation is required)

Write a menu driven application to perform the banking operations using JAVA.

Your application must contain the following functionalities. Use constructors, getter

and setter functions wherever required.


 In the menu give options for Account Creation, Balance Enquiry,

Deposit and

Withdrawal

 Do not allow to withdraw money if the balance is &lt; = 500

 Initial balance must be a minimum of 500.


Write a menu driven application to perform the banking operations using JAVA.

Your application must contain the following functionalities. Use constructors, getter

and setter functions wherever required.


 In the menu give options for Account Creation, Balance Enquiry,

Deposit and

Withdrawal

 Do not allow to withdraw money if the balance is < = 500

 Initial balance must be a minimum of 500.


There is a binary tree given to you. In which each of the node represents the student in the class.
You are playing a game in which you need to team up with one of student in class. Team can be
formed in such a way that in a team both of the students can’t have same parent in tree and should
be at the same level in binary tree.
Input: we have given you some pair of students you need to find that is the team valid or not.
Output: ‘Yes’ if the team is valid or ‘No’ if the team is invalid.
(a) Optimal solution of O(n) for checking the team validity.
(b) How many tree traversal is required for the solution of the above problem.
Marking Scheme: Total 15 marks-> 10 for part (a)( Algorithm explanation + Pseudo-code +
runtime and data structure used)+ 5 for part (b)(explanation is required)
x Number of players are participating in a sporting event.They are standing in a row.
Each player has some match value associated with them. Now each player wants to make one
friend on their right side having greater match value as compared to him and it should be the
nearest player as well to him.
Your task is to print for each player their friend’s index and his match value. If a player is not
able to make such a friend print -1.
a) Find an Algorithm of Complexity O(n^2) to solve this problem.
b) Find an efficient way to compute the friends in O(n) Complexity.
Assume 1-based indexing.
LATEST TUTORIALS
APPROVED BY CLIENTS