62,614
社区成员
发帖
与我相关
我的任务
分享
1. a.Some of the characteristics of a book are title, author(s),publishers,ISBN,price,and year of publication.Design the class Book that defines the book as an ADT. //设计一个抽象数据类型Book,来定义它的属性:书名,作者,发行商,ISBN号,价格和发行年份。
Each object of the class Book can hold the following information about a book:title, up to four authors,publisher,ISBn,price,and number of copies in stock. To keep track of the number of authors,add another instrance variable.
Include the methods to proform various operations on the objects of Book. For example, the usual operations that can be performed on the title are to show the title, and check whether a title is the actual title of the book.Similarly, the typical operations than can be performed on the number of copies in stock, update the number of ncopoes in stock,and return the number of copier in stock.Add similar operations for the publisher,ISBN,book price,and author.Add the appropriate constructors and a finalizer(if one is needed)
b.Write the definitions of the methods of the class Book. //编写Book类的方法
c.write a program that uses the class Book and tests various operations on the objects of class Book.Declare an array of 100 components of the type Book. Some of the operations that you should perform are to search for a book by its title, search by ISBN, and update the number of copies of a book.//写一个程序来使用Book类,并且要测试Book类里面的方法。还要你去实现一个依照书名,或者ISBN号来搜索和update Book实例的功能,
2. In this exercise, you willdesign the class Member //设计一个类Member,其实就是借书人的对象,要有姓名,ID,他所借的书,以及结束所花费的钱
a. Each object of Member can hold the name of a person, member ID,number of books bought, and amount spent.
b. Include the methods to perform the various operations on the objects of the class Member- for exampl,modify,set,and show a person's name.Similarly update,modify,and show the numberof booksbought and the amount spent.
c.Add the appropriate constructors and a finalizer (if one needed).
d.Write the definition of the methodsof the class Member.
3.//利用前面两个类,来模拟实现一个书店。
Using the classes designed in Programming Exercise 1 and 2, write a program to simulate a bookstore. The bookstore has two types of customers:those who are members of bookstore and those who buybooks from the bookstore only occasionally, Each member has to pay a $10 yearly membership fee and receivers a 5% discount on each book bought.
For each member,the bookstore keeps track of the bought and the total amount spent. For every eleventh book that a member buys, the bookstore takes the average of the total amount of the last 10 books bought, applies this amount as a discount, and then resets the total amount spent to 0.
write a program that can peocess up to 1000 book titles and 500 members. Your program should contain a menu that user different choices to effectively run the program; in other words, your program should be menu-driven.