1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
lutik1710 [3]
4 years ago
6

The manager of a football stadium wants you to write a program that calculates the total ticket sales after each game. There are

four types of tickets—box, sideline, premium, and general admission. After each game, data is stored in a file in the following form:
ticketPrice numberOfTicketsSold
...
Sample data are shown below:
250 5750
100 28000
50 35750
25 18750

The first line indicates that the ticket price is $250 and that 5750 tickets were sold at that price. Output the total number of tickets sold and the total sale amount into an output file. Format your output with two decimal places. (You are required to generate an output file that has the results.)

So far my answer is

#include

#include

#include

using namespace std;

int main() {

double total = 0;

int nTickets = 0;

std::ifstream infile("tickets.txt");

int a, b;

while (infile >> a >> b)

{

total = a*b;

nTickets = nTickets + b;

}

cout << "Total Sale amount: " << total << endl;

cout << "Number of tickets sold: " << setprecision(2) << nTickets << endl;

system("pause");

return 0;

}
Computers and Technology
1 answer:
vazorg [7]4 years ago
4 0

<u>Answer:</u>

The following will be used:

#include <iostream>

#include <fstream>

#include <iomanip>

using namespace std;

int main() {

  double total = 0;

  int nTickets = 0;

  ifstream infile("tickets.txt");

  ofstream outfile("output.txt");

  int a,b;

  while (infile >> a >> b)

  {

      total += a*b;

      nTickets = nTickets + b;

  }

  outfile << "Total Sale amount: " << setprecision(2) << total << endl;

  outfile << "Number of tickets sold: " << nTickets << endl;

  outfile.close();

  cout<<"See output file: output.txt for the results."<<endl;

  return 0;

}

You might be interested in
In the ____ category, the cloud service provider offers the capability to build and deploy consumer-created applications using t
Nikolay [14]

Answer:

Platform as a Service (PaaS)

Explanation:

In cloud computing, PaaS called platform as a service refers to the provision of a computing platform for developers to create their own custom application. Other two categories of cloud computing are IaaS (Infrastructure as a service) and SaaS (Software as a Service). In the PaaS the servers, cloud storage and network  are automatically handled by the platform only the software and application code are to be managed.

7 0
3 years ago
.What particular skills does a team leader need in addition to the other skills needed by any team member. (choose all that appl
omeli [17]

Answer:

encourage and support team members

always keep a vision of the “big picture”

communicate frequently with team members

Explanation:

As a team leader, this is important to motivate and encourage team members to move on are especially needed during the hard time to face some challenges or solving some problems.

Besides, a vision of big picture from the team leader will assure the entire team that they are moving in a right direction to achieve a bigger goal despite they are facing a number of challenges/obstacle.

A team work need frequent communication to minimize misunderstanding and to ensure the job allocation and coordination running smooth as expected. A team leader plays the vital role to be proactive in communication with members to make sure every job arrangement are monitored and on track.

6 0
3 years ago
What does the merge &amp; center button in the alignment group on the home tab do?
e-lub [12.9K]
A merge and center does this;
if you have created a table,it just centers a sentance
6 0
3 years ago
Most people have unexpected expenses at some time. Yes. No.
VladimirAG [237]

Answer:

Yes

Explanation:

8 0
3 years ago
The New option is found in the ...............tab.​
morpeh [17]

in your notes books and in your vopy

3 0
3 years ago
Read 2 more answers
Other questions:
  • GIMP's official website is _____
    6·1 answer
  • Is using abbreviations and symbols in social media a problem? Why or why not?
    11·1 answer
  • You can add a new slide to a presentation by
    11·1 answer
  • अस्स्मन्चचरे ------------------- दृश्यते |
    8·1 answer
  • ―Connectivity is Productivity‖- Explain the statements.
    8·1 answer
  • What are some other features of sending attachments in Outlook 2016? Check all that apply.
    9·2 answers
  • Does anyone know how to do Python Essentials 5.7.1.6 because i am completely lost
    5·1 answer
  • Output is the act of is the act of entering the data to the computer?​
    10·1 answer
  • (I'm confused, might as well ask for help)
    8·2 answers
  • Trying to make the baseplate red and turn off can collide then the game waits 5 seconds and turns on can collide, making the bas
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!