Create a system for a simple library

Assignment Help Programming Languages
Reference no: EM131321896

Assignment

Write a console application to meet the following requirements. Create a system for a simple library. The library has a name and a list of books. Each book has a title, author and an int as the id number. Define classes for both the library and the book. The library should have methods for adding a book to the library, to search for a book by title, to display information about all of the books and to delete a book (by title) from the library.

The following conditions apply to the books in the library:

1. Each book's name is unique. There are no duplicate titles. When adding a book, ensure that the title doesn't already exist. If it does exist, don't let the new book be added.

2. There is only one copy of each book in the library.

3. An author may have more than one book in the library.

Complete the code in this incomplete client designed to test the classes and their functionality. You should not change any of the other code in main.

class MainClass

{

public static void Main (string[] args)

{

Library lib = new Library ();

lib.AddBook ("C# *****", "Gesick", 4);

lib.AddBook ("java programming", "Roth", 2);

lib.AddBook ("C++ programming", "Franklin", 1);

lib.AddBook ("unity programming", "Preston", 3);

lib.AddBook ("graphics & multimedia", "Chastine", 5);

printMenu ();

string p = Console.ReadLine ();

p = p.ToUpper ();

char pick = p [0];

while (pick!='Q') {

switch (pick) {

case 'A':

//insert code here for adding a book

break;

case 'S':

//insert code here for finding a book and

//printing its details

break;

case 'D':

//insert code here for displaying all of the books in the library break;

case 'R':

//insert code here for removing a book break;

default:

Console.WriteLine ("\nInvalid choice, please re-enter");

break;

}

printMenu ();

p = Console.ReadLine ();

p = p.ToUpper ();

pick = p [0];

}

Console.WriteLine ("good bye");

}

public static void printMenu ()

{

Console.WriteLine ("\nSelect one of the following:\n\n" +

" A to add a book to the library\n" +

" S to search for a book by title\n" +

" D to display the contents of the library\n" +

" R to remove a book from the library\n" +

" Q to quit this program\n\n");

Console.Write ("enter choice here: ");

}

}

Reference no: EM131321896

Questions Cloud

What part of the unix os requires modification and why : In terms of porting UNIX, what part of the UNIX OS requires modification? why? Follow the instructions showing the command and the screen that appears directly after typing the command.
Label for the independent and dependent variables : Identify and provide a label for the independent and dependent variables.- Indicate the number of levels in the independent variable, and provide a label for each level.
What is the mean time to failure of the disk : The two failure modes are independent of each other, and independent of the age of the disk. What is the mean time to failure of the disk?
Describe how a pn junction works : For the following assignment you may use any source available. Your responses must be in complete sentences, typed, and double spaced. Length is not an issue, just make sure your answer is complete. A few sentences for each question should be fine..
Create a system for a simple library : Write a console application to meet the following requirements. Create a system for a simple library. The library has a name and a list of books. Each book has a title, author and an int as the id number.
Magnitude of the magnetic field : A 1.98-cm by 1.58-cm rectangular coil has 276 turns. The coil rotates at 66rev/s in a magnetic field. If the maximum emf generated by the coil is 25V, what is the magnitude of the magnetic field?
Average kinetic energy of a molecule : Determine the ratio KEN2/KEO2of the average kinetic energy of a molecule of nitrogen to the average kinetic energy of a molecule of oxygen.
Design one way experiment to test given research hypotheses : Design a one-way experiment to test each of the given research hypotheses:- The more a person tries not to think of something, the more he or she will actually end up thinking about it.
Explain the major theoretical paradigms of sociology : Describe the effect that obesity (childhood and / or adult) has had on you personally or your community. Define the basic concepts used in the discipline of sociology. Explain the major theoretical paradigms of sociology

Reviews

Write a Review

Programming Languages Questions & Answers

  Has public variables of the type float called numerator

Has public variables of the type float called numerator, denominator and total. Has a method called 'Add' that returns the sum of numerator and denominator and sets the total variable.

  Design a pseudo code to create the program

Design a pseudo code to create, debug and execute the program. The documentation should include your name, course, program name, due date, programming language used

  Write a windows application that gets names and e-mail

If the value of Write a Windows application that gets names and e-mail addresses from the user and displays a list of all of the user's contacts. Each time the user enters a new contact, he/she should able to see it added to a list of previously s..

  Implement ref integ result in data duplication

Would failure to implement Ref Integ result in data duplication, incorrect data sets, or broken table errors or is there a work around.

  Create modular program to enter monthly costs

Create modular program which ask user to enter monthly costs for the following expenses incurred from operating his or her automobile: loan payment, insurance, gas, oil, tires, and maintenance.

  Now an electric resistor placed in the tank is turned on

an insulated rigid tank initially contains 1.4-kg saturated liquid water and water vapor at 200degc. at this state 25

  Create new program which prompts user for numbers

Create a new program whihc prompts a user for numbers and determines total revenue using following formula: Total Revenue = Price * Quantity.

  Computer sales and repair store system

It is required to design a relational database system for a "realistic" application

  Determine average cpi for program for clock cycle time

The table above illustrates the execution time of two different compiled programs. Determine the average CPI for each program given that processor has clock cycle time of 1 nS.

  Write a function to circulate a list

Write a function to circulate a list. The function takes two paramaters, the first defines how many elements of the list to circulate, and the second is the list. The output should be the circulated list.

  Prepare a presentation on backgrounds and fonts

Can you still read the text? Is it too narrow or thick? Is an icon hidden by the background? You should also include tips for choosing backgrounds and fonts.

  Research on programmer defined functions

Write a 2 page research paper (excluding title and reference pages) on programmer-defined functions. Explain the concepts discussed in the textbook using at least an example not included in the textbook.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd