1. Engineering
  2. Computer Science
  3. part 1 this assignment will test your knowledge of the...

Question: part 1 this assignment will test your knowledge of the...

Question details

PART 1

This assignment will test your knowledge of the following areas:

  • Coding classes with properties
  • Coding a class that inherit from another
  • Coding abstract classes
  • Throwing exceptions
  • Coding static classes

Introduction

This phase of the project will have you begin development on a library

Requirements

Visual Studio Solution

Create a new Visual Studio Solution named LibraryFirstLast, where First and Last correspond to your first and last names.

Create a Class Library project named Library in the new solution named.

SalesQuote Class

Add a class called SalesQuote to the RRCAGLibrary project. Copy your code from the previous assignment into this file.

Update the SalesQuote class to replace methods with properties.

Properties

+ VehicleSalePrice : decimal - Gets and sets the sale price of the vehicle.

+ TradeInAmount : decimal - Gets and sets the trade in amount.

+ AccessoriesChosen : Accessories - Gets and sets the accessories that were chosen.

+ ExteriorFinishChosen : ExteriorFinish - Gets and sets the exterior finish that was chosen.

+ AccessoryCost : decimal - Gets the cost of accessories chosen.

+ FinishCost : decimal - Gets the cost of the exterior finish chosen.

+ SubTotal : decimal - Gets the sum of the vehicle’s sale price and the Accessory and Finish Cost.

+ SalesTax : decimal - Gets the amount of tax to charge based on the subtotal.

+ Total : decimal - Gets the sum of the subtotal and taxes.

+ AmountDue : decimal - Gets the result of subtracting the trade-in amount from the total.

Exceptions

Update the SalesQuote class to include the following exceptions:

VehicleSalePrice Property

  • ArgumentOutOfRangeException - When the property is set to less than or equal to 0. Message: “The value cannot be less than or equal to 0.”

TradeInAmount Property

  • ArgumentOutOfRangeException - When the property is set to less than 0. Message: “The value cannot be less than 0.”

SalesQuote(decimal, decimal, decimal, Accessories, ExteriorFinish)

  • ArgumentOutOfRangeException - When the vehicle sale price is less than or equal to 0. Message: “The argument cannot be less than or equal to 0.”
  • ArgumentOutOfRangeException - When the trade in amount is less than 0. Message: “The argument cannot be less than 0.”
  • ArgumentOutOfRangeException - When the sales tax rate is less than 0. Message: “The argument cannot be less than 0.”
  • ArgumentOutOfRangeException - When the sales tax rate is greater than 1. Message: “The argument cannot be greater than 1.”

SalesQuote(decimal, decimal, decimal)

  • ArgumentOutOfRangeException - When the vehicle sale price is less than or equal to 0. Message: “The argument cannot be less than or equal to 0.”
  • ArgumentOutOfRangeException - When the trade in amount is less than 0. Message: “The argument cannot be less than 0.”
  • ArgumentOutOfRangeException - When the sales tax rate is less than 0. Message: “The argument cannot be less than 0.”
  • ArgumentOutOfRangeException - When the sales tax rate is greater than 1. Message: “The argument cannot be greater than 1.”

Invoice Class

This abstract class contains functionality that supports the business process of creating an invoice.

Note: Do not add any additional fields, properties or methods to this class. Additions to the class diagram below will result in deductions during evaluation of your assignment.

Create the Invoice class in the Library project. This class must be defined under the Last.First.Business namespace.

Fields

- provincialSalesTaxRate : decimal - The provincial sales tax rate applied to the invoice.

- goodsAndServicesTaxRate : decimal - The goods and services tax rate applied to the invoice.

Properties

+ ProvincialSalesTaxRate : decimal - Gets and sets the provincial sales tax rate.

Exceptions:

  • ArgumentOutOfRangeException - When the property is set to less than 0. Message: “The value cannot be less than 0.”
  • ArgumentOutOfRangeException - When the property is set to greater than 1. Message: “The value cannot be greater than 1.”

+ GoodsAndServicesTaxRate : decimal - Gets and sets the goods and services tax rate.

Exception:

  • ArgumentOutOfRangeException - When the property is set to less than 0. Message: “The value cannot be less than 0.”
  • ArgumentOutOfRangeException - When the property is set to greater than 1. Message: “The value cannot be greater than 1.”

+ ProvincialSalesTaxCharged : decimal (Abstract) - Gets the amount of provincial sales tax charged to the customer.

+ GoodsAndServicesTaxCharged : decimal (Abstract) - Gets the amount of goods and services tax charged to the customer.

+ SubTotal : decimal (Abstract) - Gets the subtotal of the Invoice.

+ Total : decimal - Gets the total of the Invoice (Subtotal + Taxes).

Methods

+ Invoice(decimal, decimal) - Initializes an instance of Invoice with a provincial and goods and services tax rates.

Parameters:

  • provincialSalesTaxRate - The rate of provincial tax charged to a customer.
  • goodsAndServicesTaxRate - The rate of goods and services tax charged to a customer.

Exceptions:

  • ArgumentOutOfRangeException - When the provincial sales tax rate is less than 0. Message: “The argument cannot be less than 0.”
  • ArgumentOutOfRangeException - When the provincial sales tax rate is greater than 1. Message: “The argument cannot be greater than 1.”
  • ArgumentOutOfRangeException - When the goods and services tax rate is less than 0. Message: “The argument cannot be less than 0.”
  • ArgumentOutOfRangeException - When the goods and services tax rate is greater than 1. Message: “The argument cannot be greater than 1.”

ServiceInvoice Class

This class contains functionality that supports the business process of creating an invoice for the service department. The ServiceInvoice class derives from the Invoice class.

Note: Do not add any additional fields, properties or methods to this class. Additions to the class diagram below will result in deductions during evaluation of your assignment.

Create the ServiceInvoice class in the Library project. This class must be defined under the Last.First.Business namespace.

Properties

+ LabourCost : decimal - Gets the amount charged for labour.

+ PartsCost : decimal - Gets the amount charged for parts.

+ MaterialCost : decimal - Gets the amount charged for shop materials.

+ ProvincialSalesTaxCharged : decimal - Gets the amount of provincial sales tax charged to the customer. Provincial Sales Tax is not applied to labour cost.

+ GoodsAndServicesTaxCharged : decimal - Gets the amount of goods and services tax charged to the customer.

+ SubTotal : decimal - Gets the subtotal of the Invoice.

+ Total : decimal - Gets the total of the Invoice.

Note: The LabourCost, PartsCost and MaterialCost properties have a private set accessor.

Methods

+ ServiceInvoice(decimal, decimal) - Initializes an instance of ServiceInvoice with a provincial and goods and services tax rates.

Parameters:

  • provincialSalesTaxRate - The rate of provincial tax charged to a customer.
  • goodsAndServicesTaxRate - The rate of goods and services tax charged to a customer.

Exceptions:

  • ArgumentOutOfRangeException - When the provincial sales tax rate is less than 0. Message: “The argument cannot be less than 0.”
  • ArgumentOutOfRangeException - When the provincial sales tax rate is greater than 1. Message: “The argument cannot be greater than 1.”
  • ArgumentOutOfRangeException - When the goods and services tax rate is less than 0. Message: “The argument cannot be less than 0.”
  • ArgumentOutOfRangeException - When the goods and services tax rate is greater than 1. Message: “The argument cannot be greater than 1.”

+ AddCost(CostType, decimal) : void - Increments a specified cost by the specified amount.

Parameters:

  • costType - The type of cost being incremented.
  • amount - The amount the cost is being incremented by.

Exceptions:

  • ArgumentOutOfRangeException - When the amount is less than or equal to 0. Message: “The argument cannot be less than or equal to 0.”
Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution