Explore BrainMass
Share

Java Book Console Application

This content was STOLEN from BrainMass.com - View the original, and get the already-completed solution here!

I need a complete Java code for the following beginner-level assignment. The code does not have to be pretty as long as it works... So here's the assignment:

You run a small library. Ask the user to provide information for several books. The information must include the author, title and publisher of each book. Create a book class which stores the information and implements the following methods:

getAuthor() (returns author's name)

getTitle() (returns the title)

getPublisher() (returns the publisher of the book)

Finally print all the stored information to the user.

Tip 1: Remember the constructor.
Tip 2: You can use an arraylist.

This is how it should look like:

Do you want to input a new book (y/n)?

y

Author:

Jacob Smith

Book title:

Investment Banking

Publisher:

Oxford Press

Do you want to input a new book (y/n)?

y

Author:

Mary Dickins

Book title:

Advanced Econometrics

Publisher:

London Publishing House

Do you want to input a new book (y/n)?

n

The library contains:

2 books

Books:

Jacob Smith, Investment Banking, Oxford Press

Mary Dickins, Advanced Econometrics, London Publishing House

© BrainMass Inc. brainmass.com October 25, 2018, 10:01 am ad1c9bdddf
https://brainmass.com/computer-science/java/java-book-console-application-594715

Solution Preview

This assignment may be accomplished with little coding and I will walk you through it. Always remember there is more than one way to accomplish something in Java. This sounds like a console application so I will keep it limited to the console, examples are listed here and included in a text file.

Imports in Java allow your application to use classes form the Java standard library. In this application you need to use a Scanner so your application may collect user input. this is done by using:

import java.util.*;

Thinking of the Book class, the properties needed are author, title, and publisher. The constructor of the class will help to declare and initialize these properties.

public class Book{

String Author;
String Title;
String Publisher;

public Book(String author, String title,String publisher)
{

Author = author;
Title = title;
Publisher = publisher;

}
public String toString()
{
return this.Author+" ,"+ this.Title+" ...

Solution Summary

This lesson will explain how to create a console application in java that uses the scanner class, array list, anonymous class, and an enhanced for loop to iterate through the array list.

$2.19
See Also This Related BrainMass Solution

Processing and setup Step for the following Oracle App Below.

Put together the processing and setup Step for the following Oracle App Below.

Oracle Processing Setup Step for the following:
Put together the processing and setup Step for the following Oracle App Below.
1. Accounts Receivable
2. Order Management
3. Project Contracts
4. Project management
5. Purchasing
6. Payables
7. Inventory
8. Time & Labor
9. Organization Structure
10. Organization Book of Records
11. Journals
12. General Ledger
13. General Ledger Currency Rates
14. Hyperion
15. Taxpro
16. Financial accounting Controls Hub
17. Concur
18. Payroll
19. Flavours & Energy general ledger
20. Documentum
21. Reporting Ledger
22. Legal Entity
23. Establishment
24. Chart of Accounts, Calendar, Currency & SLAM
25. Jurisdiction
26. Operating Unit
27. Sub ledger Accounting
28. Balancing Segment
29. Primary Ledger
30. Secondary Ledger
31. Multi-Org Access Controls (MOAC)
32. Mapping
33. Costing
34. Billing
35. Cash Management
36. Gap Analysis
37. Ledger Sets
38. Journal Entity
39. Shared Bank Accounts
40. Accounting Structure
41. Flexfield Accounts
42. Balancing Segment
43. Natural Account Segment
44. Cost Center Segment-Global Function
45. Inter Company Segment
46. Management Segment
47. Secondary Tracking Segment
48. Financial Statement
49. Purchase Order
50. Invoice
51. Sourcing
52. Quality
53. Cash Flow
54. Fixed Assets
55. IExpenses
56. Data Integration
57. P2P Integration
58. Procure to Pay
59. E-Business Tax
60. WMS/OBIEE
61. Project Costing
62. Daily Business Intelligence
63. Primavera
64. Data Warehousing Management

View Full Posting Details