a. Create a class named Order that performs order processing of a single item that sells for $19.95 each. Th e class has four variable fi elds: order number, customer name, quantity ordered, and total...


a. Create a class named Order that performs order processing of a single item that sells for $19.95 each. Th e class has four variable fi elds: order number, customer name, quantity ordered, and total price. Create a constructor that requires parameters for all the fi elds except total price. Include public get and set accessors for each fi eld except the total price fi eld; that fi eld is calculated as quantity ordered times unit price (19.95) whenever the quantity is set, so it needs only a get accessor. Also create the following for the class: An • Equals() method that determines two Orders are equal if they have the same order number A • GetHashCode() method that returns the order number A • ToString() method that returns a string containing all order information Write an application that declares a few Order objects and sets their values, making sure to create at least two with the same order number. Display the string from the ToString() method for each order. Write a method that compares two orders at a time and displays a message if they are equal. Send the Orders you created to the method two at a time and display the results. Save the fi le as OrderDemo.cs. b. Using the Order class you created in, write a new application that creates an array of fi ve Orders. Prompt the user for values for each Order. Do not allow duplicate order numbers; force the user to reenter the order when a duplicate order number is entered. When 484 CHAPTER 10 Introduction to Inheritance Apago PDF Enhancer fi ve valid orders have been entered, display them all, plus a total of all orders. Save the program as OrderDemo2.cs.

May 19, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here