// Creates a Car class // You can construct a Car using a price and color // or
ID: 3657324 • Letter: #
Question
// Creates a Car class // You can construct a Car using a price and color // or just a price, in which case a Car is black // or no parameters, in which case a Car is $10,000 and black using System; public class DebugSeven3 { public static void Main() { Car myCar = Car("red", 32000); Car yourCar = Car(14000); Car theirCar = Car(); Console.WriteLine("My {0} car cost {1}", myCar.Color, myCar.Price.ToString(c2)); Console.WriteLine("Your 0} car cost {1}", yourCar.Color, yourCar.Price.ToString("c2")); Console.WriteLine("Their {0} car cost {1}", theirCarColor, theirCar.price.ToString("c2")); } } class Car { private string color; private int price; public Car() : this(10000, "black") { } public Car(int price) : this("black") { } public Car(int price, string color) { price = Price; Color = color; } public string Color { get { return color; } set { color = value; } } public int Price { get { return price; } set { price = value2; } } }Explanation / Answer
#include #include enum COLOR{red,blue,green,black,white}; typedef char * String; class car { private: COLOR color; float price; String company; public: car(); car(COLOR,float,String); void showvalue() const; }; car::car(): color(white), price(0.0), company("") {} car::car(COLOR c,float p,String com) { this->color=c; this->price=p; company=com; } void car::showvalue() const { coutRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.