Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
OPIM3220-CarInventory/VehicleInventory/Car.cs
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
31 lines (27 sloc)
783 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| |
using System; | |
using System.Collections.Generic; | |
using System.Text; | |
// You'll often see that programmers break their code into multiple files | |
// So long as the files are all held in the same namespace, they're accessible | |
// to the rest of your program with no extra work. | |
namespace VehicleInventory | |
{ | |
// Declare a class called car | |
class Car | |
{ | |
// Set properties | |
public string InventoryNumber; | |
public double Year; | |
public string Make; | |
public string Model; | |
public double Mileage; | |
public decimal Price; | |
// Declare a method to get vehicle details | |
public string GetDetails() | |
{ | |
// String interpolation to describe the vehicle | |
return $"{InventoryNumber} - {Year} {Make} {Model} - {Mileage} miles - {Price.ToString("C")}"; | |
} | |
} | |
} |