need this to be created in C# please help thank you Create an Auto Garage Applic
ID: 3881564 • Letter: N
Question
need this to be created in C# please help thank you
Create an Auto Garage Application
This application should use a console interface to allow management of automotive repairs at an auto repair/body shop style business. The business in question has five bays to use when working on vehicles and does not store any other vehicles on site or in this program.
The program should begin with a main menu allowing the user to display the status of the bays, modify information concerning one of the bays, or exit the program.
When editing a bay, a second menu should allow a user to add a vehicle to the bay, edit/replace the information for a vehicle currently in a bay, remove a vehicle information to clear the bay, or print a "receipt" summary of the services being performed on an existing vehicle. Finally this menu should allow the user to return to the previous menu.
Adding and editing a vehicle should allow the user to capture enough information about the vehicle to identify it, information about the owner to contact when work is complete and up to 3 services to be performed on the vehicle. Each service should have a description, hours estimated, parts cost and labor cost. All data entry should be validated to the expected data types.
When printing the "receipt" a summary of the above information should be presented to the user.
Each vehicle should be defined using a Class. Each service item on a vehicle should be defined using a class. The vehicle bay contents and the services performed should be managed using array structures.
All menu options should be performed using functions in a separate class from Program (either the vehicle/bay class or another). There should be no use of the Console .NET class within the Main method.
**************************************************************************
The main program to hold the following;
**************************************************************
// The project called VehicleBay
namespace Example_Assignment2
{
class Program
{
static void Main(string[] args)
{
//This is the starting point for this program.
//It can contain loops and decision making if you'd like but should not contain any Console methods.
//Create an array of VehicleBay objects and create a new instance of each to set them all to a default "empty" state
//Include a welcome method here
//OUTER LOOP
//Begin a loop controlled by the menu below
//Call the MainMenu method
//Make a decision based on the value returned by MainMenu
//Exit: Exit this loop which should let the program proceed to the end
//Display: Call DisplayStatuses method
//Modify: Begin a new loop for a second menu
//should also capture which bay is being modified
//INNER LOOP
//Call the VehicleMenu method
//Make a decision based on the value returned by the VehicleMenu method
//Add: Call AddVehicle, if it does not return null (see below) update the VehicleBay array
//Remove: Update the VehicleBay array so that the bay modified is set back to "empty"
//Print: Call PrintReceipt for the VehicleBay object being modified
//Edit: Call VehicleEditMenu of the VehicleBay object being modified
//Return to previous menu: this will exit this loop and return the user to the outer loop
//END INNER LOOP
//END OUTER LOOP
//A summary/goodbye method would go here.
}
//All of these static methods could also be created as static methods of the VehicleBay class
static string MainMenu()
{
//This menu will display the choices available to a user and return the choice they made back
//to the location that called it
//Present the menu choices to the user
//Collect user input
//Validate that input against the options provided
return "ValidatedUserInput";
}
static string VehicleMenu()
{
//Present the menu choices to the user
//Collect user input
//Validate that input against the options provided
return "ValidatedUserInput";
}
static void DisplayStatuses() //This should take the VehicleBay array as a parameter
{
//This should loop through the array and call the DisplayStatus method for each
}
static VehicleBay AddVehicle(int bayNumber)
{
//This method should only proceed if the bay specified is empty
//This method should gather information from the user about the vehicle (not the service options yet)
//This method should create an instance of the VehicleBay class using the gathered information
//This method should return that instance object
//Example creation and return statements
VehicleBay newVehicle = new VehicleBay();
return newVehicle;
//If you run into any issues, you can return a null value telling the calling method you were not successful
return null;
}
}
}
*********************************************************************************************
Then Class one to attach to the Main above
***********************************************************************
// Class one
namespace Example_Assignment2
{
class ServiceItem
{
//Attributes and properties
//These should hold information about a specific service task
}
}
**************************************************************************************
Class 2 within the main program holds the following;
*******************************************************************************
// Class two
amespace Example_Assignment2
{
class VehicleBay
{
//Attributes and properties
//Some attributes to identify the vehicle in the bay
//An array of the ServiceOption class to hold the service options chosen
//Constructor(s)
//The constructor(s) should initialize any arrays and provide default values for any attributes not passed in as parameters
//Methods
public void DisplayStatus()
{
//This will display the current status of the bay using the attributes above
}
public void PrintReceipt()
{
//This will use Console commands to provide a summary of the vehicle information and the work performed (include the data from the ServiceItem array)
}
public void VehicleEdit()
{
//Present the menu choices to the user
//If the user chooses to edit the vehicle information, gather information like in AddVehicle
//and update the properties of the vehicle
//If the user choose to add/edit/remove a service, ask them which service (there are up to 3)
//Once you know which service, update that element of the ServiceItemArray (gathering information as needed)
}
}
}
Explanation / Answer
using System;
public class Car : Object
{
public delegate void CarDelegate(Car c);
public class Radio
{
public Radio(){}
public void TurnOn(bool on)
{
if(on)
Console.WriteLine("Jamming...");
else
Console.WriteLine("Quiet time...");
}
}
private int currSpeed;
private int maxSpeed;
private string petName;
private bool dead;
private bool isDirty;
private bool shouldRotate;
private Radio theMusicBox;
public bool Dirty
{
get{ return isDirty; }
set{ isDirty = value; }
}
public bool Rotate
{
get{ return shouldRotate; }
set{ shouldRotate = value; }
}
public Car()
{
maxSpeed = 100;
dead = false;
theMusicBox = new Radio();
}
public Car(string name, int max, int curr, bool dirty, bool rotate)
{
currSpeed = curr;
maxSpeed = max;
petName = name;
dead = false;
isDirty = dirty;
shouldRotate = rotate;
theMusicBox = new Radio();
}
public void CrankTunes(bool state)
{
theMusicBox.TurnOn(state);
}
public void SpeedUp(int delta)
{
if(dead)
Console.WriteLine("Car is already dead...");
else
{
currSpeed += delta;
if(currSpeed >= maxSpeed)
dead = true;
else
Console.WriteLine(" CurrSpeed = " + currSpeed);
}
}
}
using System;
using System.Collections;
public class Garage
{
ArrayList theCars = new ArrayList();
public Garage()
{
theCars.Add(new Car("Viper", 100, 0, true, false));
theCars.Add(new Car("Fred", 100, 0, false, false));
theCars.Add(new Car("BillyBob", 100, 0, false, true));
theCars.Add(new Car("Bart", 100, 0, true, true));
theCars.Add(new Car("Stan", 100, 0, false, true));
}
public void ProcessCars(Car.CarDelegate proc)
{
foreach(Delegate d in proc.GetInvocationList())
{
Console.WriteLine("***** Calling: {0} *****",
d.Method.ToString());
}
if(proc.Target != null)
Console.WriteLine(" -->Target: " + proc.Target.ToString());
else
Console.WriteLine(" -->Target is a static method");
foreach(Car c in theCars)
proc(c);
Console.WriteLine();
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.