Program on car purchasing simulation, Programming Languages

Assignment Help:

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 );


Related Discussions:- Program on car purchasing simulation

Java, non restoring division

non restoring division

Prolog assignment, I have constantly been emailing to get the task i had pa...

I have constantly been emailing to get the task i had paid for to be done correctly but no replies from anyone. Not even one acknowledging my emails. Been phoning all the way from

Return value in an array, A specification of a function TOARR is given belo...

A specification of a function TOARR is given below. function TOARR(n in Int, s in Stack of Int) return in Array of Int pre n ≥ 0. post The returned value is an array of size

Shell script print “gm/afternoon/evening”acc to system time, Normal 0 ...

Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4

Project on automatic payments to employees, A large logistics company requi...

A large logistics company requires a software system to support the business processes associated with managing shift patterns of employees and making the associated payments. The

insertion sort algortihm, Define a higher order version of the insertion s...

Define a higher order version of the insertion sort algortihm. That is define functions insertBy :: Ord b => (a->b) -> a -> [a] -> [a] inssortBy :: Ord b => (a->b) -> [a] ->

Frotran 2000, Please explain about sub programming.

Please explain about sub programming.

Define the control statements in computer programming, Define the Control s...

Define the Control statements in Computer Programming? The statements are part of the program that performs some action. The compiler will check a program sequentially from the

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd