| | |
book class
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
•
•
Join Date: Aug 2008
Posts: 8
Reputation:
Solved Threads: 0
java Syntax (Toggle Plain Text)
public class book { private double basePrice = 0; private double vat = 0; private double discount = 0; private double sellPrice; public book() { setBasePrice(0); setVat(0); setDiscount(0); } public book(double basePrice, double discount, double vat) { setBasePrice(basePrice); setVat(discount); setDiscount(vat); } public double getBasePrice() { return basePrice; } public void setBasePrice(double basePrice) { if (basePrice >= 0) this.basePrice = basePrice; setSellPrice(); } public double getVat() { return vat; } public void setVat(double vat) { if (vat >= 0) this.vat = vat; setSellPrice(); } public double getDiscount() { return discount; } public void setDiscount(double discount) { if (discount >= 0) this.discount = discount; setSellPrice(); } public double getSellPrice() { return sellPrice; } private void setSellPrice() { sellPrice = basePrice * ((100 + (vat - discount)) / 100); } }
•
•
Join Date: Aug 2008
Posts: 8
Reputation:
Solved Threads: 0
java Syntax (Toggle Plain Text)
package com.bookPortal.model; public class Book { private double basePrice = 0; private int vat = 0; private int discount = 0; private double sellPrice; public Book() { setBasePrice(0); setVat(0); setDiscount(0); } public Book(double basePrice, int discount, int vat) { setBasePrice(basePrice); setVat(discount); setDiscount(vat); } public double getBasePrice() { return basePrice; } public void setBasePrice(double basePrice) { if (basePrice >= 0) this.basePrice = basePrice; setSellPrice(); } public int getVat() { return vat; } public void setVat(int vat) { if (vat >= 0) this.vat = vat; setSellPrice(); } public int getDiscount() { return discount; } public void setDiscount(int discount) { if (discount >= 0) this.discount = discount; setSellPrice(); } public double getSellPrice() { return sellPrice; } private void setSellPrice() { sellPrice = basePrice * (100 + vat - discount) / 100; if (sellPrice < 0) sellPrice = 0; } }
java Syntax (Toggle Plain Text)
package com.bookPortal.modelTest; import com.bookPortal.model.Book; import junit.framework.TestCase; public class BookTest extends TestCase{ Book b = new Book(); public void testSetBasePrice(){ b.setBasePrice(10); assertEquals(10.0, b.getBasePrice()); } public void testWrongSetBasePrice(){ b.setBasePrice(-10); assertEquals(0.0, b.getBasePrice()); } public void testSetVat(){ b.setVat(10); assertEquals(10, b.getVat()); } public void testWrongSetVat(){ b.setVat(-10); assertEquals(0, b.getVat()); } public void testSetDiscount(){ b.setDiscount(10); assertEquals(10, b.getDiscount()); } public void testWrongSetDiscount(){ b.setDiscount(-10); assertEquals(0, b.getDiscount()); } public void testSetSellPrice(){ b.setBasePrice(10); b.setDiscount(0); b.setVat(18); assertEquals(11.80, b.getSellPrice()); } public void testWrongSetSellPrice(){ b.setBasePrice(0); b.setDiscount(50); b.setVat(18); assertEquals(0.0, b.getSellPrice()); } }
Tests successfull
I am sure that someone, someday will understand what you are trying to tell us
Check out my New Bike at my Public Profile at the "About Me" tab
•
•
Join Date: Aug 2008
Posts: 8
Reputation:
Solved Threads: 0
product owner responsibility: Put into a simple list, typical product owner responsibilities are:
decide on the project vision - who is going to benefit from the project and how;
secure funding;
continuously make decisions on the product priorities - what is more important with the latest information in mind;
continuously make decisions on maximizing the product ROI - make sure the features with the biggest benefit/cost ratio are developed first.
decide on the project vision - who is going to benefit from the project and how;
secure funding;
continuously make decisions on the product priorities - what is more important with the latest information in mind;
continuously make decisions on maximizing the product ROI - make sure the features with the biggest benefit/cost ratio are developed first.
•
•
•
•
product owner responsibility: Put into a simple list, typical product owner responsibilities are:
decide on the project vision - who is going to benefit from the project and how;
secure funding;
continuously make decisions on the product priorities - what is more important with the latest information in mind;
continuously make decisions on maximizing the product ROI - make sure the features with the biggest benefit/cost ratio are developed first.
•
•
•
•
XP Practices:
-Collective ownership
-coding standards
-sustainable pace
-test first
-acceptance tests
-automation
-onsite customer
-continuous integration
-pair programming
-metaphor
-refactoring
-incremental design
-stories
-small releases
-planning game
-informatie workspace
"Argyou not with the hand you are dealt in cards or life." ---- Wizard and Glass
![]() |
Similar Threads
- Good Book for beginners in C# (C#)
- Instantiating an Object of a Class Confusion (Java)
- old-style class (Python)
- Compiling a Class in several parts?!? (C++)
- C++ Address Book (C++)
- ColdFusion 5 Web Application Construction Kit (ColdFusion)
- Address Book Application... (here's what I have done so far..) (C++)
- I need help on my 'address book' assignment! (C++)
Other Threads in the Java Forum
- Previous Thread: persistence: id of object not updated after em.persist(object)
- Next Thread: Type mismatch: Cannot convert from void to double
Views: 1376 | Replies: 9
| Thread Tools | Search this Thread |
Tag cloud for Java
add android api apple applet application arguments array arrays automation bank binary bluetooth chat chooser class classes client code component converter database digit draw eclipse equation error event exception file fractal functiontesting game givemetehcodez graphics gui health helpwithhomework html hyper ide idea image infinite input int integer j2me java javame javaprojects jmf jni jpanel julia linux list loop main map method methods mobile myregfun netbeans newbie nonstatic number object oracle pattern pearl print problem program programming project recursion scanner screen server set size sms socket sort sorting spamblocker sql sqlserver string swing test text-file thread threads time transfer tree windows






