DevX Home Today's Headlines   Articles Archive   Tip Bank   Forums

1. Registered User
Join Date
Apr 2005
Location
Posts
2

1-Create a supper class called Car
2- Create a subclass which derived from the Car class and called American car
3- Another subclass is derived from Car class called Japanese car
4- Two classes are derived from Japanese car, namely: NweCar and UsedCar.

Under supper class “Car” you declare common attributes and functions. For example you can declare these attributes [Year, Color, number of doors and personal information of buyers such as:[ full name, Address, telephone], which is shared by all inherited components.
Under American Car you can declare price, Quantity and model, All American cars are classified as new. The buyer must buy by payments for 5 years. Example if car price is \$15000 the 2/3 of this price must be divided equally by 60 months and the rest is called payback.
E.g. 15000 x2/3 =\$10000.00  10000.00/60=\$166.66 per months with inertest rate of 2.9% then the monthly payment become 166.66= (166.66*.029) =171.49, and taxes (GST, PST) the total become \$197.21 and the payback is \$5000. Generate output in details.

Under Japanese car, program asks “new” or “used”?
If new car then reading from class “NewCar”, you may declare price, quantity, and model. Client can buy by payments or in buy as full pay.
If buying by installment then you calculated the same as American car.
If buying in full-pay then climate can pay the price and taxes which is GST and PST.

Generate output in details.

Used car: The used car must be sold as full pay, if car’s color is black then there will be no discount. If color is not black and year is less than 2000 the there will be 10% discount. Add taxes
Output must be in details for every activity.

Information must be saved in the text file and be available upon request.

A->American Car N-> New Car
J->Japanese Car --->
L->List U-> Used car
Q-> Quit

2. Senior Member
Join Date
Dec 2003
Posts
3,366
I'm stumped too... what is a 'supper class' ? Pizza?

3. Registered User
Join Date
Jan 2005
Location
UK
Posts
604
;-) Be serious jonnin!
I think the first step for kennytran is to make yourself familiar with the concepts of object oriented programming. And a good start for you is to have a look at Bruce Eckel's book "Thinking in C++" (just enter this in your search engine and you will find Bruces Website, where you can download the whole book). It explains in easy terms the syntax and thinking behind C++. Have a look it might light some candles for your supper! ;-)

Cheers,

Dieter

4. Sorry to spoil the shindig, but isn't "Thinking in C++" the book that our good old pseudo quotes from regularly? And haven't his puzzles from that book suggest that it isn't the best C++ book around, to put it mildly? Consider:

I would recommend more serious stuff. It might be painful at first but C++ is a language for serious programmers so there's no point in cutting corners or trying to impart a spurious sense of simplicity/ease of learning -- for this purpose we have VB;)

5. Registered User
Join Date
Apr 2005
Location
Posts
2
thanks for all replies ..and i was done with that ..but i have some problem when i'm copiling ...you guy know how to return to the menu after compiled..thanks so much

6. Registered User
Join Date
Jan 2005
Location
UK
Posts
604
We don't want to get into VB, really. I do believe, though, that Eckel's book can give you a good start and it is free - and I would never reject free advice. But could anyone suggest a really good C++ book? Or online tutorial? I have to say I have started with the Stroustrup book a long time ago, but all that book has done was to confuse me and avert my attention from the really important issues. In that respect I feel Eckel approaches the whole thing far better.

Kennytran:
which compiler are you using, which platform?

Cheers,

Dieter

7. Senior Member
Join Date
Dec 2003
Posts
3,366
Stroustrap is a reference book, not for learning the language but really for experts to clarify a point. Keep it but put it away for now.

I don't have it, but there is a book called modern c++ that is always recommended whenever someone asks.

8. For beginners, I'd recommed Lippman and LaJoie's "C++ Primer". Now in its fourth edition, it's the ultimate C++ primer. It's not free but personally, I don't think I'd prefer a free tutorial that is less accurate and up-to-date just because I want to save a few bucks. Becoming a professional programmer doesn't come cheap and spending some \$40 on a good book is one of the best invetsments I can think of. With the right book, compiler and mind-set, your monthly salary will be at least 100 fold higher than that.

On a more philosophical note: I'd certainly turn down a free advice if it's a bad one. And in the software world, not every free advice is a necessarily a good one...

Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•

 FAQ Latest Articles Java .NET XML Database Enterprise