Publishing - R. L. Hendrix CSC 119 -01 February 16, 2011...

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

View Full Document Right Arrow Icon
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 ) {
Background image of page 1

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

View Full DocumentRight Arrow Icon
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
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 5

Publishing - R. L. Hendrix CSC 119 -01 February 16, 2011...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online