Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8303407
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T17:31:58+00:00 2026-06-08T17:31:58+00:00

Ok, here is my assignment at school. Create a console application named CreateVehicle. Develop

  • 0

Ok, here is my assignment at school.

  1. Create a console application named CreateVehicle.
  2. Develop a Vehicle class that captures the following information:

    a. Company

    b. Model

    c. MRSP

    d. Number of vehicles created.

  3. Your class should have a null constructor and at least one additional constructor to collect the full information on creation.
  4. Have a method to buy the vehicle.
  5. Create an efficient way to print out all of the information collected on a vehicle.
  6. Develop a class to test your Vehicle class. In this class do the following:

    a. Create the following vehicles from the information below:

    Car:          Model:    MSRP:
    Aston Martin  Vantage   $129,000
    Ford          Fusion    $ 28,678.99
    Honda         Civic EX  $ 18,713.27
    

    b. Exercise your Buy method by buying the Honda Civic.

    c. Use your print method to print out all relevant information on the vehicles above.

    d. When you buy your Honda print out the fact that you bought the Honda.

  7. Bonus points (10). Include a flag item in your class that tells the status of whether the created vehicle was bought or not and have that status print out in your overall Vehicle class print method.

Here is the code I’ve come up with so far, but I’m not sure where to go from here or how to fix the parts with syntax problems. I’m definitely not sure how my BuyVehicle method is supposed to work:

Program.cs

using System;

namespace CreateVehicle
{
    class Program
    {
        static void Main(string[] args)
        {
            Vehicle firstVehicle = new Vehicle("Aston Martin", "Vantage", 129000);
            Console.WriteLine(firstVehicle.ToString());

            firstVehicle.BuyVehicle(true);
            Console.WriteLine("You bought a {0}", firstVehicle.Model);

            Vehicle secondVehicle = new Vehicle("Ford", "Fusion", 28678.99);
            Console.WriteLine(secondVehicle.ToString());

            Vehicle thirdVehicle = new Vehicle("Honda", "Civic EX", 18713.27);
            Console.WriteLine(thirdVehicle.ToString());

        }
    }
}

Vehicle.cs

using System;

namespace CreateVehicle
{
    class Vehicle
    {
        public string companyName;
        private static int totalVehicles = 0;
        private string mModel;
        private string mMSRP;

        public Vehicle()
        {
            companyName = "Not assigned";
            mModel = "Not assigned";
            mMSRP = 0;

            totalVehicles++;
        }

        public Vehicle(string companyName, string model, double price)
        {
            this.companyName = companyName;
            mModel = model;
            mMSRP = price;

            totalVehicles++;
        } 

        public string Model
        {
            get
            {
                return mModel;
            }
        }

        public decimal MSRP
        {
            get
            {
                return mMSRP;
            }
            set
            {
                if (value >= 0)
                {
                    mMSRP = value;
                }
                else
                {
                    mMSRP = 0;
                }
            }
        }

       public string BuyVehicle(Boolean buy)
        {
            if (buy == true)
            {
                return mModel;
            }
            else
            {
                return "";
        }

        public override string ToString()
        {
            return "Vehicle Data:  \n\t" +
                   "Company Name:   " + companyName + "\n\t" +
                   "Model:          " + mModel + "\n\t" +
                   "MSRP:           " + mMSRP.ToString("C") + "\n\t" +
                   "Total vehicles: " + totalVehicles + "\n";
        }
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T17:32:00+00:00Added an answer on June 8, 2026 at 5:32 pm

    Have a look at variable declaration for mMSRP? You’ve declared it as a string but then your assigning it to a 0. Then your constructor is expecting a double and then in your accessor your expecting to return a decimal. This is why I was telling you to step through your code. Not only with vs but with your eyes following its path where its declared. If your still having errors let me know what the errors are. The purpose of this site is to help point you in the direction not give you the answer. You will learn so much more figuring it out yourself and the satifaction

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have an assignment for school that requires me to create a fixed
Can I optimize the class assignment here at all? I have to do this
The Java tutorials here mention that &= is an assignment operator but doesn't seem
I'm getting the error uninitialized constant Assignment::AssignmentsCourse. Here are my models: assignment.rb class Assignment
For an assignment I need to create a class within class Point from java.awt.Point.
I'm creating a custom generic class for an assignment in school. I'm stuck at
Here is the assignment verbatim: 1.) Write a Java program that is a TCP
I have an assignment for school that is really got the best of me.
I have this school assignment that I've been working on and am totally stumped
I'm working on a C assignment for school. Here's the exact wording of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.