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]
3 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]3 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
Select all the correct answers.
inysia [295]

Answer:

Buyers can source products from anywhere in the world.

Your purchases are delivered to the location you specify.

Explanation:

E-commerce refers to the process of buying and selling goods and services through the internet or the virtual world. The economic and business transaction done through this process constitutes electronic commerce or e-commerce.

Two advantages for buyers are that the <u>buyer can source the goods and products from all over the world and also get them delivered at the location specified</u>. This allows for an easy and effortless transaction and also saves the buyer's time and energy. With things available at just a touch of an electronic screen, the buyer can get products from anywhere and get them delivered at his/ her doorstep or for that matter, anywhere he/she wished it delivered, with no extra effort from his side.

Thus, the correct answers are the third and fourth options.

4 0
3 years ago
The following is part of a log file taken from the machine on the network with the IP address of 192.168.1.106:__________.
Phantasy [73]

Answer:

Port scan targeting 192.168.1.106.

Explanation:

In the following question, there is some part of the question and options is missing.

In the following statement, when a file log is taken from the computer system which has Internet Protocol address is given in the statement and by the further details of the statement in which time and the port destination by examine those details of the Internet Protocol, the following port scan targeting the IP address 192.168.1.106.

3 0
3 years ago
What legal punishment can people face for plagerism
Maru [420]
They can get a fine.
5 0
3 years ago
Which of the following is a type of intangible business property that is protected by law
xz_007 [3.2K]
Google might be it ok
6 0
3 years ago
Meaningful decisions are important to sustaining immersion, but it’s generally considered poor game design to constantly give th
bezimeni [28]

Answer:

Explanation:

Meaningful decisions are important to sustaining immersion, but it's generally considered poor game design to constantly give the player "critical" decisions. Describe a game you know and how it asks the player to make a variety of decisions from the different levels of Tracy Fullerton's Decision Scale.

7 0
4 years ago
Other questions:
  • Which step of creating a financial budget involves listing the payroll, rental, and utility costs?
    10·2 answers
  • A field whose data type is ____ can store text that can be used as a hyperlink address
    5·1 answer
  • What is a data broker?
    6·1 answer
  • Please help me. i will mark you brailiest
    6·1 answer
  • A computer consists of both software and hardware. a)Define the term software​
    5·1 answer
  • Which of the following will increase the level of security for personal information on a mobile device if the device is lost or
    7·2 answers
  • What is the data type of the following expression?
    12·2 answers
  • How do you put text in MS publisher?<br><br> When do you use text wrapping?
    14·1 answer
  • If your cell phone rings while you are driving and you do not have a hands-free device you should
    9·1 answer
  • a developer manages an application that interacts with amazon rds. after observing slow performance with read queries, the devel
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!