introductiona new online system for purchasing


Introduction

A new online system for purchasing carsis being designed and you have been contracted to write a C# console application program that models the proposed functionality of this system.

AssignmentDetails

You are required to produce a program written in C#, which will model the functions of both purchasing and exchanging cars.

The program will display a list of possible actions, read in the user's choice and then perform the required action.  The user will be able to select any action from the menu and the program will be able to handle the situation.

Here is avery high-level algorithm of the assignment design:

While not finished

                Display list of possible actions

                Input the user's option

                Perform the required action

        End while

 Assignment Specification

A number of assumptions have been made so that the assignment can be completed using only the concepts covered in Lessons 1 to 4.  You are free to use any valid programming constructs even if they have not been covered in lessons so far.

Our model of a Car Purchasing System will permit the user to choose from the following main menu:

  • Obtain a price for any car type
  • Purchase any car type
  • Exchange a car owned by the user for another car
  • Exit the simulation

Seethe sample screen interactions at the end of this document for further details.

All input should be checked that it is within the acceptable range.  If input is not within the acceptable range, then the user should be informed of the range and requested to re-enter the input.

When a user chooses an action, it will affect the state of the Car Purchasing System as follows:

  • Obtain a price for any car type:(CheckPrice)
    The list of car types is displayed
    1. Sedan
    2. Coupe
    3. Ute
    4. Convertible
    5. 4WD

The user will select one of these or choose to cancel this selection

If the user has selected a car type,then the current date and time is displayed along with the price for that car.

o   The user will select one of these or choose to cancel this selection

o   If the user has selected a car type,then the current date and time is displayed along with the price for that car.

  • Purchase any car type (PurchaseCar)
    • The list of car types is displayed
    • The user will select one of these or choose to cancel this selection
    • If the user has selected a car type:
      • Prompt the user for the amount to be paid.
      • Amount to be paid needs to be:
  • a multiple of $50
  • greater than 10% of the car price - paid as a deposit to reserve the car
  • not greater than the car price
      • If the amount entered is not a multiple of $50, no transaction occurs and the user is asked to enter different amount
      • If the amount entered is not greater than 10% of the car price, no transaction occurs and the user is informed that they must pay at least 10% of the car price to reserve the car
      • If the amount entered greater than the car price, no transaction occurs and the user is informed that they cannot pay more than the car is worth
      • If the amount entered is a multiple of $50, is greater than 10% of the car price but not greater than the car price, then the user is asked for their name and a transaction occurs
  • Exchange a car owned by the user for another car (ExchangeCar)
    • Prompt the user to choose which car type they already own
    • The list of car types is displayed
    • User will select one of these or choose to cancel this selection
    • If the user has selected a car type, the user will be asked to choose which car type they would like to exchange their car for.
    • If they select a car type to exchange:
      • There is an exchange fee of $500 that is required for each exchange.
      • If the car owned by the user costs less than the exchange car plus exchange fee, the user is informed that they have insufficient credit for that transaction and no exchange occurs.
      • A summary of the exchange is displayed
  • Exit the simulation
    • A terminating message is displayed.

Some initial work had already been done on this project and the following specification of various methods has been developed and agreed upon with the client. You are required to use these methods.

void CheckPrice(int carType)

Action: Current time and date is displayed along with the price indicated by the carType.

void PurchaseCar(int carType, double amountPaid)

Action: Provided that the amount paid is greater than 10% of the car price but not greater than the car price, the car is indicated by carType is purchased.

void CarTransaction(int carType)

Action:  Displays a message consisting of the car type now owned by the user.

void ExchangeCar(int fromCar, int toCar)

Action: Provided that the car owned does not cost less than the exchange car plus exchange fee, the user exchanges one car type for another.

Assumptions

We assume the following for our simulation:

  • The system has an endless supply of cars for purchasing.
  • The user will input data values of the correct type when requested to do so. This means that if an integer is expected, then an integer value is entered.
  • The car types and default prices are listed below:

Car Type

Price

Sedan

$17,000

Coupe

$21,000

Ute

$23,500

Convertible

$27,700

4WD

$28,000

  • The car types and any constants may be class variables; all other variables are to be local variables.
  • To print the current date and time,use the following code:

DateTime date = DateTime.Now;

Console.WriteLine("Current Date: {0:f} ", date );

Request for Solution File

Ask an Expert for Answer!!
Application Programming: introductiona new online system for purchasing
Reference No:- TGS0205516

Expected delivery within 24 Hours