Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You will write a C# program to help a store owner calculate total sales, returns, and the balance in a given day. The balance is

You will write a C# program to help a store owner calculate total sales, returns, and the balance in a given day. The balance is essentially the difference between total sales and total returns for a day and will be continually updated as the store sells an item and process the return of an item. For this store, balance can be a negative value. The program will ask the owner to input one of four options: S or s (for entering a sales amount), R or r (for entering a return amount), and P or p (printing the totals and balance), Q or q (to quit). Your program will use a loop to check for valid choices. The program will continue taking inputs until the user enters Q or q. Based on the user input, in the Main method, you will use a switch statement to call the following four methods as appropriate:

A) InputAmount: This method will be called to get a double value from the user when the store owner wants to enter a sales or a return amount. This method will take a user input (double type) and return to the value to the main method. The returned amount will be used the by the Main method to pass as a parameter to the appropriate method (SellItem or ReturnItem). The method header will look like this: public static double InputAmount()

B) SellItem: This method will accept three arguments: one value and two references. The callby-value parameter will accept the price of the sold item. The reference parameters will accept the current balance and the total sales. The total sales and the balance will be updated by adding the value of the sold item. The method header will look like this: public static void SellItem(double amount, ref double balance, ref double totalSales)

C) ReturnItem: This method will accept three arguments: one value and two references. Callby-value parameter will accept the price of the returned item. The reference parameters will accept the current balance and the total returns. The total returns and the balance will be updated by adding and subtracting the value of the sold item, respectively. Before the method updates these values, it will ask the user about how many days has passed since the sale of the item. The number of days will be taken as input from the user. If it is more than 30 days, the return will not be processed. The method will return a string which will be either Return processed or Return not accepted. This returned string will be printed in the Main method. The method header will look like this: public static string ReturnItem(double amount, ref double balance, ref double totalReturns)

D) PrintTotals: This method will accept three call-by-value parameters: total sales, total, returns, and final balance. The method will print these values. The method header will look like this: public static void PrintTotals(double totalSales, double totalReturns, double balance)

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

Step: 3

blur-text-image

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

Advances In Databases And Information Systems 14th East European Conference Adbis 2010 Novi Sad Serbia September 2010 Proceedings Lncs 6295

Authors: Barbara Catania ,Mirjana Ivanovic ,Bernhard Thalheim

2010th Edition

3642155758, 978-3642155758

More Books

Students also viewed these Databases questions