So I am having trouble writing this in Visual Studio as a console application (C++),
So I am having trouble writing this in Visual Studio as a console application (C++), here is what I tried running
but it’s not working for me. Could someone help me? my code:
// ConsoleApplication3.cpp : Defines the entry point for the console application.
// —————————————————————
// Programming Assignment: LAB1C
// Developer: _____Mark Baker____________
// Date Written: ______03/10/2018___________
// Purpose: Ticket sales at movie theater
//use fixed and setprecision(2) to format the number
//use setw(8) to control the width of the field
//use t to control the spacing between fields
// —————————————————————
#include “stdafx.h”
#include <iomanip>
#include <iostream>
using namespace std;
int main()
{
double totalAdult, totalChild, grossProfit, netProfit, distributorAmt;
int adultTkts, childTkts;
cout << “Please enter number of child tickets: “;
cin >> childTkts;
cout << “Please enter number of adult tickets: “;
cin >> adultTkts;
cout << totalChild = (6 * childTkts);
cin >> totalAdult = (10 * adultTkts);
cout << grossProfit = totalAdult + totalChild;
cin >> netProfit = (grossProfit * 0.2);
cout << distributorAmt = grossProfit – netProfit;
cout << Output = grossProfit;
cout << Output = netProfit;
cin >> Output = distributorAmt;
cout << fixed << setprecision(2);
cout << “Gross Profit :t $” << setw(8) << grossProfit << endl;
}
Write a program that calculates and displays the revenue earned from ticket sales at a movie theater.
Input: Prompt the user for the number of adult tickets. Prompt the user for the number of child tickets.
Process: Perform the calculations. The adult tickets cost $10.00 and the child tickets cost $6.00. The theater keeps 20% of the gross box office profit, and the rest goes to the movie distributor.
Output: Display the results.
Sample Output from Lab 1:
Pseudo Code:
1. Declare variables
2. Accept Input – child tickets and adult tickets
3. Calculate Child ticket total = child tickets* 6
4. Calculate adult ticket total = adult tickets * 10
5. Calculate gross profit = child ticket total + adult ticket total
6. Calculate net profit = gross profit *0.2
7. Calculate distributor amount = gross profit – net profit
8. Display the following on separate lines and format variables with $ and decimal.
a. Gross Profit value of gross profit
b. Net Profit value of net profit
c. Distributor Amount value of distributor amount
//include the iomanip header file at the top of the file
#include <iomanip>
//use fixed and setprecision(2) to format the number
//use setw(8) to control the width of the field
//use t to control the spacing between fields
cout << fixed << setprecision(2);
cout << “Gross Profit :t $” << setw(8) << grossProfit << endl;