Please select a subject first
Advertisements
Advertisements
Design a class name ShowRoom with the following description :
Instance variables/ Data members :
String name – To store the name of the customer
long mobno – To store the mobile number of the customer
double cost – To store the cost of the items purchased
double dis – To store the discount amount
double amount – To store the amount to be paid after discount
Member methods: –
ShowRoom() – default constructor to initialize data members
void input() – To input customer name, mobile number, cost
void calculate() – To calculate discount on the cost of purchased items, based on following criteria
| Cost | Discount (in percentage) |
| Less than or equal to ₹ 10000 | 5% |
| More than ₹ 10000 and less than or equal to ₹ 20000 | 10% |
| More than ₹ 20000 and less than or equal to ₹ 35000 | 15% |
| More than ₹ 35000 | 20% |
void display() – To display customer name, mobile number, amount to be paid after discount
Write a main method to create an object of the class and call the above member methods.
Concept: undefined >> undefined
Using the switch-case statement, write a menu driven program to do the following :
(a) To generate and print Letters from A to Z and their Unicode Letters Unicode

(b) Display the following pattern using iteration (looping) statement: 1

Concept: undefined >> undefined
Advertisements
Name the operators listed below are
(i) <
(ii) + +
(iii) &&
(iv) ? :
Concept: undefined >> undefined
Write one difference between / and % operator.
Concept: undefined >> undefined
Give the output of the following program segment and also mention the number of times the loop is executed:
int a,b;
for (a=6, b=4; a< =24; a=a + 6)
{
if (a%b= =0)
break;
}
System, out .println(a);
Concept: undefined >> undefined
Write the output:
charch= ‘F’;
int m= ch;
m=m+5;
System.out.println(m+ ” ” +ch);
Concept: undefined >> undefined
Write a Java expression for the following :
ax5 + bx3 + c
Concept: undefined >> undefined
What is the value of xl if x=5?
x1 = + +x – X+ + + –x
Concept: undefined >> undefined
Why is an object called an instance of a class?
Concept: undefined >> undefined
Name any two OOP’s principles.
Concept: undefined >> undefined
Convert following do-while loop into for loop.
int i = 1;
int d = 5;
do {
d=d*2;
System.out.println(d);
i+ + ; } while (i< =5);
Concept: undefined >> undefined
What are identifiers?
Concept: undefined >> undefined
What are keywords ? Give an example.
Concept: undefined >> undefined
Analyze the given program segment and answer the following questions :
for(int i = 3; i <= 4; i++){
for(int j = 2; j <i; j++){
System.out.print("");
}
System.out.println("WIN");
}
(i) How many times does the inner loop execute ?
(ii) Write the output of the program segment.
Concept: undefined >> undefined
Name any two library packages.
Concept: undefined >> undefined
Name the type of error ( syntax, runtime or logical error) in each case given below:
(i) Math.sqrt (36 – 45)
(ii) int a;b;c;
Concept: undefined >> undefined
What is the difference between the Scanner class functions next () and nextLine()?
Concept: undefined >> undefined
State the difference between == operator and equals () method.
Concept: undefined >> undefined
What is the type of casting shown by the following example:
char c = (char) 120;
Concept: undefined >> undefined
Write a function prototype of the following:
A function PosChar which takes a string argument and a character argument and returns an integer value.
Concept: undefined >> undefined
