Question

In C# you will be creating a car dealership app that will contain an Automobile class...

In C# you will be creating a car dealership app that will contain an Automobile class and three subclasses – Car, Truck, SUV. The properties for Automobile are as follows Base cost Model Make Year The Car will inherit Automobile and include the following: Tax break for better fuel option this calculation will be 2% The Truck will inherit Automobile and include the following: Incentive of $2000 off the cost The SUV will inherit Automobile and include the following: Extra Options of Leather, cloth, vinyl for seats Your program will be creating objects of each type and storing them in an array. This program will continue displaying the menu until the user selects quit. Once quit is selected you will print the each of the objects out to the screen. For example, if I select Car – I will be asked to put in the base cost, model, make, year. The tax benefit will automatically be set. Then if select truck I will enter in that information. Once I am finished entering in the data the program will print each object and their properties out to the screen.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Output will be like:

Code will be like:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CarDealershipAPP
{
class Program
{
static void Main(string[] args)
{
bool check=true;


car[] carArray = new car[5];
Truck[] truckArray = new Truck[5];
SUV[] suvArray = new SUV[5];
int carcount = 0;
int truckCount = 0;
int suvCount = 0;

do{
Console.WriteLine("Select from below \n 1.Car \n 2.Truck \n 3.SUV \n 4.Quit");

string res = Console.ReadLine();

  

switch(res)
{
case "1":
  
car carObj = new car();
Console.WriteLine("Enter base price");
carObj.baseCost = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("Enter model");
carObj.model = Console.ReadLine();
Console.WriteLine("Enter make year");
carObj.makeYear = Console.ReadLine();
carObj.taxBreak = carObj.baseCost * 0.02;
carArray[carcount] = carObj;
carcount++;
break;

case "2":
Truck truckObj = new Truck();
Console.WriteLine("Enter base price");
truckObj.baseCost = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("Enter model");
truckObj.model = Console.ReadLine();
Console.WriteLine("Enter make year");
truckObj.makeYear = Console.ReadLine();
truckArray[truckCount] = truckObj;
truckCount++;
break;

case "3":
SUV suvObj = new SUV();
Console.WriteLine("Enter base price");
suvObj.baseCost = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("Enter model");
suvObj.model = Console.ReadLine();
Console.WriteLine("Enter make year");
suvObj.makeYear = Console.ReadLine();
Console.WriteLine("Enter type of seat ");
string res1 = Console.ReadLine();

switch(res)
{
case "Leather":
suvObj.leather = true;
break;
case "cloth":
suvObj.cloth = true;
break;
case "vinyl":
suvObj.vinyl = true;
break;
}

suvArray[suvCount] = suvObj;
suvCount++;

break;

case "4":


for (int i = 0; i <= carcount-1;i++ )
{
Console.WriteLine(carArray[i].baseCost);
Console.WriteLine(carArray[i].makeYear);
Console.WriteLine(carArray[i].model);
Console.WriteLine(carArray[i].taxBreak);
}
check=false;


break;

}
  

}
while(check);
}

}
  

public class Automobile
{
public double baseCost;
public string model;
public string makeYear;

}

public class car:Automobile
{
public double taxBreak;

}
public class Truck:Automobile
{
public double incentiveCost = 2000;

}
public class SUV:Automobile
{
public bool leather;
public bool vinyl;
public bool cloth;

}
}

Please rate it if the above solution helps you in any way or if you have any concerns comment it, I will help you through again.

Add a comment
Know the answer?
Add Answer to:
In C# you will be creating a car dealership app that will contain an Automobile class...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • I need this in java please Create an automobile class that will be used by a...

    I need this in java please Create an automobile class that will be used by a dealership as a vehicle inventory program. The following attributes should be present in your automobile class: private string make private string model private string color private int year private int mileage. Your program should have appropriate methods such as: default constructor parameterized constructor add a new vehicle method list vehicle information (return string array) remove a vehicle method update vehicle attributes method. All methods...

  • c++ problem You are asked to implement a car ordering system for Bobcats Auto Dealership. This...

    c++ problem You are asked to implement a car ordering system for Bobcats Auto Dealership. This dealership is brand new and only sells one brand of cars with three different models. However, a buyer can add options if they choose. Write a C++ program that allows the user to order a single car with different options. All the options available will be stored in a file called "options.txt" along with their cost. You may assume that the file will not...

  • Creating a Class in C++ Summary In this lab, you create a programmer-defined class and then...

    Creating a Class in C++ Summary In this lab, you create a programmer-defined class and then use it in a C++ program. The program should create two Rectangle objects and find their area and perimeter. Instructions Ensure the class file named Rectangle.cpp is open in your editor. In the Rectangle class, create two private attributes named length and width. Bothlength and width should be data type double. Write public set methods to set the values for lengthand width. Write public...

  • how would i write code in java/netbeans for this: You will be creating the driver class...

    how would i write code in java/netbeans for this: You will be creating the driver class for this homework (PA05_TVs.java) and the object/element class, TV.java. Your TV class should include only a channel value for instance data (3-99) and the following methods: constructor [requires an initial channel value], getter, setter, randomChannel() [does not return the new channel value], and toString(). The driver class must complete the following: Instantiate a TV object and set the initial channel to 97. Instantiate a...

  • Lab 10C - Creating a new class This assignment assumes that you have read and understood...

    Lab 10C - Creating a new class This assignment assumes that you have read and understood the following documents: http://www.annedawson.net/Python3_Intro_OOP.pdf http://www.annedawson.net/Python3_Prog_OOP.pdf and that you're familiar with the following example programs: http://www.annedawson.net/python3programs.html 13-01.py, 13-02.py, 13-03.py, 13-04.py Instructions: Complete as much as you can in the time allowed. Write a Python class named "Car" that has the following data attributes (please create your own variable names for these attributes using the recommended naming conventions): - year (for the car's year of manufacture)...

  • Assignment Requirements I have also attached a Class Diagram that describes the hierarchy of the inheritance...

    Assignment Requirements I have also attached a Class Diagram that describes the hierarchy of the inheritance and interface behaviors . The link to the PDF of the diagram is below MotorVehical.pdf Minimize File Preview User Define Object Assignment: Create a Intellij Project. The Intellij project will contain three user defined classes. The project will test two of the User Define Classes by using the invoking each of their methods and printing the results. You are required to create three UML...

  • Objective: Learn basic C# Programming Language A certain automobile dealership sells fifteen different models of automobiles...

    Objective: Learn basic C# Programming Language A certain automobile dealership sells fifteen different models of automobiles and employs ten salesmen. A record of sales for each month can be represented by a table, the first row of which contains the number of sales of each model by salesman 1, the second row contains the number of sales of each model by salesman 2, and so on. For example, suppose that the sales table for a certain month is the following:...

  • C++ For this assignment you will be building on the Original Fraction class you began last...

    C++ For this assignment you will be building on the Original Fraction class you began last week. You'll be making four major changes to the class. [15 points] Delete your set() function. Add two constructors, a default constructor that assigns the value 0 to the Fraction, and a constructor that takes two parameters. The first parameter will represent the initial numerator of the Fraction, and the second parameter will represent the initial denominator of the Fraction. Since Fractions cannot have...

  • java only no c++ Write a Fraction class whose objects will represent fractions. You should provide...

    java only no c++ Write a Fraction class whose objects will represent fractions. You should provide the following class methods: Two constructors, a parameter-less constructor that assigns the value 0 to the Fraction, and a constructor that takes two parameters. The first parameter will represent the initial numerator of the Fraction, and the second parameter will represent the initial denominator of the Fraction. Arithmetic operations that add, subtract, multiply, and divide Fractions. These should be implemented as value returning methods...

  • I need an OUTLINE ONLY (pseudocode/comments). DO NOT DO THE PROGRAMMING ASSIGNMENT. Part I: PA3 Outline...

    I need an OUTLINE ONLY (pseudocode/comments). DO NOT DO THE PROGRAMMING ASSIGNMENT. Part I: PA3 Outline (10 points). Create an outline in comments/psuedocode for the programming assignment below. Place your comments in the appropriate files: main.cpp, functions.h, dealer.cpp, dealer.h, dealer.cpp (as noted below). Place into a file folder named LastnamePA3, the zip the content and hand in a zip file to Canvas. Part II: PA3: Car Dealership (40 points) For Programming Assignment 3 you will be creating a program to...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT