Please select a subject first
Advertisements
Advertisements
The Scanner class method used to accept words with space:
Concept: Introduction of Input in Java
Missing a semicolon in a statement is what type of error?
Concept: Types of Errors
DTDC, a courier company, charges for the courier based on the weight of the parcel. Define a class with the following specifications:
| class name: | courier | |
| Member variables: | name - name of the customer | |
| weight - weight of the parcel in kilograms | ||
| address - address of the recipient | ||
| bill - amount to be paid | ||
| type - 'D'- domestic, 'I'- international | ||
| Member methods: | ||
| void accept ( )- | to accept the details using the methods of the Scanner class only. | |
| void calculate ( )- | to calculate the bill as per the following criteria: | |
| Weight in Kgs | Rate per Kg | |
| First 5 Kgs | Rs.800 | |
| Next 5 Kgs | Rs.700 | |
| Above 10 Kgs | Rs.500 | |
| An additional amount of Rs.1500 is charged if the type of the courier is I (International) | ||
| void print )- | To print the details | |
| void main ()- | to create an object of the class and invoke the methods | |
Concept: Using Function Argument
Define a class to accept a number from user and check if it is an EvenPal number or not. (The number is said to be EvenPal number when number is palindrome number (a number is palindrome if it is equal to its reverse) and sum of its digits is an even number.)
Example: 121 - is a palindrome number
Sum of the digits - 1 + 2 + 1 = 4 which is an even number
Concept: Using Function Argument
Define a class to accept values into an integer array of order 4 x 4 and check whether it is a DIAGONAL array or not An array is DIAGONAL if the sum of the left diagonal elements equals the sum of the right diagonal elements. Print the appropriate message.
Example:
3 4 2 5 Sum of the left diagonal elements =
2 5 2 3 3 + 5 + 2 + 1 = 11
5 3 2 7 Sum of the right diagonal elements =
1 3 7 1 5 + 2 + 3 + 1 = 11
Concept: Using Function Argument
Define a class to accept the gmail id and check for its validity.
A gmail id is valid only if it has:
→ @
→ . (dot)
→ gmail
→ com
Example: [email protected] is a valid gmail id.
Concept: Using Function Argument
Name the keyword which: indicates that a method has no return type.
Concept: Introduction to Object Oriented Programming (OOP)
Name the keyword which: makes the variable as a class variable.
Concept: Introduction to Object Oriented Programming (OOP)
Evaluate the following expression if the value of x = 2,y = 3 and z = 1.
v = x + – z + y + + + y.
Concept: Introduction to Object Oriented Programming (OOP)
Identify the literal given below:
0.5
Concept: Different Types of Methods
What are the values stored in variables r1 and r2:
(i) double r1=Math.abs(Math.min(-2.83,-5.83));
(ii) double r2=Math.sqrt(Math.floor(16.3));
Concept: Different Types of Methods
Name any two library packages.
Concept: Introduction of Mathematical Library Methods
What is the difference between the Scanner class functions next () and nextLine()?
Concept: Introduction to Object Oriented Programming (OOP)
Give the output of the following Math functions:
(i) Math.ceil(4.2)
(ii) Math.abs(-4)
Concept: Introduction of Mathematical Library Methods
System.out.print("BEST ");
System.out.println("OF LUCK");
Choose the correct option for the output of the above statements.
Concept: Introduction to Object Oriented Programming (OOP)
Write the return type of the following library functions:
- isLetterOrDigit(char)
- replace(char, char)
Concept: Introduction of Mathematical Library Methods
Give the output of the following :
(i) Math.floor (- 4.7)
(ii) Math.ceil(3.4) + Math.pow(2,3)
Concept: Introduction of Mathematical Library Methods
Name the mathematical function which is used to find sine of an angle given in radians.
Concept: Introduction of Mathematical Library Methods
Name a string function which removes the blank spaces provided in the prefix and suffix of a string.
Concept: Introduction of Mathematical Library Methods
Define a class named ParkingLot with the following description :
Instance variables/data members:
int vno — To store the vehicle number
int hours — To store the number of hours the vehicle is parked in the parking lot
double bill — Tb store the bill amount
Member methods:
void input( ) — To input and store the vno and hours.
void calculate( ) — To compute the parking charge at the rate of Rs.3 for the first hours or part thereof, and Rs. 1.50 for each additional hour or part thereof.
void display ( ) — To display the detail
Write a main method to create an object of the class and call the above methods.
Concept: Different Types of Methods
