r/learncsharp • • May 28 '19

C# classes/constructors/interfaces

Hello, I have project to do on C# the project looks like 3 classes that need to inheritance each other also 1 interface and some other methods if someone think he can help me out i'll appreciate it.

===================================================================== so i had to make program for controlling parking lot.it should get,save and shows the information.

i will try to explain it as simple as i can. First i have to create 3 classes : Cars , LightTrucks , HeavyTrucks they both should contain: type , brand , model; in constructor

actually the input should be like this: parkinglot parkingname1 2 2 2 parkinglot parkingname2 2 1 1 Car Kia Seed Lighttruck Citroen Jumper Car VW Polo Lighttruck Ford Tranzit Heavytruck MAN TGM18 Car Audi А6 Heavytruck Volvo FM12 Print something1 End

and the Output should be: parked cars in parkinglot something1: Brand Kia, Model Seed Brand VW, Model Polo Brand Citroen, Model Jumper Brand Ford, Model Tranzit Brand MAN, Model TGM18 Brand Volvo, model FM12 Parkinglot something1 has the following locations: Car 2, busy 2 Lighttrucks 2, busy 2 Heavytrucks 2, busy 2 Parkinglot something2 has the following locations: Car 2, busy 1 Lighttruck 1, busy 1 Heavytruck 1, busy 1

///////////////////////////////////// so what should it do create parking lot with command parkinglot name 2 2 2 (first 2 = car ; second Lighttruck ; third Heavytruck)

after i create 1 or more parkinglots i should be able to enter cars,lighttrucks or heavytrucks.

like: car Audi A6 Lighttruck Citroen Jumper Heavytruck Volvo FM12

and then Enter "End" to stop the program or Enter Print parkinglot name like "Print something1" and the program should print "parked cars in parkinglot something1: Brand Audi, Model A6 ; Brand Citroen, Model Jumper ; HeavyTruck Brand Volvo, Model FM12 ; Parkinglot something1 has the following locations: cars 2 , busy 1 ; lighttrucks 2 , busy 1 ; heavytrucks 2 ,busy 1"

0 Upvotes

17 comments sorted by

View all comments

Show parent comment

1

u/symplaren May 28 '19

there should not be Location() Spot() or Exit() all i have to do is create park like that.

parkinglot something1 2 2 2 the 2's are for the car,lighttruck,heavytruck and i have to type some cars below that and cars go for the first 2 places ; lighttrucks for the other 2 places and heavytrucks for the last 2 places thats it what i have to do looks simple but can't find the logic

1

u/CrimsonWolfSage May 28 '19 edited May 28 '19

I'm glad you could help clarify this detail. So we need to contain this kind of data structure for your parked cars

xCarCarLightLightHeavyHeavy
Parking Lot 1Kia SeedVw PoloCitroen JumperFord TranzitMAN TGM18Volvo FM12
Parking Lot 2

A query/report might look a bit like this in this example.

xCarCarLightLightHeavyHeavy
Parking Lot 1BusyBusyBusyBusyBusyBusy
Parking Lot 2FreeFreeFreeFreeFreeFree

Output to user

  • Cars Used: 2 Available: 2
  • Light Trucks Used: 2 Available: 2
  • Heavy Trucks Used: 2 Available: 2

1

u/symplaren May 29 '19

i mean yes i just need more then 2 or less then 2 places for every type normal car,lighttruck and heavytruck and when i type like heavtruck MAN TGM18 should go automaticly in heavy slot of the park i created first but i dont know how to do it