Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1A) Write a program that that display the following pattern. * *** ***** ******* ***** *** * A customer in a store is purchasing five

1A) Write a program that that display the following pattern.

* *** ***** ******* ***** *** *

A customer in a store is purchasing five items. The prices of the five items are:

Price of item 1 = $12.95 Price of item 2 = $24.95 Price of item 3 = $6.95 Price of item 4 = $14.95 Price of item 5 = $3.95

1B) Write a program that holds the prices of the five items in five variables. Display each item's price, the subtotal of the sale, the amount of sales tax, and the total. Assume the sales tax is 6%. See below a sample screen output, after a successful "build and run" using the Code::Block IDE.

Item 1: $12.95 Item 2: $24.95 Item 3: $6.95 Item 4: $14.95 Item 5: $3.95 Subtotal: $63.75 Sales tax: $3.825 Total: $67.575 Process returned 0 (0x0) execution time : 0.050 s Press any key to continue. 

1C) A car with a 20-gallon gas tank averages 21.5 miles per gallon when driven in town and 26.8 miles per gallon when driven on the highway. Write a program that calculates and displays the distance the car can travel on one tank of gas when driven in town and when driven on the highway.

Hint: The following formula can be used to calculate the distance:

Distance=Number of Gallons x Average Miles Per Gallon.

See below a sample screen output, after a successful "compile and run" using the WxDev-C++ IDE.

Town: 430 Highway: 536 Press any key to continue . . . 

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

Inductive Databases And Constraint Based Data Mining

Authors: Saso Dzeroski ,Bart Goethals ,Pance Panov

2010th Edition

1489982175, 978-1489982179

More Books

Students also viewed these Databases questions