Car passing at bridge tollbooth should pay 500. Mostly they do but sometimes a car goes by without paying. Model this tollbooth with class called toolbooth, the two data items are of tye integer total number of cars,and a type of of double total amount collected. A constructor initialize both of the items ti zero,a member function called payingcar() increases the car total and add 500 to the cash total. Another function called nonpayingcar() increment the total but ass nothing to the total cash, finally a member function called display() to display the two total. Include a program to test this class.

Recommended Answers

All 6 Replies

The most striking problem I find with your question is that it tells you how to answer it. It even gives you instructions...

There's is nothing here that is difficult. Even for a beginner, it's simple maths (addition) and method calls (three of them). I'm guessing you haven't bothered to attend a single class or do any of your own reading/study.

Get your act together or give up and pick a different course. Unless you start to think for yourself and pay attention in lectures, you're only going to fail anyway.

Am a beginner,and I've tried to tackle this question for sure but to be honest I can't go through it,please help. Am trying my best too

Which bit are you struggling with exactly?

Am just confused on even how to start writting the code,and those maths to count cars and money collected

Now, honestly, it is in your best interests to see your lecturer. As soon as possible.

There are three basic skills required for this assignment of yours;
1. Counting in increments of 1
2. Simple addition of large numbers
3. Knowledge of C++ class syntax

If you're struggling with any of the above (I'm being sincere now, honestly) you need to speak to your teacher/lecturer. Suck up your pride/shame/embarrassment, visit them and explain that you just don't understand where to get started and be honest as to why.

If you've done nothing but partying for 3-4 months, say so, and explain to them (if you're sincere about it) that now you understand that it isn't easy and you can't just "get by" on your course and you want to turn it around and apologise.

If you really don't understand the teaching, say so and they will try and go through it with you differently.

In all cases, you will probably get berrated or lectured at for not seeing them earlier, but as the saying goes, live and learn.

Your teachers are there to help you, I emplore you to seek them out and ask for help. It would do your education an injustice to try and give you a crash course over night, or even worse, the answer itself.

Thanks for the advise. I was just trying to get some solutions and try to understand them before I face my lecturer. Thanks once again.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.