Sorry guys, im beginner in java. Can you help me with these problems. :/

Problems:

  1. a. Create an abstract class named Book. Include a String field for the book’s title and a double field for the book’s price. Within the class, include a constructor that requires the price. Include an abstract method named setPrice(). Create two child classes of Book: Fiction and NonFiction. Each must include a setPrice() method that sets the price for all Fiction Books to $ 24.9 and for all NonFiction Books to $37.99. Write an application demonstrating that you can create both a Fiction and a NonFiction Book, and display their fields. Save the files as Book.java, Fiction.java, NonFiction.java, and UseBook.java.
    b. Write an application named BookArray in which you create an array that holds 10 Books, some Fiction and some NonFiction. Using a for loop, display details about all 10 books. Save the file as BookArray.java.

  2. Create an abstract class named Account for a bank. Inlcude an integer field for the account number and a double field for the account balance. Also include a constructor that requires an account number that sets the balance to 0.0. include a set method for the balance. Also include two abstract get methods –one for each field. Create two child classes of Account: Checking and Savings. Within the Checking class, the method displays the String “Checking Account Information”, the account number, and the balance. within the Savings class, add a field to hold the interest rate, and require Savings constructor to accept an argument for the value of the interest rate. The Savings get method displays the String “Saving Account Information”, the account number, the balance, and the interest rate. Write an application that demonstrates you can instantiate and display both Checking and Savings objects. Save the file as Account.java, Checking.java, Savings.java and DemoAccounts.java.
    b. Write an application named AccountArray in which you enter data for a mix of 10 Checking and Savings account. Use a for loop to display the data. Save the file as AccountArray.java,

  3. Create an abstract Auto class with fields for the car make and price. Include get and set methods for these fields; the setPrice() method is abstract. Create two subclasses for individual automobile makers (for example, $20,000 or $22,000). Finally, write an application that uses the Auto class and subclasses to display information about different cars. Save the file as Auto.java, Ford.java, Chevy.java and UseAuto.java.

  4. Create an abstract Division class with fields for a company‘s division name and account number, and an abstract display() method. Use a constructor in the superclass that requires values for both fields. Create two subclasses named InternationalDivision and DomesticDivision. The InternationalDivision includes a field for the country in which the division is located and a field for the language spoken; its constructor requires both. The DomesticDivision includes a field for the state in which the division is located; a value for this field is required by the constructor. Write an application named UseDivision that creates InternationalDivision and DomesticDivision objects for two different companies and displays information about them. Save the files as Division.java, InternationalDivision.javam DomesticDivision.java and UseDivision.java.

  5. Write an application named UseChildren that creates and displays at least two Child Objects-one Male and one Female. Child is an abstract class and Male and Female are subclasses. The Childe class contains fields that hold the name, gender, and age of a child. The Child class constructor requires a name and gender. The Child class also contains two abstract methods named setAge() and display(). The Male and Female subclass constructor require only a name; they pass the name and appropriate gender to the Child. The subclass constractors also prompt the user for an age using the setAge() method, and then display the Child’s data using the display() method. Save the files as Child.java, Male.java, Female.java, and UseChildren.java.

6.Create a class named NewsPaperSubscriber with fields for a subscriber’s street address and the subscription rate. Include get and set methods for the subscriber’s street address, and include get and set methods for the subscription rate. The set method for the rate is abstract. Include an equals() method that indicates two Subscribers are equal if they have the same street address. Create child classes named SevenDaySubscriber, WeekDaySubscriber, and WeekendSubscriber. Each child class constructor sets the rate as follows: SevenDaySubscriber pay $4.50 per week, WeekDaySubscriber pay $3.50 per week, and WeekEndSubscribers pay $2.00 per week. Each child class should include a toString() method that returns the street address, rate, and service type. Write an application named Subscribers that prompts the user for the subscriber’s street address and requested service, and then creates the appropriate object based on the service type. Do not let the user enter more than one subscription type for any given street address. Save the files as NewpaperSubscriber.java, WeekdaySubscriber.java, WeekendSubcriber.java, SevenDaySubscriber.java and Subscriber.java.

  1. a. Create an interface named Turner, with a single method named turn(). Create a class named Leaf that implements turn() to display “Changer Colors”. Create a class named Page that implements turn() to display “Going to the next page”. Create a class named Pancake that implements turn() to display “Flipping”. Write an application named DemoTurners that create one object of each of these class types and demonstrates the turn() method for each class. Save the files as Turner.java, Leaf.java, Page.java, Pancake.java and DemoTurners.java.

  2. Write an application named UseInsurance that uses an abstract Insurance class and Health and Life subclasses to display different types of insurance policies and the cost per month. The insurance class contains a String representing the type of insurance and a double that holds the monthly price. The Insurance, but the Life and Health class constructors requires no arguments. The Insurance class contains a get method for each field; it also contains two abstract methods named setCost() and display(). The Life class setCost() method set the monthly fee to $36, and the health class sets the monthly fee to $196. Write an application named UseInsurance that prompts the user for the type of Insurance to be displayed, and then create the appropriate object. Save the files as Life.java, Health. Java, Insurance.java, and UseInsurance.java.

  3. Create an abstract class called GeometricFigure. Each figure includes a height, a width, a figure type, and an area. Include an abstract method to determine the area of the figure. Create two subclasses called Square and Triangle. Create an application that demonstrates creating objects of both subclasses, and store them in an array. Save the files as GeometricFigure.java, Square.java, Triangle.java, and UseGeometric.java.

  4. Create an interface called Player. The interface has an abstract method called play() that displays a message describing the meaning of “play” to the class. Create classes called Child, Musician, and Actor that all implement Player. Create an application that demonstrates the use of the classes. Save the files as Player.java, Child.java, Actor.java, Musician.java, and UsePlayer.java.

  5. Create a building class and two subclasses, House and School. The Building class contains fields for square footage and stories. The House class contains additional fields for number of bedrooms and baths. The School class contains additional fields for number of classrooms and grade level (for example, elementary or junior high). All the classes in a package named com.course.buildings. Create an application that declares objects of each type and uses the package. Save the necessary files as Building.java, House.java, School.java and CreateBuilding.java.

Recommended Answers

All 3 Replies

Sounds like a really, really big, mega homework assignment to me.What have you tried for yourself so far?

There are lots of people here who will freely give their time to help you become the best Java programmer you can be. There's nobody here who is interested in helping you cheat or doing your homework for you.

DaniWeb Member Rules (which you agreed to when you signed up) include:
"Do provide evidence of having done some work yourself if posting questions from school or work assignments"
http://www.daniweb.com/community/rules

Post what you have done so far and someone will help you from there.

This is just another user trying to get by... by using plagiarism....

The OP has probably never returned to Daniweb anyways...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.