[SOLVED] CSC150  Assignment 6- Functions & File I/O

35.00 $

Programming resource
Digital learning resource
Category:
Practical programming resource
Suitable for guided study and reference
Tutor guidance available when needed

Description

5/5 - (1 vote)

 

Day Attendance Cost ($)
1 450 24.99
2 120 15.00
8 500 35.75
9 750 7.00
15 425 24.00
16 600 30.50
21 225 25.00
22 150 20.00
23 350 15.00
30 175 12.50
31 275 22.50

▪ Write a program to read the dec_events.txt file and create a report.
▪ Store the report into a file named report.txt.
▪ The report should contain the following data for each event, printed in columns, with column headings:

▪ Below the event table, print the total number of people attending events, the total revenue for the events and the average cost per person.

▪ You should have separate functions to:
o Read a line of data. o Calculate the revenue for an event and return it. o Print one line in the report.
o Print the total attending, total revenue, and average cost per person.
▪ You can put the statements to accumulate the total attendance and total revenue right in main.
▪ Your program should work with files containing fewer or more records (lines) than those shown in the table above.

*** A similar example program, labelled “Student Grades” is posted under Content for Unit 6.

Code your program. Save it in a file named events_xxx.cpp where xxx are your initials.

Compile, run and test your program.

Resource details

Understand the Task Before You Use the Resource

Review the requirements, identify the programming concepts involved, study the implementation and test your understanding with your own examples and modifications.