Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Part 1: Purchases Write a program named prices.c that repeatedly asks users to enter the price of an item until they enter zero. Prices less

image text in transcribed
image text in transcribed
Part 1: Purchases Write a program named prices.c that repeatedly asks users to enter the price of an item until they enter zero. Prices less than zero will be ignored. The program will then print the number of items purchased, the subtotal of the prices, the sales tax charged (at a rate of 7.5%), and the grand total. Your program must use a while loop or do/while loop. Here is what a sample run of the program might look like. The cursor for user input must appear on the same line as the input prompt. All monetary values must be displayed with two digits to the right of the decimal point. Enterprise, or zero when finished: $14.95 Enteria prace or zero when finished: $10.66 Enter a price or zero when finished: $ 3.50 Negative price ignored Enterprice, or zero when finished: $8.82 Enter a price or zero when finished: $37.00 Enter a price, or zero when finished: se Number of items purchased: 4 Subtotal $71.43 Sales tax 7.5% $5136 Total $76.79 Part 1: Purchases Write a program named prices.c that repeatedly asks users to enter the price of an item until they enter zero. Prices less than zero will be ignored. The program will then print the number of items purchased, the subtotal of the prices, the sales tax charged (at a rate of 7.5%), and the grand total. Your program must use a while loop or do/while loop. Here is what a sample run of the program might look like. The cursor for user input must appear on the same line as the input prompt. All monetary values must be displayed with two digits to the right of the decimal point. Enter a price, or zero when finished: $14.95 Enter a price, or zero when finished: $10.66 Enter a price, or zero when finished: $-3.50 Negative price ignored Enter a price, or zero when finished: $8.82 Enter a price, or zero when finished: $37.00 Enter a price, or zero when finished: $0 Number of items purchased: 4 Subtotal $71.43 Sales tax 7.5% $5.36 Total $76.79

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

Database Basics Computer EngineeringInformation Warehouse Basics From Science

Authors: Odiljon Jakbarov ,Anvarkhan Majidov

1st Edition

620675183X, 978-6206751830

More Books

Students also viewed these Databases questions

Question

convert from c++ to c

Answered: 1 week ago