Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Used c++ to solve Write a program that computes how much a customer has to pay after purchasing two items. The price is calculated according

Used c++ to solve

Write a program that computes how much a customer has to pay after purchasing two items.

The price is calculated according to the following rules: Buy one get one half off promotion: the lower price item is half price. If the customer is a club card member, additional 10% off. Tax is added.

Inputs to the program include: Two items prices Have club card or not (User enters Y or y for yes; N or n for no) Tax rate (User enters the percentage as a number; for example, they enter 8.25 if the tax rate is 8.25%)

Program displays: Base price - the price before the discounts and taxes Price after discounts - the price after the buy one get one half off promotion and the members discount, if applicable Total price the amount of money the customer has to pay (after tax) printed with the precision of 2 decimal digits.

Hint: In order to print a number in a specific precision, you can use the round function passing 2 arguments to it. To format to two decimal places you can use the printf function with the format of 2.2f.

For example, an execution could look like this: Enter price of the first item: 10 Enter price of the second item: 20 Does customer have a club card? (Y/N): y Enter tax rate, e.g. 5.5 for 5.5% tax: 8.25 Base price = 30.00 Price after discounts = 22.50 Total price = 24.36

File Name

cashregister.cpp

Score

There are five tests each worth 2 points

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2015 Porto Portugal September 7 11 2015 Proceedings Part 1 Lnai 9284

Authors: Annalisa Appice ,Pedro Pereira Rodrigues ,Vitor Santos Costa ,Carlos Soares ,Joao Gama ,Alipio Jorge

1st Edition

3319235273, 978-3319235271

More Books

Students also viewed these Databases questions

Question

=+ 39-2 Describe the human sexual response cycle.

Answered: 1 week ago