write a java program to accept name of the customer number of days and type of booking(1 for premium and 2 for normal).calculate the total bill amount to be paid by the customer based on following criteria
Answers
Answer:
please go through the above attached link
Explanation:
Hope it works.
Explanation:
Question 1
In a switch case, when the switch value does not respond to any case then the execution transfers to:
a break statement
a default case ✓
a loop
none
Question 2
Which of the following is a compound statement?
p=Integer.parseInt(in.readLine());
c=++a;
if(a>b) a++; b- - ; ✓
a=4;
Question 3
Condition is essentially formed by using:
Arithmetic operators
Relational operators
Logical operators
All ✓
Question 4
If(a>b)&&(a>c)), then which of the statement is true?
b is the smallest number
b is the greatest number
a is the greatest number ✓
all of the above
Question 5
if(a>b)
c=a;
else
c=b;
It can be written as:
c= (b>a)?a:b;
c= (a!=b)?a:b;
c= (a>b)?b:a;
None ✓
Question 6
If a, b and c are the sides of a triangle then which of the following statement is true for: if(a!=b && a!=c && b!=c)?
Equilateral triangle
Scalene triangle ✓
Isosceles triangle
All of the above
Question 7
Two arithmetic expressions can be compared with if statement, using:
Arithmetic operator
Relational operator ✓
Ternary operator
None
Question 8
Which of the following is a conditional statement?
if ✓
goto
for
none
Question 9
Which of the following statements accomplishes 'fall through'?
for statement
switch statement ✓
if-else
none
Question 10
A Java program executes but doesn't give the desired output. It is due to:
the logical error in the program ✓
the syntax error in the program
the run time error in the program
none
Answer the Following Questions
Question 1
Name the different ways to manage the flow of control in a program.
Answer
Normal flow of control, Bi-directional flow of control, Multiple branching of control
Question 2
Mention one statement each to achieve:
(a) Bi-directional flow of control
Answer
if-else statement
(b) Multiple branching of control
Answer
switch statement