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

Python, please decode the following as it is answer for my assisgnment for ...

please decode the following as it is answer for my assisgnment for python: Ñò üOLOc  @ s‚ d „ Z d „ Z g Z xYe oQe ƒ e d ƒ i ƒ Z e d j oI e d

Get variable data, How do i get back data from a FOR loop in order to prin...

How do i get back data from a FOR loop in order to print them on screen?

Calculate the total price to purchase all the components req, Calculate the...

Calculate the total price to purchase all the components required to build a state-of-the-art gaming computer from components available on the internet. Before attempting this exer

Pascal, Problem Solving 1. Write Pascal code that accepts as input the nam...

Problem Solving 1. Write Pascal code that accepts as input the names of the students, course work score and exam score for a unspecified number of students who have taken a subjec

Develop a program on behavior of hospital personnel, A psychologist is inte...

A psychologist is interested in learning about the voting behavior of college students.  (4 points for each part.)Design a study which would yield data on this topic. a. state y

Display files specified in directory in format, W.A.S.S to display all the ...

W.A.S.S to display all the files in a specified directory in the following format: File  size in K        Date   Protection    Owner Program echo -e "Enter dir : \c" read di

I have to create three batch files, I have to create a bank atm machine usi...

I have to create a bank atm machine using MS-DOS. I am struggling to create LIST ALL ACCOUNTS ROLL-BACK TRANSACTIONS ACCESS AN ACCOUNT

Shell script for a given number is armstrong number or not, Normal 0 ...

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

What are the Functions in Computer Programming, What are the Functions in C...

What are the Functions in Computer Programming? A program is completed up of one or more functions, with one of these being main(). Function is a self-contained block of progra

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