Computer Science, asked by gulshankumar6134, 2 months ago

Create a class Person with the following private member variables
• String name
char gender
• int age
.
Include appropriate getters and setters method
Create a class Bus Ticket with the following private member variables
• int ticketNo
• float ticketPrice
float totalAmount
• Person person
Include appropriate getters and setters method
Write the following method in the Bus Ticket class
void calculate Total()-this method should calculate the total and set it based on the discount given below:
1. For Children whose age is less than 16, give 50% discount
2. For Senior citizen whose age is greater than or equal to 60 give 25% discount
3. For Ladies give 10% discount
4. No discount for remaining category.
Based on above condition calculate total price.
Create TestMain class which has main method and do following input and output process.
To get i

Answers

Answered by llDivinell
0

Answer:

Create a class Person with the following private member variables

• String name

char gender

• int age

.

Include appropriate getters and setters method

Create a class Bus Ticket with the following private member variables

• int ticketNo

• float ticketPrice

float totalAmount

• Person person

Include appropriate getters and setters method

Write the following method in the Bus Ticket class

void calculate Total()-this method should calculate the total and set it based on the discount given below:

1. For Children whose age is less than 16, give 50% discount

2. For Senior citizen whose age is greater than or equal to 60 give 25% discount

3. For Ladies give 10% discount

4. No discount for remaining category.

Based on above condition calculate total price.

Create TestMain class which has main method and do following input and output process.

To get i

Similar questions