How could I write a C++ program that would prompt an employee (user) who works in a tickemaster to enter his/her name and then ask for the number of tickets sold for each performer. Then for it to show the name of the employee, amounts in dollars along with the corresponding quantity of tickets sold, and the total income earned.
I would like for it to look somethng like this, that actually works to where the X's are actual numbers. Thank you very much for your time.
Example:
Please enter the name of the employee: Lizardi
Now enter the number of Shakira concert tickets sold: 5
Now enter the number of Paulina Rubio tickets sold: 10
Lizardi has sold:
An amount of: $ X dollars from X number of Shakira tickets sold
An amount of: $ X dollars from the X number of Paulina Rubio tickets sold
Total income: $ X
In C++ Programming...?
Sounds like a homwork assignment to me.
Where will it get the cost of the tickets? Where will it get the names of the tickets available?
Reply:Can you just avoid using cout
but I'm still looking for a solution
I think you have to #include something for that
I'm looking it up now
Did it work????
Also just remember
Cout = Console::WriteLine();
Cin = Console::ReadLine();
etc;
Regarding your last post use only my code exactly.
I've already tested on my computer so it's just a matter of getting typed in cause it's already worked here!
Try this:
Make a copy of the code I wrote.
In C++
Open
(File)
(New Project)
Look around and find (CLR Console Application)
In the the name box AND in the solution name box type a name for your project.
then
Replace All (If any) code thats there with my code
then see if it works
Also, if does please tell me.
The code works fine for me.
On the start menu click on
All Programs
then
Accessories
then
Command Prompt
Thats what a Console program looks like
Are you sure it is a CONSOLE interface? Is it Visual C++ 2005 or an earlier version?
What compiler are you using (Borland,Visual C++, Rhide)??
I can stay online on for about another hour if you need any more help.
I'm writing this for you but what is the price of the tickets???
I'll be done in about 20 minutes max.
Sorry I'm slow at programming in C++.
This is for a CONSOLE application ONLY.
This code was developed using Visual C++ Express Edition.
Note: this was done in good faith that this is not a homework assignment.
Hope This Helps!!!!
Everthing below here is the code.
#include "stdafx.h"
using namespace System;
int main(array%26lt;System::String ^%26gt; ^args)
{
String ^EN,^ST,^PRT;
Double PriceST, PricePRT;
PriceST = 25; // Shakira ticket price
PricePRT = 30; // Paulina Rubio ticket price
Console::WriteLine("Please, enter the name of the employee:");
EN = Console::ReadLine();
Console::WriteLine("Enter the number of Shakira concert tickets sold:");
ST = Console::ReadLine();
Console::WriteLine("Enter the number of Paulina Rubio tickets sold:");
PRT = Console::ReadLine();
Console::WriteLine("");
Console::WriteLine("");
Console::WriteLine(EN + " has sold:");
Console::WriteLine("");
Console::WriteLine("$" + Convert::ToString(Convert::ToDouble(ST) * PriceST) + " dollars worth of Shakira tickets sold");
Console::WriteLine("$" + Convert::ToString(Convert::ToDouble(PRT) * PricePRT) + " dollars worth of Paulina Rubio tickets sold");
Console::WriteLine("Total Amount Sold: $" + Convert::ToString(((Convert::ToDouble (ST) * PriceST)) + (Convert::ToDouble(PRT) * PricePRT)));
Console::ReadLine();
return 0;
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment