Sei sulla pagina 1di 18

Introduction of programming.

Islington College

Introduction of programming CC1006NI

Assignment

Prepared by: Akash Adhikari N2

Summbitted to: Sailesh Neupana

REPORT

Introduction of programming.

TABLE OF CONTENTS:
Topics: Class Diagram : . 3 . 4

Method Description: Pseudo code : TESTS :

. 5-7

... 8- 13 Test 1: . 8 Test 2: .. 9-10 Test 3: ...10-11 Test 4: ...12 Test 5: ... 14

Conclusion : . 15 Appendix : . 16-18

REPORT

Introduction of programming.
Class Daigram:
Class Book

-Description: String -DateOfBorrow: String -MemberName: String -DateOfReturn: String -NumberOfDays: Int -DownPayment: Int -DailyRate: Int -TotalRate: Int -Borrowed: Boolean

+ String getDescription() + Int getDownpayment() +String getNumberName() +Int getDailyRate() +Int getNumberOfDay() +String getDateOfBorrow() +String getDateOfReturn() +Void setDailyRate() +Void setDownpayment() +Void issueBook() +Void BookReturn() +Void BookInfo()

REPORT

Introduction of programming.

Method Description: 1. public getDescription() *This method returns the value description 2. public getDateOfBorrow() *This method returns the value of dateOfBorrow 3. public getDateOfReturn() *This method return the value of dateOfReturn. 4. public getDownPayment() *This method returns the value of downPayment. 5. public getMemberName() *This method returns the value of memberName. 6. public getDailyRate() *This method return the value of dailyRate 7. public getNumberOfDays() *This method return the value of numberOfDays. 8. public void setDailyrate() *This method set the value of dailyRate. 9. public void setDowPayment() *This method set the value of downPayment. 10. public void issueBook () *This method is issuing book. 11. public void BookReturn () *This method return the book. 12. public void BookInfo() *This method print description and total rent collected by book.

REPORT

Introduction of programming.

Pseudocode for each class:

GetDescription( ) DO Call getDescription Return description END DO

getMemberName( ) DO Call getMemberName Return memberName END DO

getDownPayment( ) DO Call getDownPayment Return downPayment END DO

getDateOfBorrow() DO Call getDateOfBorrow Return dateOfBorrow END DO

REPORT

Introduction of programming.
getDateOfReturn( ) DO Call getDateOfReturn Return dateOfReturn END DO

getDailyRate( ) DO Call getDailyRate() Return dailyRate END DO

getNumberOfDays( ) DO Call getNumberOfDays Return numberOfDays END DO

Void SetDailyRate DO Call SetDailyRate Set dailyRate END DO

REPORT

Introduction of programming.

Void SetDownPayment DO Call SetDownPayment Set downPayment END DO

Void issueBook DO Call Borrowed Book IF Borrow value is true Display message ELSE Set memberName Set dateOfBorrow Set dateOfReturn Set numberOfDays END IF END DO Void BookInfo DO Call BookReturn IF Borrowed value is false Display message ELSE Set memberName to null Set numberOfDays to 0 Set dateOfBorrow to null Set dateOfReturn to null Set Borrowed value to false END DO
REPORT 7

Introduction of programming.
TESTS:
TEST 1 :

(fig: inspect book)

(fig: inspect dailyRate)

REPORT

Introduction of programming.

TEST 2:

(Fig: inspect book )

(Fig: inspect Downpayment)

REPORT

Introduction of programming.

(Fig: book is re-inspect a book)

TEST 3:

(Fig: inspect book)

REPORT

10

Introduction of programming.

(Fig. lean book to a customer)

(Fig: re-inspect book)

REPORT

11

Introduction of programming.

TEST 4:

(Fig: inspect a book)

REPORT

12

Introduction of programming.

(Fig. book return to the shop)

( Fig. re-inspect)

REPORT

13

Introduction of programming.

TEST 5:

( Fig. Display the description and the total rent accumulated for a given book )

REPORT

14

Introduction of programming.

CONCLUSION: Lots of obstacle comeover while doing this assaignment. Every questions make me confuse and unable understand exactly what the question is asking then I started to concern with my friends although i could not able to clearify myself. I was totally worried about this assaginment and deadline was getting closer. After all, I started to research through education magazine, books and surf in internet. All research become helpful to me and it makes me eaiser to understand every questions. Overall tutorial videos and education sites provide me ideas of programming and softwares(bluej, visual studio) which is useful to code a programs so that I can able to solve all question given in assignment.

REPORT

15

Introduction of programming.
APPENDIX:
/** * this Book class stores description, date of borrow, member name,date of return,downpayment, dailyrate, * totalRate, borrowed. * @author (Akash Adhikari) * @version (2012/12/15) */ public class BOOK { // instance variables - replace the example below with your own private String description;//a string of characters to store book name private String dateOfBorrow;//a string of characters to store the date the book is borrowed private String memberName;//a string of characters private String dateOfReturn;//a string of characters to store the date the book is to be returned private int numberOfDays;//the number of days the book is lent. private int downPayment;//the down payment as whole number private int dailyRate;//the daily rate,which is whole number. private int totalRate;//the total fine that the book has accumulated to-date. private boolean borrowed;//either true or false public BOOK(String description, int DownPayment, int dailyRate){ this.description=description; downPayment=DownPayment; this.dailyRate=dailyRate; memberName=""; dateOfBorrow=""; numberOfDays=0; dateOfReturn=""; totalRate=0; borrowed=false; } //this method is for return value of description. public String getDescription(){ return description; } //this method returns the value of downpayment. public int getDownPayment(){ return downPayment; } //this method returns value of date of days. public String getDateOfBorrow(){ return dateOfBorrow; } //this method returns value of date of return. public String getDateOfReturn(){

REPORT

16

Introduction of programming.
return dateOfReturn; } //this method returns value of daily rate. public int getDailyRate(){ return dailyRate; } //this method return value of numberof days. public int getNumberOfDays(){ return numberOfDays; } //this method return value of member name. public String getMemberName(){ return memberName; } /** * method that sets the daily rate to new value and method accepts the new value of the daily rentas a parameter */ public void setDailyRate(int dailyRent){ dailyRate=dailyRent; } public void setDownPayment(int downPayment){ this.downPayment=downPayment; } /** * this issueBook method and method accepts, as parameters,new member's name, the date on which the book is lend, the date on which the book is to be returned and the number of days the book is required. */ public void issueBook(String memberName, String dateOfBorrow, String dateOfReturn, int numberOfDays){ if (borrowed==true){ System.out.println("book borrowed./n date of Return is "+dateOfReturn); } else this.memberName=memberName; this.dateOfBorrow=dateOfBorrow; this.dateOfReturn=dateOfReturn; this.numberOfDays=numberOfDays; borrowed=true; totalRate=dailyRate*numberOfDays; } //this method is for returning the book. public void BookReturn(){ if (borrowed==false){ System.out.println("book is not borrowed"); }

REPORT

17

Introduction of programming.
else memberName=""; numberOfDays=0; dateOfBorrow=""; dateOfReturn=""; borrowed=false; } //this method is for print description and total rate. public void BookInfo(){ System.out.println("display the description of a particular book"+getDescription()); System.out.println("The book java to return "+totalRate+"till date"); } }

REPORT

18

Potrebbero piacerti anche