CIS22A-Beginning-of-c-homework

CIS22A-Beginning-of-c-homework | savvyessaywriters.org

Please follow the instruction. Do not write too hard.

The textbook is Staring out with c++ From control structures through objects 8th ed. By Tony Gaddis

Chapter 5: Loops and Files.

Due Nov.04 11:59 pm.


Project C: Calculate the amount a customer should be charged at a gas station

Each customer is identified by his name. This name should appear on the bill. Fees for

the car wash are $4.25 with gasoline purchase of $35.00 or more and $10.00 otherwise.

Three kinds of gasoline are available: regular at 3.39, unleaded at 3.55 and premium at

3.65 per gallon. Input consists of the customer name, number of gallons purchased, kind

of gasoline purchased (R, U, P, or, for no purchase, N), and car wash desired (Y or N).

Read data from a text file named customers.txt.

Use named constants for gasoline prices and car wash fees.

Copy and paste the following data into a new text file: customers.txt

6

Joe Smith

P 10.02 Y

Mary Doe

r 15.50 N

Dan Retter

U 19.00 y

Victoria Beckham

R 6.50 y

Nick Parlante

n 0 Y

Viggo Mortensen

p 18.27 N

The first number represents the number of customers in the file. For each customer there

are two lines in the file. The customer’s name is on the first line. The gas type (R, U, P,

or N), followed by the number of gallons and Y or N for car wash are on the second line.

We assume that the data in the input file has already been validated. // See next page

Display the output as shown below to another text file named gas_bill.txt. Be careful to align the decimal points.

Notice that when the customer chooses not to wash the car, the car wash cost is not

displayed on the bill. If the user chooses gas type: ‘N’, and car wash ‘Y’ then display only

the second part of the bill.

Write to the screen the following: a welcome message, explaining what is the purpose of

the program; the name of the input file; the number of customers and the name of the

output file.

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

* Best Gas and Wash Service Station *

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

Customer: Joe Smith

Gallons purchased: 10.02

Price per gallon : 3.65

Total gasoline cost: 36.57

Car wash cost: 4.25

——

Total due: 40.82

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

* Thank you for stopping! *

* Have a nice day and *

* come again! *

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

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

* Best Gas and Wash Service Station *

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

Customer: Mary Doe

Gallons purchased: 15.50

Price per gallon : 3.39

——

Total due: 52.55

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

* Thank you for stopping! *

* Have a nice day and *

* come again! *

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

 

Do you need a similar assignment done for you from scratch? We have qualified writers to help you. We assure you an A+ quality paper that is free from plagiarism. Order now for an Amazing Discount!
Use Discount Code “Newclient” for a 15% Discount!

NB: We do not resell papers. Upon ordering, we do an original paper exclusively for you.


The post CIS22A-Beginning-of-c-homework appeared first on Affordable Nursing Writers.