(I can't compile it .I don't know how to write constructor in Initial Class

All class and main program is OK except the inital class.
Author Class
class Author {
private String authorName;
private Initials inits;
private int numTitles = 0;
// PRE True POST Prompts user for details
// and RETURNS new Author constructed from details
public Author(BufferedReader in) {
System.out.print("\nSurname ==> ");
authorName = Text.ReadString(in);
inits = new Initials(in);
numTitles = 0;
// PRE TRUE
// POST RETURNS String representation of Author
public String toString() {
String result;
result = "NAME : " + authorName + " " + inits.toString() + "\n";
result = result + "Number of titles is " + numTitles;
return(result);
// PRE TRUE
// POST Increments number of titles
public void incTitles() {
numTitles++;
Book Class
public class Book {
private String title;
private Author author;
// PRE TRUE // POST Prompts user for details
// and RETURNS new Author constructed from details
public Book(Author author, BufferedReader in) {
System.out.print("\nTitle ==> ");
title = Text.ReadString(in);
this.author = author;
author.incTitles();
// PRE TRUE
// POST RETURNS String representation of Book
public String toString() {
String result;
result = "TITLE : " + title + "\n";
result = result + "AUTHOR\n" + author.toString() + "\n";
return(result);
*****Initial Class (I can't compile it . I don't know how to write constructor
class Initials
{   private char[] inits;
     public Initials(BufferedReader in)
     System.out.print("\nInitails Testing ==> ");
     inits = Text.ReadString(in);
     public String toString()
          String result;
          result="Testing";
          return(result);
Main program
public class BookMain {
static private BufferedReader in = new BufferedReader(new                                    InputStreamReader(System.in));
public static void main(String[] args) {
Author authorRec1, authorRec2;
Book bookRec1, bookRec2;
System.out.println("\n\n****** First author input");
authorRec1 = new Author(in);
System.out.println("\n\n****** First author output\n" + authorRec1.toString());
System.out.println("\n\n****** Second author input");
authorRec2 = new Author(in);
System.out.println("\n\n****** Second author output\n" + authorRec2.toString());
     System.out.println("\n\n****** First book input");
bookRec1 = new Book(authorRec2, in);
System.out.println("\n\n****** First book output\n" + bookRec1.toString());
System.out.println("\n\n****** Second book input");
bookRec2 = new Book(authorRec2, in);
System.out.println("\n\n****** Second book output\n" + bookRec2.toString());
System.out.println("\n\n****** First book output\n" + bookRec1.toString());

Change this
class Initials {
private char[] inits;
to this
class Initials {
private String inits;
import java.io.*;
public class BookTest {
  static private BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
  public static void main(String[] args) {
    Author authorRec1, authorRec2;
    Book bookRec1, bookRec2;
    System.out.println("\n\n****** First author input");
    authorRec1 = new Author(in);
    System.out.println("\n\n****** First author output\n" + authorRec1.toString());
    System.out.println("\n\n****** Second author input");
    authorRec2 = new Author(in);
    System.out.println("\n\n****** Second author output\n" + authorRec2.toString());
    System.out.println("\n\n****** First book input");
    bookRec1 = new Book(authorRec2, in);
    System.out.println("\n\n****** First book output\n" + bookRec1.toString());
    System.out.println("\n\n****** Second book input");
    bookRec2 = new Book(authorRec2, in);
    System.out.println("\n\n****** Second book output\n" + bookRec2.toString());
    System.out.println("\n\n****** First book output\n" + bookRec1.toString());
class Author {
  private String authorName;
  private Initials inits;
  private int numTitles = 0;
  // PRE True POST Prompts user for details
  // and RETURNS new Author constructed from details
  public Author(BufferedReader in) {
    System.out.print("\nSurname ==> ");
    authorName = Text.ReadString(in);
    inits = new Initials(in);
    numTitles = 0;
  // PRE TRUE
  // POST RETURNS String representation of Author
  public String toString() {
    String result;
    result = "NAME : " + authorName + " " + inits.toString() + "\n";
    result = result + "Number of titles is " + numTitles;
    return(result);
  // PRE TRUE
  // POST Increments number of titles
  public void incTitles() {
    numTitles++;
class Book {
  private String title;
  private Author author;
  // PRE TRUE // POST Prompts user for details
  // and RETURNS new Author constructed from details
  public Book(Author author, BufferedReader in) {
    System.out.print("\nTitle ==> ");
    title = Text.ReadString(in);
    this.author = author;
    author.incTitles();
  // PRE TRUE
  // POST RETURNS String representation of Book
  public String toString() {
    String result;
    result = "TITLE : " + title + "\n";
    result = result + "AUTHOR\n" + author.toString() + "\n";
    return(result);
class Initials {
  private String inits;
  public Initials(BufferedReader in) {
    System.out.print("\nInitails Testing ==> ");
    inits = Text.ReadString(in);
  public String toString() {
    String result;
    result = inits;
    return(result);
class Text {
  static String ReadString(BufferedReader in) {
    String text = "";
    try {
      text = in.readLine();
    catch (IOException e) {
      System.out.println(e.getMessage());
      System.exit(0);
    return text;
}

Similar Messages

  • HT201302 I am trying to upload pictures from my phone to my computer and I'm getting an error message that a photo is corrupted so it can't download.  I don't know how to tell which of the photos is corrupted so that I can delete it and try again?  Thanks

    I am trying to upload pictures from my phone to my computer and I'm getting an error message that a photo is corrupted so it can't download.  I don't know how to tell which of the photos is corrupted so that I can delete it and try again?  Thanks!

    If this is an iCloud account the Outbox only appears when sending an email, so if it is still trying I suppose it should be showing now (not sure though, hard to replicate this)
    What type of email account?

  • Hi fellow apple guys, i have this problem. Hope you can help me. I don't know how to use the function keys (F1 to F12) on my macbook air. Pls help

    Hi fellow apple guys, i have this problem. Hope you can help me. I don't know how to use the function keys (F1 to F12) on my macbook air. Pls help

    Out of the box, to use the function keys as function keys, hold down the fn key when you press the key. Otherwise, you get the picture function on the key. You can reverse this behavior in the Keyboard system prefs.

  • I downloaded form filler for firefox but can't find it and don't know how to use it?

    I downloaded form filler for firefox but can't find it and don't know how to use it?

    This doesn't sound like a Firefox problem. You should try to consider, methodically, what you did before the problem occurred so that you can describe to someone exactly what occurred, and in what order.

  • I just had my old operating system reinstalled, and i can't save pages documents, don't know how to install word

    i just had my old operating system reinstalled after a breakdown, and now i can't save pages documents. i don't know how to install word.

    What was your old system?
    What is your new System?
    What version of Pages?
    How did you install it?
    I don't know if you can see what's on my screen, but I definitely can't see what's on yours.
    To Install Word, buy it and follow the instructions.
    Peter

  • IWebsites. Can anybody help me? Don't know how to publish two dif. sites

    Hi,
    Can anybody help me? I don't know how to publish two different websites to two different domains.
    I have www.windypoint.ca (website is up and running)
    and I have www.oldfriend.ca (website is ready in iWeb, but can't publish to www.oldfriend.ca
    How do I do that?
    Any/Every tip will be appreciated!!!
    Thanks, Marc

    Are you publishing to .Mac or or straight to your domain name via ftp?
    It is just that the process is different for the two.
    If you are using .Mac, then you are publishing using this and re-direct to your domain name at your host. If you are publishing directly, then you publish to a folder and use ftp.
    You need to separate your sites out first, by copying the domain.sites file and then publishing to a folder and then uploading via ftp in the normal way.

  • I have downloaded Word in icloud have opened a project named Recipes and added a recipe now I don't know how to write and save another recipe to the same place.  I don't see anyway to save?

    After using the Word in ICloud and creating a new project named recipes then putting a recipe in now I don't know how to add a new page with another recipe and save it to the same  project the first one is in.  I don't see any icon that will save?

    Arlene83 wrote:
    After using the Word in ICloud
    There is no version of the Microsoft Word app available for iPad.  What exactly do you mean here?  What app are you talking about?  And what is the tie-in to iCloud?

  • 11.0a2 the add-ons can be find but can't be installed--I don't know how to deal with

    the release is publiced the 1/2/2012,i don't know why the add-ons can't be installed……I tryed in wifi,and the mobile is cliq2……ps: the 11 is very beautiful that I want it public as soon as possible

    addons.mozilla.org is still in the process adding support for the new product. You can find some extensions at http://people.mozilla.com/~mfinkle/addons/

  • I keep on trying to verify my account so I can download music but i don't know how to, help?

    I Need help, I'm trying to verify my iTunes account but I don't know where to check my email? my email is yahoo but something keeps on going wrong.

    When you create an account you should get an email to the primary email address that you put on the account - that should show in your account's inbox, just access your email account in the way that you normally access it. If the email isn't in the Inbox then check the spam folder on the account as well. You can also try requesting that the email be sent again by logging into the account via http://appleid.apple.com : Frequently asked questions about Apple ID
    How do I verify my Apple ID by email?
    Simply follow the link in the verification email that says "Verify Now." Sign in with your current Apple ID and password, then click Verify Address. You can also verify by signing in at My Apple ID. You'll receive an email prompting you to verify.
    In that email there should be a 'verify now' link in it which you need to click on, and which should open a browser for you to then log into the account e.g.

  • HT201363 What can I do if I don't remember how I write my passwords and I don't want my account blocked but my rescue email adresse didn't existe any more ?

    Today I wanted to download an application and they asked me my security questions. I answerd them but didn't wrote them right, i'm not sure in wich lenguage I wrote them -_-.
    I looked on the apple support to know to get them I saw that I have an other email adresse that I can use to get them back but the only problem is that this email adresse is an old email adresse that I had as student and it didn't exist any more.
    I don't know what possibility I have to get these passwords back.
    If someone of you had the same problem or know how to solve this problem I would be very happy
    Thanks a lot in forward

    Forgotten Security Questions / Answers...
    See Here > Apple ID: Contacting Apple for help with Apple ID account security
              Ask to speak with the Account Security Team...
    Or Email Here  >  Apple  Support  iTunes Store  Contact
    More Info >  Apple ID: All about Apple ID security questions
    Note:
    You can only set up and/or change a Rescue Email Before you forget the questions/answers.

  • I need a specific script and don't know how to write it

    I'm running InD CS 5.5 with OS  X 10.6.8
    I use the .indb for 13-18 documents to create a textbook for print. I use a standard 8.5 x 11 page. This textbook has a main body (32 pica width) with numbered questions in a 10 pica space outside of the margins (with a 1 pica gutter between) - each question in a text box that is anchored to the paragraph the question is about. I also have lots of graphic elements (photos, graphs) that i put in that outside space that encroaches into the main body and has a text wrap. I am wanting to use these same documents to create ebooks. I have studied the new tags and edited my style names to conform to html conventions and have included tags.
    I need a script that will:
    1) cut those questions from their boxes, delete the box, and move the questions into the main margin just above the paragraph they are anchored to. All of the questions have the same style (d-question).
    2) replace the "frame break" at the end of the questions with a paragraph marker that uses the "d-question" style
    I don't know if this is a diff script or can be done in the same one, but:
    3) i also have a little candle grapic (candle.tif) in some places (denotes an illustration) that is outside the margin but has no text associated, but is also anchored to a paragraph it goes with. I would like for it to be inline at the beginning of the paragraph text.
    4) AND move any pictures, graphs, etc. into the main body, just above where they are anchored but on their own paragraph marker styled "body_art".
    Can anyone help? I would appreciate any advice you have.

    But it does not export fine to ePub. The Question number  comes out on one
    line and the text on another. And then the little graphic comes out on yet
    another ... and they aren't next to each other. I think i'll have to go in
    to the object export actions and make a jpg for each question. I thought
    moving them into the text was easier plus i think it looks better.

  • I've removed my search bar at the top of Safari how can I get it back, don't know how I did it!

    When attemping to bookmark a webite to a favourite folder I removed the serach bar at the top of Aafari and now I can not search for anything, how did I do this ! Can someone please tell me how I can get it back

    I have solved it > from simular question search > go to view and drag tool/search bar back to the top and click done ..done

  • My 'clear history button is not working. When I click on it it doesn't do anything and the letter are gray instead if blue like usual. I've gone to every type of settings I can bit I don't know how to fix it. Please help .

    My 'clear history button is not working. When I click on it it doesn't do anything and the letters are gray instead of blue like usual. I've gone to every type of settings I can think of but I don't know how to fix it. Please help .

    T
    Try:
    - Reset the iOS device. Nothing will be lost      
    Reset iOS device: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Reset all settings                 
    Go to Settings > General > Reset and tap Reset All Settings.
    All your preferences and settings are reset. Information (such as contacts and calendars) and media (such as songs and videos) aren’t affected.
    - Restore from backup. See:                                               
    iOS: Back up and restore your iOS device with iCloud or iTunes
    - Restore to factory settings/new iOS device.                       

  • Ipad2.i don`t know,how can i do now

    I bought a ipad2,on August 8.But the machine's wireless signal is very poor.i went to the Flagship store,the staff told me to make an appointment to repair.i can`t make an appointment .the staff suggested I go to after-sale to test,i did.but the after-sale told me that they only test man-made.not machine.
    If the machine in question, beyond the 15 days, the machine can not change.Now,i don`t know ,how can i do.i can`t seach the WIFi,It is a useless pad2.who can help me

    Try here >  iOS: Troubleshooting Wi-Fi networks and connections

  • Don't know how to close UI-Window Component

    I don't know how to write a close function for UI windows
    component.
    This is what i did.
    1) Dragged windows UI component to the library.
    2) Dragged button from UI to stage
    3) Gave instance name to the button as my_button
    4) For frame 1, i added this actionscript

    that will create the pop up.. you will need another button if
    you want to close it and make a call to the window.deletePopUp()
    method

Maybe you are looking for

  • No continuous play in iTunes

    Recently, when I'm in iTunes, I cannot get it to do continuous play in playlists or otherwise. It just plays one song and then stops. If I hit the fast forward button, the song stops. The songs are all checked, so that is not the problem. I've restar

  • Calling a page after creating a primary key?

    Hello, I have a form on a table with a create button on it. The primary key is created after I click the CREATE button, and brings me back to the report which shows my new record. Everything is fine here. Now, I want to branch to a new page (after pr

  • IPhone connects to secured WiFi network, but can't access Internet

    Problem: iPhone connects to my secured home WiFi network, shows WiFi strength bars at top of screen, displays checkmark, lock, power, and blue arrow on WiFi Networks screen; however, cannot access Internet, iTunes store, stocks, Weather or anything e

  • Can't customize track information on Itunes 11.01

    This might take awhile.  A month ago, I purchased a new MBP which is running Itunes 11.01.  So, I had to redo all of my playlists.  I have well over a million different audio files/music tracks.  I download A LOT of live music from different artists.

  • Using xmlns in schemas that reference Oracle registered schema

    I have two schemas: a.xsd and b.xsd. b.xsd uses an xmlns to reference a.xsd. But when I call dbms_xmlschema.registerSchema, the a.xsd schema works ok, but the b.xsd schema fails with the following error: ERROR at line 1: ORA-31154: invalid XML docume