if computerSum WINNINGNUMBER then computerSum computerSum computerCardsx

If computersum winningnumber then computersum

This preview shows page 45 - 47 out of 47 pages.

if computerSum > WINNING_NUMBER thencomputerSum = computerSum – computerCards[x]computerDone = 1endifendifx = x + 1endwhileif playerWin = 1 OR playerSum > computerSum thenoutput “You win!”elseif computerWin = 1 OR computerSum > playerSum thenoutput “The computer wins!”endifendifstopUp for Discussion1.Many programmers think object-oriented programming is a superior approach to procedural programming. Others think it adds a level of complexity that is not neededin many scenarios. Find and summarize arguments on both sides. With which side do you agree?
Programming Logic and Design, 8eSolutions 11-46Answer:Those who feel object-oriented programming is the superior approach cite its similarity to how objects operate in the real word. Data and its methods are packaged.Polymorphism provides more natural syntax and inheritance provides reusability. Those who feel procedural programming is the superior approach cite its simplicity. They feel object-orientation adds an unnecessary layer to what would otherwise be simple code.2.Many object-oriented programmers are opposed to using multiple inheritance. Find out why and decide whether you agree with this stance.Answer:Multiple inheritance has been criticized because of the increased complexity it causes,particularly in the chaining of constructors and destructors. Problems also arise if both base classes used for multiple inheritance have data members or methods with the same signature, leading to ambiguous situations. Many say that if you feel you need multiple inheritance, it is a sign of poor design.3.If you are completing all the programming exercises in this book, you can see how much work goes into planning a full-blown professional program. How would you feel if someone copied your work without compensating you? Investigate the magnitude of software piracy in our society. What are the penalties for illegally copying software? Are there circumstances in which it is acceptable to copy a program? If a friend asked you to copy a program for him, would you? What should we do about this problem, if anything?Answer:Different sources report different dollar amounts, but software piracy seems to account for at least $13 billion in software revenue lost worldwide per year.According to the U.S. Copyright Act, illegal reproduction of software is subject to civil damages of as much as $100,000 per title infringed plus criminal penalties, including fines of as much as $250,000 per title infringed and imprisonment of up to five years. Companies devote a large portion of their earnings to the creation of new software products. The programmers, writers, and all those involved in the creation of these new products deserve fair compensation. Companies will not continue to develop newproducts unless they can make a profit. Just as every customer pays a little for a store’s losses to shoplifters, every purchaser of legal software pays a little for illegal copies.
Programming Logic and Design, 8eSolutions 11-47

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture