Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This program is BROKEN! It contains a number of syntax and logic errors. See if you can find/fix them. //preprocessor directive(s) #include int main(void) //

This program is BROKEN! It contains a number of syntax and logic errors. See if you can find/fix them.

//preprocessor directive(s) #include

int main(void)

// Variable Declarations int seats_avail = 0; tickets_sold = 0; double cost_per_ticket = 0.0, capacity_pct = 0.0, revenue = 0.0;

//Display introduction and instructions to user printf("****************************************************************** "); printf(" This program will calculate the percentage of how close an event "); printf("center is to capacity and how much revenue has been generated. "); printf("It will ask for information from you for the calculation: "); printf("available seats, number of tickets sold at the gate & cost/ticket. "); printf(" ****************************************************************** ");

//Calculate percent of capacity and ticket revenue capacity_pct = (double)tickets_sold / seats_available * 100; tickets_sold * cost_per_ticket = revenue;

//Get input~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Ask for number seats in event center printf(" Enter number of seats in event center: "); // Get seat count from KEYBOARD scanf("%lf", &seats_avail);

// Ask for tickets sold printf(" Enter number of tickets sold: "); // Get number of tickets sold from KEYBOARD scanf("%d", tickets_sold);

// Ask for cost per ticket printf(" Enter cost per ticket: "); // Get ticket cost from KEYBOARD scanf ("%.2lf", &cost_per_ticket);

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //Display a neatly formatted report printf(" "); //a few blank lines to separate user entry & report printf("Results "); printf("------- ------- "); printf("Available seats: %d " ); printf("Tickets sold: %d ", &tickets_sold ); printf(" "); printf("Percent of capacity: %d%% ", capacity_pct ); printf("Cost Per Ticket: ", cost_per_ticket ); printf("Total Ticket Revenue: %lf , revenue" ); printf(" ");

return (0); }

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 Design Application Development And Administration

Authors: Michael V. Mannino

3rd Edition

0071107010, 978-0071107013

More Books

Students also viewed these Databases questions