Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit


CSIS 1175 – ASSIGNMENT 1 – 50 POINTS


Submission guidelines:

Only one submission allowed. Please perform the following tasks given below.

 Add comments to your code explaining the variables and logic used. Not adding comments to each program and file you are submitting explaining the logic will result in loss of points for each question.

 Create the C# project with your FirstNameLastInitial_Assign1 - **There should be NO SPACES in your PROJECT NAME**. You must use upper and lower cases for the project name. (e.g., if your name is John Smith, then your project must be called JohnS_Assign1).

 After completing the assignment, zip up your entire base folder and submit it via Blackboard before the due date. Late submission will be penalized. 20% late penalty for every 24 hours it is late. The name of your zip file must be the same as your project name. If you do not follow the above instructions, including the file name and subject line, you will get marks deducted.


Rules for Cheating and Plagiarism:

 Sharing your code in any form or manner either via email, phone, sms, whatsapp or through websites, and looking at another student’s code will constitute to cheating.

 In case of cheating both the student that copies and the student that shared or allowed the copying would get Zero and will be reported to the Dean.

 You cannot seek anyone’s (within or outside) effort or help to complete the assignment

 The instructor reserves the right to set up an oral assessment in-lieu of or in support of work submitted.

Task: In this assignment, you will be implementing a C# console application that allows a user to make a dog food ordering system. You must use appropriate data types and names for identifiers.

Class Definition: Define a class called DogFood that has:

Read-only properties (you may use backing fields and properties or just auto-properties) for BrandName (string) and CanUnitPrice (double). These read-only properties are set when each instance/object of the class is created and cannot be changed after that.

In addition to these properties, there is a property called NumCans (int) that corresponds to the number of cans ordered for this particular dog food brand name, which is a read-write property that may be changed later.

Finally, another read-only computed property, BrandTotal (double) is computed NumCans*(CanUnitPrice).

The class must contain needed constructors, and an over-ridden ToString() method to display each product details of BrandName, CanUnitPrice, NumCans, BrandTotal. You need to do background research and look up how to use String.Format() method to return a formatted string instead of directly displaying the formatted string on the console (https://docs.microsoft.com/en-us/dotnet/api/system.string.format?view=netframework-4.8). You may create any additional methods as you see fit.


Main Program:

1. In the main method, create 3 instances (objects) of DogFood by setting BrandName and CanUnitPrice for each of these objects to any size and can unit price of your choice. Note that the product brand names and corresponding can price per unit for each of those three objects are all your choice – e.g., DogFoodObject1 could have a BrandName “Zignature” with CanUnitPrice being $5.25 and so on). Note each of the three DogFood object corresponds to three different brand names, each with its own can unit price – these are set up by you the programmer inside the main program and not set up as input from user.

2. Then use formatted output banner to display a message giving the name of the Dog Food Ordering Company Name (your choice of name), and display the three brand names of dog food available and their corresponding can unit price.

3. Then call the UpdateNumCans (see method definitions below) method three times each time passing one of the three objects you have created. This method takes one DogFood object as its parameter and updates the NumCans based on user input for that DogFood object (e.g. method call for first DogFood object you have created would be UpdateNumCans(DogFoodObj1)).

4. Once number of cans for all three dog food objects have been updated, call the PerformAction(DogFoodObj1, DogFoodObj2, DogFoodObj3) method that is void returning and takes as input the three DogFood objects you have created.


Method Definitions in the Main Program:

1. UpdateNumCans(DogFood anyDogFood) static method in the main program: This is a void method takes one DogFood object as its parameter and updates the Number of Prints based on user input for that object.

a. This method displays the BrandName and CanUnitPrice for that Product object. Then, it prompts the user to enter number of cans needed for that dog food size.

b. Then, the NumCans of that DogFood object is updated based on user input (parse the numeric input as needed). Note here that even though DogFoodObj1 is passed as an input parameter, the NumCans can be updated inside the method because class objects are reference data type, which means it is pass by reference by default.

2. PerformAction(DogFood DogFood1, DogFood DogFood2, DogFood DogFood3) static method in the main program: This void method takes as input three DogFood objects as parameters. It displays three action options for the user using a numbered input: Press 1 for View Order, Press 2 for Update Order and Press 3 for quitting the application.

a. When the user presses 1 (you need to get user input with Readline(), then parse it and check if value == 1, note you need two == when checking if two values are equal in an if statement), call the static method, ViewOrder(DogFood1, DogFood2, DogFood3) that takes the three Product objects as arguments.

b. When the user presses 2, call UpdateOrder(DogFood1, DogFood2, DogFood3) method, which also takes the three Product objects as parameters.

c. When the user presses 3, You will be display a message: “Thank you for ordering the dog foods. Good Bye!”.

3. ViewOrder(DogFood DogFood1, DogFood DogFood2, DogFood DogFood3) static method in the main program: The ViewOrder void method takes the three Product objects as input parameters:

a. Then, call the ComputeOrderSummary(DogFood1, DogFood2, DogFood3, out double totalBeforeDiscount, out double discountAmount) to get the total of all three objects before discount, total discount amount, and grand total after discount. See method definition for ComputeOrderSummary method below.

b. Display all the order details giving

i. each BrandName, CanUnitPrice, NumCans, and BrandTotal. You can use ToString( ) method defined in the class.

ii. totalBeforeDiscount, discount amount, and grand total after discount using an output banner and formatted output.

iii. All monetary values must be formatted using the currency format specifier.

c. At the end of ViewOrder method, call the PerformAction(DogFood1, DogFood2, DogFood3) method again to allow user to choose actions they want to take. Use some form of formatted output to Display the results in a banner of your choice. You may look up how to use String.Format( ) method to return a formatted string instead of directly displaying the formatted string on the console.

4. ComputeOrderSummary(DogFood DogFood1, DogFood DogFood2, DogFood DogFood3, out double totalBeforeDiscount, out double discountAmount) static method in the main program that returns totalAfterDiscount: This method takes the three DogFood objects and:

a. gets as out parameters the totalBeforeDiscount and discountAmount. The totalBeforeDiscount is computed as sum of the BrandTotal of the three dog food objects. If the total amount before discount exceeds $75.00, then the customer gets 15% off – the discountAmount is 15% of the totalBeforeDiscount.

b. returns as double the totalAfterDiscount (totalBeforeDiscount - discountAmount).

5. UpdateOrder(DogFood DogFood1, DogFood DogFood2, DogFood DogFood3) static method in the main program: This method takes the three Product objects as input parameters.

a. It gives a number as options to update the quantities for each of the three product names (e.g., Press 1 to update quantities for “Zignature”, 2 to update quantities for <brand name 2 – whatever name you choose>, and so on for the three dog food object brand names you chose).

b. Depending on what number the user has pressed, update the NumCans, and display a message saying the chosen dog food object NumCans has been updated.

c. Note that the user can only update NumCans for one DogFood object at a time. At the end of UpdateOrder method, call the PerformAction(DogFood1, DogFood2, DogFood3) method again to allow user to choose actions they want to take.

Notes:

You may give additional messages to the user to make the output clearer

You must use any display banner of your choice to give clear output in the console

You must use the method specifications listed above

Any additional methods may be created to accomplish the task

All identifiers must have meaningful names

You will be using String.Format()


Sample Output (given below)

Note here, that the dog food brand names and can unit price for the three dog food brands are entirely your choice – this is just sample.