Computer Applications
When there is no explicit initialization, what are the default values set for variables in the following cases?
(a) Integer variable
(b) String variable
Related Questions
Name any two jump statements.
Predict the output of the following code snippet:
String a = "20"; String b = "23"; int p = Integer.parseInt(a); int q = Integer.parseInt(b); System.out.print(a + "*" + b);
int P[ ] = {12, 14, 16, 18};
int Q[ ] = {20, 22, 24};Place all elements of P array and Q array in the array R one after the other.
(a) What will be the size of array R[ ] ?
(b) Write index position of first and last element?
Define a class called with the following specifications:
Class name: Eshop
Member variables:
String name: name of the item purchased
double price: Price of the item purchasedMember methods:
void accept(): Accept the name and the price of the item using the methods of Scanner class.
void calculate(): To calculate the net amount to be paid by a customer, based on the following criteria:Price Discount 1000 – 25000 5.0% 25001 – 57000 7.5 % 57001 – 100000 10.0% More than 100000 15.0 % void display(): To display the name of the item and the net amount to be paid.
Write the main method to create an object and call the above methods.