Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

/* * CECS 2223, Computer Programming II Laboratory * Winter 2022, Sec. 05 * Date: January 11, 2023 * Topic: Lab 5 - Composition *

/*
* CECS 2223, Computer Programming II Laboratory
* Winter 2022, Sec. 05
* Date: January 11, 2023
* Topic: Lab 5 - Composition
* File name: lab05.cpp
* YOUR NAME, YOUR ID NUMBER
* This file implements a class named Library
*/
// Which header files should be included?
int menu();
int main() {
// declare a Library object named myBooks
// declare an integer varaible named option and initialize to 0
// implement a do/while iteration control structure which uses the
// value of option as sentinel. First, assign the return value of
// menu to option. Then implement a switch structure that uses
// option as the switching value. The cases must implement the
// actions described in the menu. Don't forget to include the
// default case! If the value of option is 4, the program prints
// the phrase "Closing the library application..." before exit.
// To test you application, addd at least three books to the collection
// and remove at least one.
// print a statement with your personal information using the phrase
// "--- Program developed by [YOUR NAME], ID# [YOUR ID NUMBER] ---"
// where the square brackets and the text within is substituted with your personal
// information. Make sure to add a blank line before and after the phrase is printed.
system(" pause"); // For Visual Studio only!
return 0;
}
// The menu method prints the list of actions and returns the selected one
int menu() {
int choice = 0;
do{
cout << "Select one of the following: ";
cout << "\t1. Add a book to the library ";
cout << "\t2. Remove a book from the library ";
cout << "\t3. Print the book list ";
cout << "\t4. Exit the program ";
cout << " \tYour selection: ";
cin >> choice;
cout << endl;
}while(choice < 1 || choice > 4);
return choice;
}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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_2

Step: 3

blur-text-image_3

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

Oracle 10g Database Administrator Implementation And Administration

Authors: Gavin Powell, Carol McCullough Dieter

2nd Edition

1418836656, 9781418836658

More Books

Students also viewed these Databases questions