Question

C# WORKING WITH CLASSES Design three classes for tracking data about automobiles and trucks. Use a...

C# WORKING WITH CLASSES

Design three classes for tracking data about automobiles and trucks.

Use a vehicle base-class to identify values common to both kinds of vehicles. Include at least four members.

Inherit the base class for a vehicle class, adding at least three members.

Inherit the base class for a truck class, adding at least three members.

Include a Visual Studio class diagram file in your group's final post that clearly defines your classes.

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

The C# base class and derived class code is as given below: using System; namespace InheritanceApplication //The base class c//The second derived class truck, inherited from vehicle class truck vehicle //mebers of the class private double load; publiUMLClassDiagram2.classdiagram* -р Х Program.cs cd UMLClassDiagram2 «C# class» Inherit...mobile Attributes -passng Integer E O

Raw Copyable Code:

using System;
namespace InheritanceApplication
{
    //The base class
    class vehicle
    {
        //protected data members
        protected int wheelNumber;
        protected double engineCapacity;
        protected double weight;

        //function members
        public void setWeighth(int w)
        {
            weight= w;
        }

        public void setwheelNumber(int wn)
        {
            wheelNumber=wn;
        }


        public void setengineCapacity(int ec)
        {
            engineCapacity = ec;
        }

    }

    //The derived class automobile, inherited from vehicle
    class automobile : vehicle
    {
        //members of the class
        private int passng;
        public void setPassng(int n)
        {
            passng=n;
        }

        public void wheelPerPass()
        {
            Console.WriteLine(wheelNumber / passng);
        }
     }

    //The second derived class truck, inherited from vehicle
    class truck : vehicle
    {
        //mebers of the class
        private double load;
        public void setload(double n)
        {
            load = n;
        }

        public void loadPerweight()
        {
            Console.WriteLine(load /weight);
        }
    }

}

Add a comment
Know the answer?
Add Answer to:
C# WORKING WITH CLASSES Design three classes for tracking data about automobiles and trucks. Use a...
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
  • Problem You work for a dealership that deals in all kinds of vehicles. Cars, Trucks, Boats,...

    Problem You work for a dealership that deals in all kinds of vehicles. Cars, Trucks, Boats, and so forth need to be inventoried in the system. The inventory must be detailed so that it could be searched based on number of doors, engine type, color, and so on. This program will demonstrate the following: How to create a base class How to extend a based class to create new classes How to use derived classes Solving the Problem Step 1...

  • Ship, CruiseShip, and CargoShip Classes (in C++ language i use visual studios to code with) design...

    Ship, CruiseShip, and CargoShip Classes (in C++ language i use visual studios to code with) design a Ship class that has the following members: - A member variable for the name of the ship (a string) - A member variable for the year that the ship was built (a string) - A contsructor and appropriate accessors and mutators - A virtual print function that displays the ship's name and the year it was built (nobody seems to get this part...

  • This is in C++ (using IDE Visual Studio). I am seeking assistance ASAP. Please include a...

    This is in C++ (using IDE Visual Studio). I am seeking assistance ASAP. Please include a static member in the class to automatically assign account numbers (used to process up to 10 accounts) and have the user include their first and last name. Thank you! 13. a. Define the class bankAccount to store a bank customer's account number and balance. Suppose that account number is of type int, and balance is of type double. Your class should, at least, provide...

  • Project 1 – Classes and Top-down Design Overview Software development projects using the object-oriented approach involve...

    Project 1 – Classes and Top-down Design Overview Software development projects using the object-oriented approach involve breaking the problem down into multiple classes that can be tied together into a single solution. In this project, you are given the task of writing some classes that would work together for providing a solution to a problem involving some basic computations. Learning Objectives The focus of this assignment is on the following learning objectives: • Be able to identify the contents of...

  • Lab 2 – Classes include the header files for the classes Overview The purpose of this...

    Lab 2 – Classes include the header files for the classes Overview The purpose of this assignment is to give you some experience writing classes in C++, including utilizing accessors and constructors to organize data properly. Description This program will represent a hypothetical car production line, which consists of a chassis (body of a vehicle) and wheels. These two components will be used to make fully functioning vehicles (just use your imagination). To that end, there are three classes you...

  • Please help ASAP! C ++, linked list, etc. everything for the project is in the link...

    Please help ASAP! C ++, linked list, etc. everything for the project is in the link below. https://www.zipshare.com/download/eyJhcmNoaXZlSWQiOiIzZDIyN2UzYi1kNGFhLTRlMzEtYjMzZi00MDhmYzNiMjk3ZGMiLCJlbWFpbCI6Im1pMTQzNEBnbWFpbC5jb20ifQ== You should turn it in by blackboard. Each task should be in a separate unzipped folder named YourLastName_YourFirstInitial_taskN, where N is the task number inside a zipped file named: YourLastName_YourFirstInitial.zip. You may use code you have written previously and you may ask other members of the class questions about the assignment. However, you must do your own assignment; you may not use...

  • Purpose: Demonstrate the ability to create and manipulate classes, data members, and member functions. This assignment...

    Purpose: Demonstrate the ability to create and manipulate classes, data members, and member functions. This assignment also aims at creating a C++ project to handle multiple files (one header file and two .cpp files) at the same time. Remember to follow documentation and variable name guidelines. Create a C++ project to implement a simplified banking system. Your bank is small, so it can have a maximum of 100 accounts. Use an array of pointers to objects for this. However, your...

  • its about in C++ You will implement a simple calendar application The implementation should include a class named Calendar, an abstract class named Event and two concrete classes named Task an...

    its about in C++ You will implement a simple calendar application The implementation should include a class named Calendar, an abstract class named Event and two concrete classes named Task and Appointment which inherit from the Event class The Event Class This will be an abstract class. It will have four private integer members called year, month, day and hour which designate the time of the event It should also have an integer member called id which should be a...

  • This is a standard C++ programming assignment using a command line g++ compiler or the embedded...

    This is a standard C++ programming assignment using a command line g++ compiler or the embedded one in zyBooks. No GUI forms and no Visual Studio. No external files and no databases are used. There is only one object-oriented program to complete in this assignment. All code should be saved in a file named ExamScoresUpdate.cpp, which is the only file to submit for grading. No .h files used. The .cpp file contains main() and two classes, ExamScores and DataCollector. There...

  • /*hello everyone. my question is mostly related to the garagetest part of this assignment that i've...

    /*hello everyone. my question is mostly related to the garagetest part of this assignment that i've been working on. i am not sure how to read the file's contents AND put them into variables/an array. should it be in an arraylist? or maybe a regular array? or no arrays at all? i am also not sure how to call the factory method from garagec. i'm thinking something along the lines of [Garage garage = new GarageC.getInstance("GarageC", numFloors, areaofEachFloor);] but i...

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