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
Is orgenized maningful and useful data​
Eduardwww [97]

Answer:

Organized meaningful data is called information. Information that is useful to one person is not necessarily useful to another person

Explanation:

7 0
3 years ago
What variation of a dictionary attack involves a dictionary attack combined with a brute force attack, and will slightly alter d
Galina-37 [17]

Answer:

D) Hybrid Attack

Explanation:

This type of  attack is a blend of both a dictionary and brute force attack. The meaning of this is, while a dictionary attack method would capture a wordlist of passwords, the brute-force attack would be applied to each of  password captured.

6 0
2 years ago
Select the correct answer.
Juliette [100K]

Answer:

COMPRESS, THIS WILL MAKE IT INTO A ZIP

Explanation:

3 0
3 years ago
Which of the following statements about the OSI is FALSE?A. The OSI model encourages modular design in networking.B. Each protoc
Afina-wow [57]

Answer:

The correct answer to the following question will be Option B.

Explanation:

<u>Open System interconnection:</u>

  • A practical and conceptual layout that describes network communication that will be used by the systems that are accessible to interconnection as well as other systems, is called the OSI model. This may also be referred to as the OSI model with seven layers.
  • The OSI model aims to direct developers and creators so that they would modularize with the wireless communication devices and computer programs they build, and to promote a consistent structure that defines the features of a network or telecom system.

Therefore, Option B is the right answer.

8 0
3 years ago
Calculate the resistance of an unknown resistor in a circuit with 30 volts and 6 amps. The formula is R = V/I.
arsen [322]
The answer is 5 ohms
7 0
2 years ago
Other questions:
  • 5. Tricks of the language commercials use are called Rhetorical Devices?
    9·1 answer
  • David uses Office Excel 2013 to calculate his average marks. He enters a formula in cell B5 to calculate the average based on th
    11·1 answer
  • Suppose you're currently completing an examination online. When you're finished, you click on Reset Exam. Why would you do this?
    8·1 answer
  • Darcy was working on a presentation on playing chess. Because she chose the Checkerboard animation for her slide title, she had
    15·2 answers
  • High level language - An object oriented programming language​
    5·1 answer
  • A desktop computer is a type of mobile device.<br><br> a. true<br> b. false
    5·1 answer
  • Microsoft Word, Google Chrome, and Windows Media Player are examples of
    15·1 answer
  • Brianna is taking a backpacking trip in the wilderness and wants to back up the photos from her camera. Which type of storage de
    10·1 answer
  • John has recently retired from an administrative, yet technical job which he held for 40 years. He decided to pursue a life-long
    11·1 answer
  • the first thing to do when your computer gives you an error message is A restart the computer B press the F2 key C write down th
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!