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

Language-integrated query, Language-Integrated Query Language integrated qu...

Language-Integrated Query Language integrated query (LINQ, obvious "link") is a Enthusiasm .NET Structure element that contributes ancient data querying abilities to .NET dialects,

Create a directory, The ?rst task in the project is to develop a sane syste...

The ?rst task in the project is to develop a sane system to store change logs and versions of ?les. The simplest approach is to create a "dot" directory in the location of the ?le

Write a program to draw the fish, Write a program to draw the figure shown ...

Write a program to draw the figure shown below. the program must provide: a. Close the fish's mouth slowly (at least 5 moves from the original position to close the mouth) b.

Define a procedure that takes a list as a single argument, (a) Define a pro...

(a) Define a procedure (subsets x) that takes a list as a single argument and returns all 2^n subsets of that list, i.e. the power set of the list; e.g. (subsets '(a b c)) ==> (

JavaScript Language , JavaScript is "Object Oriented" like C++ or Java. (No...

JavaScript is "Object Oriented" like C++ or Java. (Note that Java and JavaScript are not the same language, which is a common misconception) It also has variables, which makes Java

1 real and 2 complex eigenvalues, 1 Real and 2 Complex Eigenvalues    ...

1 Real and 2 Complex Eigenvalues    From the real eigenvalue/vector pair, l 1 and ?h 1 e l1 t ?h 1 We find the other two solutions in identical manner which we did

Special matrices, Special Matrices There are some "special" matrices o...

Special Matrices There are some "special" matrices out there which we may use on occasion. The square matrix is the first special matrix.  A square matrix is any matrix that s

What are program visible and invisible resisters, What are program visible ...

What are program visible and invisible resisters? A4) Program visible is those registers that can be programmed by the users, or which are customizable, whereas Program invisible

Dbms, 2. Design an ER diagram for an IT training group database that will m...

2. Design an ER diagram for an IT training group database that will meet the information need’training programme. Clearly indicate the entities, relationships and the key constrain

Cmis 102, In this assignment, you will design a program to perform the foll...

In this assignment, you will design a program to perform the following task: Calculate the total price to purchase all the components required to build a state-of-the-art gaming c

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