Consider a company that sells trees that are priced by height. Customers have the choice of purchasing a tree on a “cash and carry” basis, of purchasing a tree and have it delivered (delivery service), or of purchasing a tree and having it both delivered and planted (planting service). Of course, the delivery and planting services have an extra cost (and customers do not have to buy them).
We summarize below the pricing information for trees.
Trees whose height is below one meter cost 50.
• Trees whose height is three meters or more cost 299.50.
• Trees whose height is one meter or more but less than two meters cost 109.
• Trees whose height is two meters or more but less than three meters cost 199.
Pricing information for extra services is given below.
Delivery service costs 120 per tree.
• The delivery service has a maximum cost of 600 per order. In other words, if a customer buys more than five trees than she only pays for five trees (5 × 120 = 600).
• Planting services (which also include delivery) cost 50% of the trees’ cost.
Write a program that starts by requesting the number of trees purchased (int), their height (double), and extra services bought (int) and then displays an invoice as shown in the examples below. Assume that all trees purchased in one order have the same height.
Note that when the user is requested for information about the purchase of extra services,
“0” should be entered to indicate that no extra service was purchased;
• “1” should be entered to indicate that delivery service was purchased;
• “2” should be entered to indicate that planting service was purchased.
Your program should validate the purchase information given by the user (for instance, number of trees should not be negative and trees’ height should be a positive number). If the user input is not valid then an error message should be displayed and the program should request the purchase information, again.
Assume that the user always enters numbers as input for the program. Note that the invoice created by your program should contain the same information as in the given examples. All costs in the invoice should be displayed with two digits after the decimal point. Perfect alignment of the different items in the displayed invoice is not a requirement.
DescriptionIn this final assignment, the students will demonstrate their ability to apply two majorconstructs of the C programming language – Fu
Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t
Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th
1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of
1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of