Question: I need to use interfaces and user input for textbook information. Something feels off about my code and working with interfaces is something brand new

I need to use interfaces and user input for textbook information. Something feels off about my code and working with interfaces is something brand new for me.

Create a java program using interfaces to display your textbook information

import java.util.*;

interface Textbookinformation {

Scanner sc = new Scanner(System.in);

String title = ("");

String author = ("");

String publicationyear = ("");

String edition = ("");

}

public class Textbook implements Textbookinformation {

public static void main (String[] args)

{

Textbook myTextbook = new Textbook();

myTextbook.title();

myTextbook.author();

myTextbook.publicationyear();

myTextbook.edition();

}

public void title()

{

System.out.println(" What is the title of the textbook?");

String title = sc.next();

}

public void author()

{

System.out.println(" What is the name of the author? ");

String author = sc.next();

}

public void publicationyear()

{

System.out.println(" What is the publication year of the textbook?");

String publicationyear = sc.next();

}

public void edition()

{

System.out.println(" What edition is the textbook?");

String edition = sc.next();

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

There are a few issues with your code Lets go through them one by one 1 In the Textbookinformation i... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!