Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

There are a few issues with your code Lets go through them one by one 1 In the Textbookinformation i... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Applying Communication Theory For Professional Life A Practical Introduction

Authors: Marianne Dainton, Elaine D. Zelley

4th Edition

150631547X, 978-1506315478

More Books

Students also viewed these Programming questions

Question

Evaluate this logical expression: false | | ! true java

Answered: 1 week ago