logo Use SA10RAM to get 10%* Discount.
Order Now logo

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Dan CurnowwComputer science
(5/5)

941 Answers

Hire Me
expert
MAHIMAStatistics
(/5)

980 Answers

Hire Me
expert
Jacobs WilkinsTechnical writing
(5/5)

588 Answers

Hire Me
expert
Santosh DevgodaMathematics
(5/5)

800 Answers

Hire Me
C++ Programming

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.

Related Questions

. The fundamental operations of create, read, update, and delete (CRUD) in either Python or Java

CS 340 Milestone One Guidelines and Rubric  Overview: For this assignment, you will implement the fundamental operations of create, read, update,

. 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

Retail Transaction Programming Project  Project Requirements:  Develop a program to emulate a purchase transaction at a retail store. This

. The following program contains five errors. Identify the errors and fix them

7COM1028   Secure Systems Programming   Referral Coursework: Secure

. Accepts the following from a user: Item Name Item Quantity Item Price Allows the user to create a file to store the sales receipt contents

Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip

. The final project will encompass developing a web service using a software stack and implementing an industry-standard interface. Regardless of whether you choose to pursue application development goals as a pure developer or as a software engineer

CS 340 Final Project Guidelines and Rubric  Overview The final project will encompass developing a web service using a software stack and impleme

Get Free Quote!

323 Experts Online