{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Publishing

# Publishing - R L Hendrix CSC 119-01 Program#1 Algorithm...

This preview shows pages 1–3. Sign up to view the full content.

R. L. Hendrix CSC 119 -01 February 16, 2011 Program #1 Algorithm used to solve: I used Inheritance to do this program as well as get and set methods and override. Data used to test: public class Publication { protected String title; protected int nopages; protected double price; protected double amount; protected String owner; public Publication( String mytitle, int mynopages, double myprice ) { title = mytitle; nopages = mynopages; price = myprice; } public void setTitle( String mytitle ) { title = mytitle; } public String getTitle() { return title; } public void setNopages( int mynopages ) { nopages = mynopages; } public int getNopages() { return nopages; } public void setPrice( double myprice ) { price = myprice; } public void setSell( String myowner, double amount ) {

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
amount = amount - price; owner = myowner; } //@Override public String tostring() { return String.format( "Title: %s\nPrice: %.2f Change: \$%.2f\nNumber of Pages: %d\n", title, price, amount, nopages ); } } public class Magazine extends Publication { private String pubunit; public Magazine( String mytitle, int mynopages, double myprice, String mypubunit ) {
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 5

Publishing - R L Hendrix CSC 119-01 Program#1 Algorithm...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online