Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program, eventsfunc.c, which uses two functions readvalues() and revenue() to find the total hall revenue, as well as the id numbers associated with

Write a program, eventsfunc.c, which uses two functions readvalues() and revenue() to find the total hall revenue, as well as the id numbers associated with the most attended and most profitable events from the data stored in events.txt. You can assume that the number of values in the input file is less than 100.

Your main must use the following steps:

open the two files events.txt and events.out.

call the function readvalues() which reads the values from events.txt into the arrays ID, tickets and tprice and returns the value of n (number of values in the file).

call the function revenue() which computes the total hall revenue from values found in the array using the same formula as Assignment 3 Question 5. The function should also return the id numbers of the most profitable and most attended events.

write the number of events examined, the total revenue, and the determined id numbers to the file events.out

Your output file should look like:

Number of events reviewed:6

Hall Revenue: $12801.34

Most profitable event this quarter had id: 504

Most attended event this quarter had id: 402

/* File: eventsfunc.c

Three sets of values are read from a file into corresponding arrays using the funtion readvalues().

The function revenue() is called to compute the hall revenue and determine the most profitable, and the most attended events.

#include

#define MAXN 100

events.txt:

401 486 42.95 402 653 0.00 403 250 24.95 404 167 19.95 405 345 84.85 501 607 31.45 502 218 54.95 601 145 65.85 602 283 10.90 603 762 5.00 604 375 34.45 605 427 29.95 606 352 12.89

Please I ask of you kindly, to not use strings, cout cin and fp instead of printf, scanf and FILE *fin or four = fopen("");

Thank you

ASSIGNMENT 3 Q5:

5. The file events.txt contains a series of lines each giving the identification number, quantity of tickets sold, and ticket price for events held at a small concert hall during a yearly quarter (three month period). For each event the operators of the concert hall charge the event the greater of $1400.00 or 9% of the box office (ticket) revenue to rent the space. Write a program events.c which reads the identification numbers, quantities of tickets sold, and ticket prices from the input file, events.txt, and computes the total revenue for the hall during the quarter, as well as the total number of events held that quarter.

The program should also determine the identification number of the most profitable event (for the hall) and the identification number of the event with the most attendance.

Your output should look similar to:

Number of events reviewed: 4

Hall Revenue: $7313.23

Most profitable event this quarter had id: 404

Most attended event this quarter had id: 402

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

More Books

Students also viewed these Databases questions

Question

3. Design a program for preparing for cross-cultural assignments.

Answered: 1 week ago