Computer Science, asked by rawatharshit9099, 7 months ago

Write a code to enter age of a person and his travelling amount and if he/she is a senior citizen, give a discount of 5% on amount. Display the net amount to be paid by the person on ntxt (if he is not a senior citizen then no discounts will be given and net amount will be same as amount ).​

Answers

Answered by manuprajapati519
1

import java.util.Scanner;

public class main

{

public static void main(String args[])

{

Scanner in = new Scanner(System.in);

double a; int age; double sum;

String name;

System.out.println("Write your name please");

name=in.nextLine();

System.out.println("Write your amount");

a=in.nextInt();

System.out.println("Give your age");

age=in.nextInt();

if(age>60)

{

sum=5%100*a;

System.out.println("Here's your bonus :"+sum);

}

else

{

System.out.println("You will not get bonus :"+a);

}

}

}

Similar questions