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
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.
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.