A Hotel is giving a several discount on the total amount to be paid by the person staying. The charges for different rooms are given below: The discount will be given as per the following criteria: Category Tariff Semi Deluxe Room Rs 2500 /- per day Deluxe Room Rs 3500 /- per day Super Deluxe Room Rs 5000 /- per day No of Days stayed Discount Upto 3 days 10% More than 3 days and upto 5 days 15% More than 5 days and upto 10 20%
Answers
Answer:
KnowledgeBoat Logo
Computer Applications
A hotel is giving a seasonal discount on the total amount to be paid by the person staying. The charges for different rooms are given below:
Category Tariff
Semi Deluxe Room ₹2500 per day
Deluxe Room ₹3500 per day
Super Deluxe Room ₹5000 per day
The discount will be given as per the following criteria:
No. of days stayed Discount
Up to 3 days 10%
More than 3 days and upto 5 days 15%
More than 5 days and upto 10 days 20%
More than 10 days 30%
Write a program to input name of the guest, category ('S' for Semi-Deluxe, 'D' for Deluxe, 'SD' for Super-Deluxe) and number of days stayed in the hotel. Calculate the discount and total amount to be paid. Print the bill along with the name.
Java
Java Conditional Stmts
ICSE
1 Like
ANSWER
import java.util.Scanner;
public class KboatHotelTariff
{
public static void main(String args[]) {
Scanner in = new Scanner(System.in);
System.out.print("Enter Guest Name: ");
String name = in.nextLine();
System.out.print("Enter category: ");
String cat = in.nextLine();
System.out.print("Enter number of days: ");
int days = in.nextInt();
int dp = 0;
int t = 0;
if (days <= 3)
dp = 10;
else if (days <= 5)
dp = 15;
else if (days <= 10)
dp = 20;
else
dp = 30;
if (cat.equalsIgnoreCase("S"))
t = 2500;
else if (cat.equalsIgnoreCase("D"))
t = 3500;
else if (cat.equalsIgnoreCase("SD"))
t = 5000;
else
System.out.println("Incorrect Room Categoty");
double amt = t * days;
double disc = amt * dp / 100.0;
double netAmt = amt - disc;
System.out.println("Name: " + name);
System.out.println("Total Amount: " + amt);
System.out.println("Discount: " + disc);
System.out.println("Total
Answer:
2500
Explanation:
this is correct answer
make me as brainlest