| | |
my assgment-- animal show ticketing system
Please support our C++ advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Aug 2009
Posts: 14
Reputation:
Solved Threads: 0
hello
im doing this assgment.need a solution urgently! Animal Show is organized.
There are 2 sessions for the show, which are 2pm-4pm and 8pm-10pm per day.
There are only 50 tickets available per session per day.
For the show, a ticket for an adult sells for RM10 while for a child of below 12 years of age, the ticket sells for RM5.
When a customer buys a ticket, the cashier would key in the number of adults and number of children. The system would then calculate the total amount to be paid. The system would then print the details and total of the purchase on the screen.
If the total of tickets for a session has reached the capacity (50 tickets), the program would print a warning to the cashier. Your program should be able to print the total amount of sales at the end of the day as a sales report.
these are the things in the coding.The problem is how write the codes using all functions such as if else statements,switch and ext.. I'm new to C++. Can you please guide me a solution?? Currently,im using dev c++ platform. Thanks a lot. Eager to hear from your side. It will be useful in my studies.
im doing this assgment.need a solution urgently! Animal Show is organized.
There are 2 sessions for the show, which are 2pm-4pm and 8pm-10pm per day.
There are only 50 tickets available per session per day.
For the show, a ticket for an adult sells for RM10 while for a child of below 12 years of age, the ticket sells for RM5.
When a customer buys a ticket, the cashier would key in the number of adults and number of children. The system would then calculate the total amount to be paid. The system would then print the details and total of the purchase on the screen.
If the total of tickets for a session has reached the capacity (50 tickets), the program would print a warning to the cashier. Your program should be able to print the total amount of sales at the end of the day as a sales report.
these are the things in the coding.The problem is how write the codes using all functions such as if else statements,switch and ext.. I'm new to C++. Can you please guide me a solution?? Currently,im using dev c++ platform. Thanks a lot. Eager to hear from your side. It will be useful in my studies.
>The problem is how write the codes using all functions such as if else statements,switch and ext..
You need to learn the basics befor you can do this problem.
You need to learn the basics befor you can do this problem.
"Sometimes, when I lie in bed at night and look up at the stars, I think to myself, "Man! I really need to fix that roof."-Jack Handy
•
•
Join Date: May 2009
Posts: 12
Reputation:
Solved Threads: 0
Yes, you need to learn the basics first, if you need a quick fix with a few hours to spare to learn. Go on Youtube and search 'thenewboston' and click on his channel and then on the playlist of C++ videos, pretty much straight to the point, with the basics of if functions, else if, structures, user input and output, functions. He is great but video tutorials cannot always explain anything so don't use this long term.
For long term put C++ Tutorial (1) - Absolute n00b spoonfeed into the search field, he isn't English but is brilliant for understanding extras and underlying sciences of it. He has 70 videos times ten mins.
Use thenewboston for quick fixes.
For long term put C++ Tutorial (1) - Absolute n00b spoonfeed into the search field, he isn't English but is brilliant for understanding extras and underlying sciences of it. He has 70 videos times ten mins.
Use thenewboston for quick fixes.
•
•
Join Date: Aug 2009
Posts: 14
Reputation:
Solved Threads: 0
i do have basic. but,in a problem solving kind of assgm,im blur! i have started it,it doesnt display n has error.. this is my example... would u mind checking ?! thanks..
C++ Syntax (Toggle Plain Text)
#include <iostream> using namespace std; int main() { int adults; int children; int total_amount; cout<<"Press return after entering a number .\n"; cout<<"Enter the number of adults :\n"; cin>>adults; cout<<"Enter the number of children :\n"; cin>>children; { if (adults + children > 50); "warning to cashier\n"; total_amount = (adults * 10) + (children * 5) cout<<"There are seats available. \n"; else total_amount = (adults * 10) + (children * 5) cout<<"It's full,please come again next time! \n"; } cout<<" Animal Show in Zoo Melaka says that "; cout<<adults; cout<<"number of adults \n"; cout<< "and "; cout<<children; cout<<"number of children, then \n"; cout<< "The total amount that you have to pay is RM "; cout<<total_amount; system ("pause"); return 0; }
Last edited by John A; Aug 6th, 2009 at 9:25 pm. Reason: added code tags
Put your code in code tags: [code=cplusplus]<code here> [/code]
Judging from your code:
You don't know your basics well.
If statements:
and check this line again: "warning to cashier\n"; Your forgetting something.
Judging from your code:
C++ Syntax (Toggle Plain Text)
{ if (adults + children > 50); "warning to cashier\n"; total_amount = (adults * 10) + (children * 5) cout<<"There are seats available. \n"; else total_amount = (adults * 10) + (children * 5) cout<<"It's full,please come again next time! \n"; }
If statements:
C++ Syntax (Toggle Plain Text)
if(condition) { //code here } else { //code here }
Last edited by Hiroshe; Aug 6th, 2009 at 11:06 am.
"Sometimes, when I lie in bed at night and look up at the stars, I think to myself, "Man! I really need to fix that roof."-Jack Handy
•
•
Join Date: Aug 2009
Posts: 14
Reputation:
Solved Threads: 0
if (adults + children < 50)
{
cout<<"warning to cashier \n";
total_amount = (adults * 10) + (children * 5);
cout<<"There are seats available. \n";
}
else if (adults + children > 50)
{
total_amount = (adults * 10) + (children * 5);
cout<<"It's full,please come again next time! \n";
}
these are my if else statement. it's not functioning whenever i put the value big.the cout is not displaying either and also the condition.. how can i correct it? im confused!
{
cout<<"warning to cashier \n";
total_amount = (adults * 10) + (children * 5);
cout<<"There are seats available. \n";
}
else if (adults + children > 50)
{
total_amount = (adults * 10) + (children * 5);
cout<<"It's full,please come again next time! \n";
}
these are my if else statement. it's not functioning whenever i put the value big.the cout is not displaying either and also the condition.. how can i correct it? im confused!
C++ Syntax (Toggle Plain Text)
#include <iostream> using namespace std; int main() { int adults; int children; int total_amount; cout<<"Press return after entering a number .\n"; cout<<"Enter the number of adults :\n"; cin>>adults; cout<<"Enter the number of children :\n"; cin>>children; { if (adults + children > 50); "warning to cashier\n"; total_amount = (adults * 10) + (children * 5) cout<<"There are seats available. \n"; else total_amount = (adults * 10) + (children * 5) cout<<"It's full,please come again next time! \n"; } cout<<" Animal Show in Zoo Melaka says that "; cout<<adults; cout<<"number of adults \n"; cout<< "and "; cout<<children; cout<<"number of children, then \n"; cout<< "The total amount that you have to pay is RM "; cout<<total_amount; system ("pause"); return 0;
I'm still new at coding as well, but it seems to me like the first thing you're going to want to do is place the recurring portions of your program that don't have a set number of times to run (i.e. asking for number of adults, asking for number of children, etc...) in a while loop and then add them for a total. For example:
C++ Syntax (Toggle Plain Text)
int adults; int children; int totalAdults=0; int totalChildren=0; while(totalAdults + totalChildren < 50) { cout << "How many adults: \n" cin >> adults; totalAdults += adults; cout << "How many children: \n" cin >> children; totalChildren += children; }
C++ Syntax (Toggle Plain Text)
if(totalAdults + TotalChildren == 50) { cout << "You have sold out this show \n" << endl; }
C++ Syntax (Toggle Plain Text)
if(totalAdults + totalChildren > 50) { cout << "You have entered more ticktes than you have to sell. \n" << "Please enter less tickets. \n" << endl; }
C++ Syntax (Toggle Plain Text)
cout << "To finish entering sales, enter 0 for both children and adults" << endl; if(adults == 0 && children == 0) { break; }
I hope this helps to set you on the right track.
-D
Last edited by dgr231; Aug 6th, 2009 at 12:24 pm.
•
•
Join Date: Aug 2009
Posts: 14
Reputation:
Solved Threads: 0
thank you. it really helps. any suggestion on how to insert time slots. my codes are halfway done but incorrect i guess,, guide me in that. i appreciate it.
#include <iostream>
using namespace std;
int main()
{
int x=1;
int y=2;
int response;
cout<<"there are two sessions per day"<<endl;
cout<<"please type 1 for 2pm-4pm session"<<endl;
cout<<"or"<<endl;
cout<<"please type 2 for 8pm-10pm session"<<endl;
cin>>response;
#include <iostream>
using namespace std;
int main()
{
int x=1;
int y=2;
int response;
cout<<"there are two sessions per day"<<endl;
cout<<"please type 1 for 2pm-4pm session"<<endl;
cout<<"or"<<endl;
cout<<"please type 2 for 8pm-10pm session"<<endl;
cin>>response;
•
•
•
•
thank you. it really helps. any suggestion on how to insert time slots. my codes are halfway done but incorrect i guess,, guide me in that. i appreciate it.
#include <iostream>
using namespace std;
int main()
{
int x=1;
int y=2;
int response;
cout<<"there are two sessions per day"<<endl;
cout<<"please type 1 for 2pm-4pm session"<<endl;
cout<<"or"<<endl;
cout<<"please type 2 for 8pm-10pm session"<<endl;
cin>>response;
C++ Syntax (Toggle Plain Text)
int response cout << "There are two sessions per day. \n" << "Please type 1 for the 2pm-4pm session \n" << "or \n" << "Please type 2 for the 8pm-10pm session:" << endl; cin >> response; if(response == 1) { //run your code for the first session } else if(response == 2) { //run your code for the second session }
-D
![]() |
Similar Threads
- Disable System Beep In Windows Vista (Windows tips 'n' tweaks)
- System stated overflow. (Visual Basic 4 / 5 / 6)
- this->form2instance.Show(); (C++)
- Writing to an Access Database (Visual Basic 4 / 5 / 6)
- Help (Java)
- StackInheritance and System.Collections class (C#)
- Replacing system("pause"); with a function (C++)
- Help for Air Lines Reservition System (C)
- IE6 has been constantly hijacked by .... (Viruses, Spyware and other Nasties)
Other Threads in the C++ Forum
- Previous Thread: List of Command
- Next Thread: Hardware Information by Turbo C
Views: 1376 | Replies: 26
| Thread Tools | Search this Thread |
Tag cloud for C++
6 add api array arrays beginner binary c++ c/c++ calculator char class classes code compile compiler console conversion convert count data delete desktop directshow dll download dynamic encryption error file forms fstream function functions game givemetehcodez google graph gui iamthwee ifstream input int integer java lib library linkedlist linker linux loop looping loops map math matrix memory microsoft newbie news number output parameter pointer problem program programming project python random read recursion recursive reference return sort stream string strings struct studio system template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets





