Earn Higher Grades With Instant Assignment Help.Ask Question!

C++ Programming
(5/5)

Write a program that starts by requesting the number of trees purchased (int), their height (double), and extra services bought (int).

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

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.

Attachments:
(5/5)

Related Questions

CSI 1420 Introduction to C Programming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C

DescriptionIn this final assignment, the students will demonstrate their ability to apply two majorconstructs of the C programming language – Fu

The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an

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. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual

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

SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

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

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 Sea Ports. Here are the classes and their instance variables we wish to define:

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

Ask This Assignment To Be Done By Our ExpertsGet A+ Grade Solution Guaranteed

expert
joyComputer science
(4/5)
12 Answers Hire Me
expert
Robert DLaw
(4.8/5)
968 Answers Hire Me
expert
Dr Samuel BarberaStatistics
(5/5)
542 Answers Hire Me
expert
Tutor For YouEconomics
(5/5)
839 Answers Hire Me