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
A cloud data storage company develops a proprietary system of hardware and software, trains its systems analysts on the technolo
cupoosta [38]

Answer:

Creating Strategic Fit

Explanation:

Strategic fit expresses the degree to which an organization is matching its resources and capabilities with the opportunities in the external environment. The matching takes place through strategy and it is therefore vital that the company has the actual resources and capabilities to execute and support the strategy. Strategic fit can be used actively to evaluate the current strategic situation of a company as well as opportunities such as M&A and divestitures of organizational divisions.

7 0
3 years ago
The _____________ controls the internal operations of the computer's hardware, manages all of the devices connected to the compu
Nitella [24]

Answer:

The System Software (Operating System)

Explanation:

Examples of Operating Systems are Windows, MAC and Linux, these software are the foundation of every PC and manages all computer's resources

6 0
3 years ago
Which of the following options correctly represent a formula with Absolute References?
lakkis [162]
The answer is D =(<span>$A$1-$B$1) 

sources:just took the test</span>
3 0
3 years ago
Read 2 more answers
Consider the following code:
aalyn [17]

Explanation:

I think the output is 6

am not sure tho hope my answr helps

7 0
3 years ago
Utility software is also known as _____​
stiks02 [169]

Answer:

Utility programs

7 0
4 years ago
Other questions:
  • What is the benefit to having the user interface integrated into the operating system? a) Power users prefer the added flexibili
    13·1 answer
  • _____ is the standard that enables wireless devices to access web-based information and services. world wide web tcp/ip ethernet
    5·1 answer
  • Why is it important to use the binomial nomenclature system?
    6·1 answer
  • When connecting past and present issues, it is best to follow a series of steps. Which step is missing from the pattern? 1. Iden
    13·1 answer
  • Submitting a cover letter and resume is a step in the process of applying for a job.
    14·1 answer
  • Write a test program that prompts the user to enter three sides of the triangle (make sure they define an actual triangle), a co
    5·1 answer
  • The type of line shown below represents an / a:​
    11·1 answer
  • Order the steps for changing the settings of an outlook data file
    10·1 answer
  • Anyone wanna talk im 13 eboy single
    11·2 answers
  • Which of the following is one of the tools used by a Python IDE that helps prevent syntax errors?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!