this is my assignment
and i also have tried to do this assignment and could not further proceed.
please help.
i will be very glad to here from you.
assignment_2.pdf
assignment2_16273450.txt
this is my assignment
and i also have tried to do this assignment and could not further proceed.
please help.
i will be very glad to here from you.
assignment_2.pdf
assignment2_16273450.txt
/*
Student Name: Bhupendra Valji Patel
Student Number: 16273450
Date & Time: 30th March 2008
File Name: prob1_16273450.ccp
*/
#include <iostream>
#include <cmath>
#include <iomanip>
#include <fstream>
#include <stdio.h>
using namespace std;
int main ()
{
// Declared Variables.
int choice;
ifstream inputFile;
inputFile.open("C:\\temp\\RowPrices.txt");
if (!inputFile)
{
cout << "Error opening file.\n";
}
inputFile.close();
// These are my details.
cout << "******************************************************* \n" << endl;
cout << "Name: Bhupendra Valji Patel\n\n";
cout << "Student number: 16273450\n\n";
cout << "Date: 30/03/08\n\n";
cout << "File name: assignment2_16273450\n\n";
cout << "******************************************************* \n\n" << endl;
// Theses are the 5 choices that are available to the user.
cout << " Program that can be used by a small theatre to sell tickets for performance.\n\n\n ";
cout << " 1. View Available Seats\n ";
cout << " 2. View Seating Prices\n ";
cout << " 3. View Ticket Sales\n ";
cout << " 4. Purchase a Ticket\n ";
cout << " 5. Exit the Program\n ";
cout << " \n Enter your choice (1-5): \n\n";
cin >> choice;
// This will make the executable file background Green with blue font.
system ("COLOR 8");
// This is a while loop which takes care of ivalid inputs.
while ( choice < 1 || choice > 5)
{
cout << " THE CHOICE ENTERED IS INCORRECT. PLEASE ENTER CHOICE FROM 1-5 ONLY!!\n";
cin >> choice;
}
// This is choice one using an if statement.
if( choice ==1 )
{
cout << "\n\t\tSeats";
cout << " \n\t123456789012345678901234567890\n\n";
cout << "Row 1\t##############################\n";
cout << "Row 2\t#############***##############\n";
cout << "Row 3\t###########**###**############\n";
cout << "Row 4\t#########**#######**##########\n";
cout << "Row 5\t########*###########*#########\n";
cout << "Row 6\t########*##*#####*##*#########\n";
cout << "Row 7\t#######*#############*########\n";
cout << "Row 8\t#######*#############*########\n";
cout << "Row 9\t########*###*###*###*#########\n";
cout << "Row 10\t########*####***####*#########\n";
cout << "Row 11\t#########**#######**##########\n";
cout << "Row 12\t###########**###**############\n";
cout << "Row 13\t#############***##############\n";
cout << "Row 14\t##############################\n";
cout << "Row 15\t##############################\n";
cout << "\n\tLegend: * = Sold";
cout << "\n\t\t# = Available\n\n";
}
// This is the choice two using an if statement.
if( choice ==2 )
{
cout << "\nRow 1 = $40\n";
cout << "Row 2 = $40\n";
cout << "Row 3 = $35\n";
cout << "Row 4 = $35\n";
cout << "Row 5 = $30\n";
cout << "Row 6 = $25\n";
cout << "Row 7 = $25\n";
cout << "Row 8 = $10.50\n";
cout << "Row 9 = $10.50\n";
cout << "Row 10 = $10.50\n";
cout << "Row 11 = $10.50\n";
cout << "Row 12 = $10.50\n";
cout << "Row 13 = $10.50\n";
cout << "Row 14 = $10.50\n";
cout << "Row 15 = $10.50\n\n";
ofstream outputFile;
outputFile.open("C:\\temp\\RowPrices.txt");
outputFile << "RowPrices\n";
outputFile << "\nRow 1 = $40\n";
outputFile << "Row 2 = $40\n";
outputFile << "Row 3 = $35\n";
outputFile << "Row 4 = $35\n";
outputFile << "Row 5 = $30\n";
outputFile << "Row 6 = $25\n";
outputFile << "Row 7 = $25\n";
outputFile << "Row 8 = $10.50\n";
outputFile << "Row 9 = $10.50\n";
outputFile << "Row 10 = $10.50\n";
outputFile << "Row 11 = $10.50\n";
outputFile << "Row 12 = $10.50\n";
outputFile << "Row 13 = $10.50\n";
outputFile << "Row 14 = $10.50\n";
outputFile << "Row 15 = $10.50\n\n";
outputFile.close();
}
// This is the choice two using an if statement.
if( choice ==2 )
{
}
// This is the choice three using an if statement.
if( choice ==3 )
{
}
system("pause");
return 0;
} The code posted by is a solid start: there is a menu, a printed seating diagram and an attempt to persist prices. Several things are missing or fragile, though — the program only handles one menu choice and then exits, options for ticket purchase and sales reporting are unimplemented, the seating state is not held in a data structure or saved for next runs, there is a duplicated branch for the same menu choice, and a few system-specific calls and hard-coded file assumptions make the program brittle. was right to ask for specifics; below is a compact plan to finish the assignment and harden the program.
Concrete steps to complete the assignment
Small data-structure sketch and practical tips
const int ROWS = 15;
const int COLS = 30;
double rowPrice[ROWS]; // initialize or load from file
std::vector<std::string> seats; // seats.resize(ROWS); each string is length COLS; '#'=available, '*'=sold Use tidy functions: loadSeats(), saveSeats(), displaySeats(), displayPrices(), purchaseTicket(), salesReport(). Validate every user input (use getline + stoi or clear cin on failure). For file IO, check open() success and, for portability, use relative files in the program folder or prompt for a path. Test edge cases: buying an already-sold seat, out-of-range numbers, and missing or corrupt seat files.
Jump to Post— thekashyap 193If something isn't working and you donno why, please specify. If you donno how to handle some part of the assignment please specify.
We can't do the assignement for you.
If something isn't working and you donno why, please specify. If you donno how to handle some part of the assignment please specify.
We can't do the assignement for you.
/*
Student Name: Bhupendra Valji Patel
Student Number: 16273450
Date & Time: 30th March 2008
File Name: prob1_16273450.ccp
*/
#include <iostream>
#include <cmath>
#include <iomanip>
#include <fstream>
#include <stdio.h>
using namespace std;
int main ()
{
// Declared Variables.
int choice;
ifstream inputFile;
inputFile.open("C:\\temp\\RowPrices.txt");
if (!inputFile)
{
cout << "Error opening file.\n";
}
inputFile.close();
// These are my details.
cout << "******************************************************* \n" << endl;
cout << "Name: Bhupendra Valji Patel\n\n";
cout << "Student number: 16273450\n\n";
cout << "Date: 30/03/08\n\n";
cout << "File name: assignment2_16273450\n\n";
cout << "******************************************************* \n\n" << endl;
// Theses are the 5 choices that are available to the user.
cout << " Program that can be used by a small theatre to sell tickets for performance.\n\n\n ";
cout << " 1. View Available Seats\n ";
cout << " 2. View Seating Prices\n ";
cout << " 3. View Ticket Sales\n ";
cout << " 4. Purchase a Ticket\n ";
cout << " 5. Exit the Program\n ";
cout << " \n Enter your choice (1-5): \n\n";
cin >> choice;
// This will make the executable file background Green with blue font.
system ("COLOR 8");
// This is a while loop which takes care of ivalid inputs.
while ( choice < 1 || choice > 5)
{
cout << " THE CHOICE ENTERED IS INCORRECT. PLEASE ENTER CHOICE FROM 1-5 ONLY!!\n";
cin >> choice;
}
// This is choice one using an if statement.
if( choice ==1 )
{
cout << "\n\t\tSeats";
cout << " \n\t123456789012345678901234567890\n\n";
cout << "Row 1\t##############################\n";
cout << "Row 2\t#############***##############\n";
cout << "Row 3\t###########**###**############\n";
cout << "Row 4\t#########**#######**##########\n";
cout << "Row 5\t########*###########*#########\n";
cout << "Row 6\t########*##*#####*##*#########\n";
cout << "Row 7\t#######*#############*########\n";
cout << "Row 8\t#######*#############*########\n";
cout << "Row 9\t########*###*###*###*#########\n";
cout << "Row 10\t########*####***####*#########\n";
cout << "Row 11\t#########**#######**##########\n";
cout << "Row 12\t###########**###**############\n";
cout << "Row 13\t#############***##############\n";
cout << "Row 14\t##############################\n";
cout << "Row 15\t##############################\n";
cout << "\n\tLegend: * = Sold";
cout << "\n\t\t# = Available\n\n";
}
// This is the choice two using an if statement.
if( choice ==2 )
{
cout << "\nRow 1 = $40\n";
cout << "Row 2 = $40\n";
cout << "Row 3 = $35\n";
cout << "Row 4 = $35\n";
cout << "Row 5 = $30\n";
cout << "Row 6 = $25\n";
cout << "Row 7 = $25\n";
cout << "Row 8 = $10.50\n";
cout << "Row 9 = $10.50\n";
cout << "Row 10 = $10.50\n";
cout << "Row 11 = $10.50\n";
cout << "Row 12 = $10.50\n";
cout << "Row 13 = $10.50\n";
cout << "Row 14 = $10.50\n";
cout << "Row 15 = $10.50\n\n";
ofstream outputFile;
outputFile.open("C:\\temp\\RowPrices.txt");
outputFile << "RowPrices\n";
outputFile << "\nRow 1 = $40\n";
outputFile << "Row 2 = $40\n";
outputFile << "Row 3 = $35\n";
outputFile << "Row 4 = $35\n";
outputFile << "Row 5 = $30\n";
outputFile << "Row 6 = $25\n";
outputFile << "Row 7 = $25\n";
outputFile << "Row 8 = $10.50\n";
outputFile << "Row 9 = $10.50\n";
outputFile << "Row 10 = $10.50\n";
outputFile << "Row 11 = $10.50\n";
outputFile << "Row 12 = $10.50\n";
outputFile << "Row 13 = $10.50\n";
outputFile << "Row 14 = $10.50\n";
outputFile << "Row 15 = $10.50\n\n";
outputFile.close();
}
// This is the choice two using an if statement.
if( choice ==2 )
{
}
// This is the choice three using an if statement.
if( choice ==3 )
{
}
system("pause");
return 0;
} We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.