Advanced Programming

The Saud Bahwan Automotive LLC in Sultanate of Oman has partnered with Toyota to make it one of the most loved brands in the country. This company is planning to offer certain promotions for Omani as well as expat female nationals. The promotions include discounts for females only and is offered on purchase of a particular vehicle.

If the Buyer is a female and aged between 25 and 35 discount of 15% will be offered on the overall cost of the particular vehicle. If the Buyer is a female and aged between 36 and 45 discount of 10% will be offered on the overall cost of the particular vehicle. If the Buyer is above 45 years of age a discount of 5% on the overall cost is offered.

Write a program for the company above using socket programming (graphical user interface is not required) to calculate the final cost of the vehicle after discount for different types of Buyers.

On the client side, allow the user to enter the gender, age, and the price of the vehicle. The client will then forward the age of the Buyer to the server. The promotion offered is only for females hence the client will forward details only of female buyers.

Upon receiving the age of the buyer and the total cost of the vehicle, the server will determine which discount option to use, calculate the final price after discount, and then send the final cost and the discount given back to the buyer back to the client. Upon receiving the final cost and the discount rate used, the client should display them.

Sample Solution