vishal
BAN USER
- 0of 0 votes
AnswersI have been asked this question in written test. which pattern to use..
- vishal in India
Using Java create a simulation of a car park. The
program will record vehicles entering and exiting the car
park, as well as the total balance of parking fees paid.
Cars can park in the car park for $2 per hour.
Trucks can park in the car park for $3 per hour.
For example a car parked for 2 hours will pay $4
and a truck parked for 2 hours will pay $6.
The program can also be asked for a balance report that
will show how many vehicles have entered and exited,
the number of spaces available and how much money has
been paid so far.
Trucks take up 2 car spaces.
The requirements for the interface:
1. The user records vehicles entering and exiting the
car park.
2. Upon exiting the car park a time in whole hours
spent in the car park is also entered.
3. The user can request a balance report of the car park
at any time.
4. The program can be exited at any time.
5. The program should validate user input.
Provide a production ready solution including source
files, project structure and any testing you have used.
Example #1
--------------------------------------------------
Program: How many spaces does the car park have?
User: 10
User: ENTER CAR
User: ENTER TRUCK
User: REPORT
Program:
Cars Entered: 1
Trucks Entered: 1
Cars Exited: 0
Trucks Exited: 0
Parking Cars: 1
Parking Trucks: 1
Spaces available: 7
Fees paid: $0
User: QUIT
Example #2
--------------------------------------------------
Program: How many spaces does the car park have?
User: 15
User: ENTER CAR
User: ENTER TRUCK
User: EXIT CAR 2
User: REPORT
Program:
Cars Entered: 1
Trucks Entered: 1
Cars Exited: 1
Trucks Exited: 0
Parking Cars: 0
Parking Trucks: 1
Spaces available: 13
Fees paid: $4
User: QUIT| Report Duplicate | Flag | PURGE
Accenture Java Developer
hi jasbir ,
- vishal April 27, 2014who is going to implement the Action interface & hw time entry will work.
Also builder is for creational purpose, dont u think builder is a misfit.
your thoughts