Skip to content

Commit 42b3ba3

Browse files
committed
Add project files.
1 parent 0964e3b commit 42b3ba3

File tree

8 files changed

+621
-0
lines changed

8 files changed

+621
-0
lines changed

Car.cs

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace PROG8051_Assign3
8+
{
9+
internal class Car : Vehicle
10+
{
11+
public override string Type { get => "CAR"; }
12+
13+
protected int Seats;
14+
protected string EngineType;
15+
protected string Transmission;
16+
protected bool Convertible;
17+
18+
public Car() { }
19+
20+
public int getSeats()
21+
{
22+
return Seats;
23+
}
24+
25+
public void setSeats(int value)
26+
{
27+
Seats = value;
28+
}
29+
30+
public string getEngineType()
31+
{
32+
return EngineType;
33+
}
34+
35+
public void setEngineType(string value)
36+
{
37+
EngineType = value;
38+
}
39+
40+
public string getTransmission()
41+
{
42+
return Transmission;
43+
}
44+
45+
public void setTransmission(string value)
46+
{
47+
Transmission = value;
48+
}
49+
50+
public bool getConvertible()
51+
{
52+
return Convertible;
53+
}
54+
55+
public void setConvertible(bool value)
56+
{
57+
Convertible = value;
58+
}
59+
60+
public override void DisplayDetails()
61+
{
62+
base.DisplayDetails();
63+
64+
Console.WriteLine($"Seats: \"{Seats}\"");
65+
Console.WriteLine($"EngineType: \"{EngineType}\"");
66+
Console.WriteLine($"Transmission: \"{Transmission}\"");
67+
Console.WriteLine($"Convertible: \"{Convertible}\"");
68+
}
69+
}
70+
}

Motorcycle.cs

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace PROG8051_Assign3
8+
{
9+
internal class Motorcycle : Vehicle
10+
{
11+
public override string Type { get => "MOTORCYCLE"; }
12+
13+
protected double EngineCapacity;
14+
protected string FuelType;
15+
protected bool HasFairing;
16+
17+
public double getEngineCapacity()
18+
{
19+
return EngineCapacity;
20+
}
21+
22+
public void setEngineCapacity(double value)
23+
{
24+
EngineCapacity = value;
25+
}
26+
27+
public string getFuelType()
28+
{
29+
return FuelType;
30+
}
31+
32+
public void setFuelType(string value)
33+
{
34+
FuelType = value;
35+
}
36+
37+
public bool getHasFairing()
38+
{
39+
return HasFairing;
40+
}
41+
42+
public void setHasFairing(bool value)
43+
{
44+
HasFairing = value;
45+
}
46+
47+
public override void DisplayDetails()
48+
{
49+
base.DisplayDetails();
50+
51+
Console.WriteLine($"EngineCapacity: {EngineCapacity}");
52+
Console.WriteLine($"FuelType: {FuelType}");
53+
Console.WriteLine($"HasFairing: {HasFairing}");
54+
}
55+
}
56+
}

PROG8051 Assign3.csproj

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net8.0</TargetFramework>
6+
<RootNamespace>PROG8051_Assign3</RootNamespace>
7+
<ImplicitUsings>enable</ImplicitUsings>
8+
<Nullable>enable</Nullable>
9+
</PropertyGroup>
10+
11+
</Project>

PROG8051 Assign3.sln

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.9.34701.34
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PROG8051 Assign3", "PROG8051 Assign3.csproj", "{3A3849D9-9AD6-4795-A9A1-AA4D2FC51382}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{3A3849D9-9AD6-4795-A9A1-AA4D2FC51382}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{3A3849D9-9AD6-4795-A9A1-AA4D2FC51382}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{3A3849D9-9AD6-4795-A9A1-AA4D2FC51382}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{3A3849D9-9AD6-4795-A9A1-AA4D2FC51382}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {729AEAE1-3FE4-49E1-ADA6-2F619BB495C5}
24+
EndGlobalSection
25+
EndGlobal

Program.cs

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
using System.Diagnostics;
2+
using PROG8051_Assign3;
3+
4+
class Program
5+
{
6+
static void Main(string[] args)
7+
{
8+
Console.WriteLine("Welcome to VRMS - Your very own vehicle rental management system");
9+
10+
RentalAgency rentalAgency = new RentalAgency();
11+
12+
// mock inventory data
13+
14+
Car car = new Car();
15+
16+
car.setModel("2024 Tesla Model 3");
17+
car.setManufacturer("Tesla");
18+
car.setYear(2024);
19+
car.setSeats(5);
20+
car.setEngineType("Electric");
21+
car.setTransmission("1-speed direct drive");
22+
car.setConvertible(false);
23+
car.setRentalPrice(145);
24+
Truck truck = new Truck();
25+
26+
truck.setModel("2024 Hyundai Santa Cruz SE");
27+
truck.setManufacturer("Hyundai");
28+
truck.setYear(2024);
29+
truck.setCapacity(1411);
30+
truck.setTruckType("Pickup");
31+
truck.setFourWheelDrive(false);
32+
truck.setRentalPrice(120);
33+
34+
Motorcycle motorcycle = new Motorcycle();
35+
36+
motorcycle.setModel("MT-07");
37+
motorcycle.setManufacturer("Yamaha");
38+
motorcycle.setYear(2014);
39+
motorcycle.setEngineCapacity(3.7);
40+
motorcycle.setFuelType("Gas");
41+
motorcycle.setHasFairing(false);
42+
motorcycle.setRentalPrice(165);
43+
44+
rentalAgency.Fleet.Add(car);
45+
rentalAgency.Fleet.Add(truck);
46+
rentalAgency.Fleet.Add(motorcycle);
47+
48+
car.DisplayDetails();
49+
truck.DisplayDetails();
50+
motorcycle.DisplayDetails();
51+
52+
rentalAgency.init();
53+
}
54+
}

0 commit comments

Comments
 (0)