Question: You will write a C# program for a small bookstore to track daily number of sold books, number of books received as donations, and current
You will write a C# program for a small bookstore to track daily number of sold books, number
of books received as donations, and current inventory. The inventory is the total number of books
available for sale and is updated as books are sold or donated. For this bookstore, the inventory
can increase with donations and decrease with sales. The bookstore maintains a maximum
inventory size due to space limitations Define a constant MAXINVENTORY to maintain this
maximum inventory size. You can assign a value of your choice for this constant. The program
will prompt the user to input one of four options: S or sto enter a sale transactionD or d
to enter a donationP or pto print the totals and current inventoryQ or qto quit Your
program will utilize a loop to ensure only valid choices are made. The program continues to accept
inputs until Q or q is entered. Based on the user input, in the Main method, you will use a switch
statement to call the following four methods as appropriate:
A InputNumberOfBooks: This method prompts the user to enter an integer value number
of books when they want to record a sale or donation. This method will take an integer
input from the user and return this value to the Main method. The returned amount will
then be passed as a parameter to the appropriate method ProcessSale or
AcceptDonation The method signature will be:
public static int InputNumberOfBooks
B ProcessSale: This method takes three arguments: one value and two references. The callbyvalue parameter will accept the number of books sold. The reference parameters will
accept the current inventory and the total number of books sold. The total book sales and
the inventory will be updated in this method. The method signature will be:
public static void ProcessSaleint numberOfBooks, ref int inventory, ref int totalSales
C AcceptDonation: This method takes four arguments: two values and two references. The
callbyvalue parameters will accept the number of books donated and the maximum
inventory size. The reference parameters will accept the current inventory and the total
donations. The total donations and the inventory will be updated by adding the number of
donated books. Donations will be accepted only if the inventory does not exceed the
maximum inventory size. The method will return a string which will be either Donation
accepted or Donation not accepted This returned string will be printed in the Main
method. The method signature will be:
public static string AcceptDonationint numberOfBooks, int maxInventory, ref int
inventory, ref int totalDonations
D PrintTotals: This method will accept three callbyvalue parameters: total sales, total
donations, and current inventory. It will print these values to provide a summary of the
bookstore's operations for the day. The method signature will be:
public static void PrintTotalsint totalSales, int totalDonations, int inventory
Submission Instructions:
Important: You are NOT allowed to use arrays for this assignment. Do NOT use any C#
languagefeatures that has not been taught in the class. Check the lecture slides to verify this.
Some concepts may exist in the textbook, but we did not learn those in the class. You are NOT
allowed to use these. Submissions that utilize any C# languagefeatures beyond the lecture slides
will automatically receive in the assignment.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
