Explore BrainMass
Share

Explore BrainMass

    Java Programming: SchoolTextBook Class

    This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

    Create a class titled SchoolTextBook that contains fields for the author, title, page count, ISBN, and price. This SchoolTextBook class will also provide setter and getter methods for all fields. Save this class in a file titled SchoolTextBook.java.

    Write an application with an array that holds 5 instances of the SchoolTextBook class, filled without prompting the user for input. Next prompt the used to enter a field for sorting, sort the array of objects based on the user input, and then display the newly sorted array of objects. Save this class in a file titled SchoolTextBookSort.java.

    © BrainMass Inc. brainmass.com October 10, 2019, 5:31 am ad1c9bdddf
    https://brainmass.com/computer-science/java/java-programming-schooltextbook-class-508008

    Solution Preview

    import java.text.NumberFormat;

    public class SchoolTextBook {

    private String author; //1 for sorting
    private String title; //2 for sorting
    private int pageCount; //3 for sorting
    private String isbn; //4 for sorting
    private double price; //5 for sorting

    public SchoolTextBook() {
    }

    public SchoolTextBook(String a, String t, int c, String ...

    Solution Summary

    The expert examines SchoolTextBook Classes for java programming.

    $2.19