Java - Constructors Create a class named Book that has the following attributes: Publisher - String Year Published - Integer Price - Double Title - String Create a constructor for the class Book that has the parameters from the attributes of the class. After, create a method for the class that displays all attributes. Ask the user for inputs for the attributes and use the constructor to create the object. Lastly, print the values of the attributes.   Inputs 1. Publisher   2. Year Published   3. Price   4. Book Title XYZ Publishing 2020 1000.00 How to Win?   Sample Output Published: ABC Publishing Year Published: 2022 Price: 150.00 Book Title: Stooping too low   Stooping too low is published by ABC Publishing on 2022. It sells at the price of Php150.00

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter8: Advanced Method Concepts
Section: Chapter Questions
Problem 1DE: Each of the following files in the Chapter.08 folder of your downloadable student files has syntax...
icon
Related questions
Question

Java - Constructors

Create a class named Book that has the following attributes:

Publisher - String Year Published - Integer Price - Double Title - String

Create a constructor for the class Book that has the parameters from the attributes of the class. After, create a method for the class that displays all attributes. Ask the user for inputs for the attributes and use the constructor to create the object. Lastly, print the values of the attributes.

 

Inputs

1. Publisher

 

2. Year Published

 

3. Price

 

4. Book Title

XYZ Publishing 2020 1000.00 How to Win?

 

Sample Output

Published: ABC Publishing
Year Published: 2022
Price: 150.00
Book Title: Stooping too low
 
Stooping too low is published by ABC Publishing on 2022. It sells at the price of Php150.00.
Test Cases
Constraints
O Constraint 1
The code must have a class called Book.
Test Cases
O Test Case 1
Your Output
No Output
Expected Output
Published: ABC Publishing
Year Published: 2022
Price: 150.00
Book Title: Stooping too low
Stooping too low is published by ABC Publishing on 2022. It sells at the price of Php150.00.
O Test Case 2 Hidden
Show Differences
Transcribed Image Text:Test Cases Constraints O Constraint 1 The code must have a class called Book. Test Cases O Test Case 1 Your Output No Output Expected Output Published: ABC Publishing Year Published: 2022 Price: 150.00 Book Title: Stooping too low Stooping too low is published by ABC Publishing on 2022. It sells at the price of Php150.00. O Test Case 2 Hidden Show Differences
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Unreferenced Objects
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning