Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 694019
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T02:48:49+00:00 2026-05-14T02:48:49+00:00

I need to create interface MultiLingual, that allows to display object’s data in different

  • 0

I need to create interface MultiLingual, that allows to display object’s data in different languages (not data itself, but introduction like “Author”, “Title” etc.).

Printed data looks like this :

3 grudnia 1998

10th of June 1924

Autor: Tolkien
Tytul: LoTR
Wydawnictwo: Amazon 2010

Author: Mitch Albom
Title: Tuesdays with Morrie
Publishing House: Time Warner Books 2003   

37 360,45 PLN

5,850.70 GBP

3rd of December 1998

10th of June 1924

Author: Tolkien
Title: LoTR
Publishing House: Amazon 2010

Author: Mitch Albom
Title: Tuesdays with Morrie
Publishing House: Time Warner Books 2003

37,360.45 GBP

5,850.70 GBP

Test code looks like this :

public class Main {

public static void main(String[] args){

  MultiLingual gatecrasher[]={ new Data(3,12,1998),
                               new Data(10,6,1924,MultiLingual.ENG),
                               new Book("LoTR", "Tolkien", "Amazon", 2010),
                               new Book("Tuesdays with Morrie",
                                        "Mitch Albom", "Time Warner Books",2003,
                                        MultiLingual.ENG),
                               new Money(1232895/33.0,MultiLingual.PL),
                               new Money(134566/23.0,MultiLingual.ENG),
                             };

  for(int i=0;i < gatecrasher.length;i++)
    System.out.println(gatecrasher[i]+"\n");

  for(int i=0;i < gatecrasher.length;i++)
    System.out.println(gatecrasher[i].get(MultiLingual.ENG)+"\n");

}
}

So i need to introduce constants ENG, PL in MultiLingual interface, as well as method get(int language) :

public interface MultiLingual {

int ENG = 0;
int PL= 1;

String get(int lang);

}

And then I have class Book. Problem starts with the constructors. One of them needs to take MultiLingual.ENG as argument, but how to achieve that ? Is this the proper way? :

class Book implements MultiLingual {

private String title;
private String publisher;
private String author;

public Book(String t, String a, String p, int y, MultiLingual lang){      
}

Or should I treat this MultiLingual.ENG as int variable , that will just change automatically constants in interface?

Second constructor for book doesn’t take MultLingual as argument, but following implementation is somehow wrong :

public Book(String t, String a, String p, int y){
    Book someBook = new Book(t, a, p, y, MultiLingual m);
}

I could just send int m in place of MultiLingual m but then I will have no control if language is set to PL or ENG.

And finally get() method for Boook but I think at least this should be working fine:

public String get(int lang){

    String data;
    if (lang == ENG){
        data = "Author: "+this.author+"\n"+
                "Title: "+this.title+"\n"+
                "Publisher: "+this.publisher+"\n";
    }
    else {
        data = "Autor: "+this.author+"\n"+
                "Tytul: "+this.title+"\n"+
                "Wydawca: "+this.publisher+"\n";            
    }

    return data;
}

@Override
public String toString(){
    return "";
}

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T02:48:50+00:00Added an answer on May 14, 2026 at 2:48 am

    Inside your interface, the ints representing the languages should be statics, you don’t want to accidentally start reassinging them while your code is running. Then have your book class hold an int for which language it is.

    Book someBook = new Book(t, a, p, y, MultiLingual m); won’t work as MultiLingual is an interface, it isn’t anything there can be an instance of to pass in.

    It needs to be an int. Which will be something like MultiLingual.ENG or .PL

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to create an XML schema that looks something like this: <xs:element name=wrapperElement>
I need to create an ASP page (classic, not ASP.NET) which runs remote shell
I need to create a backup of a SQL Server 2005 Database that's only
I need to create a 2D int array of size 800x800. But doing so
I need to create a button that has the same style as ButtonSpec with
I want to know if there is any need to create interface for request/response
I have two basic interface-related concepts that I need to have a better understanding
I need to create a historical timeline starting from 1600's to the present day.
I need to create a linked server to a DB2 database on a mainframe.
I need to create a quick-n-dirty knob control in Visual Basic 2005 Express, the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.