Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I'm doing a program in Visual Studio code as an example of Composition. The main application must do the following Create 2 instances of the

I'm doing a program in Visual Studio code as an example of Composition.

The main application must do the following

Create 2 instances of the Automobile class using parameters of your choosingAdd at least 2 tires to the instances

Add some tires by passing a Tire object to the AddTire method

Add some tires by passing the parameters to create a Tire object to the AddTire method

Print one of the instance's properties to the console using the ToString method

Print one of the instance's properties to the console using the GetInfo method

Print the following for one of the instances using property accessors (all information must be included; formatting and order is up to you):

Make

Model

Color

Body Style

Engine Information

Number of Cylinders

Approved Gas Type

Fuel Injected?

Tire Information for each tire

Manufacturer

Tire Size

Max Pressure

Min Pressure

Type

Class Automobile will be the class that is composed of other classes and will have the properties and methods described belowProperties:

Make - type string, the automobile manufacturer (e.g., Ford, Jaguar)

Model - type string, the model description (e.g., Explorer, Navigator)

Color - type string, the car's color

BodyStyle - type string, car style description (e.g., Sedan, SUV)

EngineInfo - type Engine, engine information object (see Engine Class for details)

Tires - collection of type Tire, list/array of the tire objects included in the automobile

Methods:GetInfo() - gets formatted (you determine the format) class information including:

Make

Model

Color

Engine Cylinder Count

Fuel Injected or Not

Number of Tires

ToString() - gets all class information, you determine the format

AddTire(Tire) - adds a tire object to the Tires property

AddTire(string, string, int, int, string) - adds a tire object to the Tires collection via parameters

Class EngineProperties

Cylinders - type integer, the number of cylinders the engine has

GasType - type string, approved type of fuel, e.g., Diesel, Unleaded 87 octane, Ethanol Free

FuelInjected - type bool, whether the engine is fuel injected or carburetor-based

Methods

No additional required methods; you may create additional methods at your discretion

Class TireProperties

Manufacturer - type string, the tire manufacturer, e.g., Continental, Pirelli

Size - type string, the tire size, e.g., 185/60R13, 165/50R15

MaxPressure - type integer, the maximum pressure for the tire

MinPressure - type integer, the minimum pressure for the tire

Type - type string, the type of tire, e.g. All Season Radial, Studded Snow, Spare

Methods

No additional required methods; you may create additional methods at your discretion

image text in transcribedimage text in transcribed

image text in transcribed

image text in transcribed

Automobile +Make: string +Model: string +Color: string +BodyStyle: string +Enginelnfo: Engine +Tires[2..*] +Getinfo(): string +Tostring(): string +AddTire(Tire): void +AddTire(string, string, int, int, string): void 1 1 2... Engine +Cylinders: int +GasType: string +Fuellnjected: boolean Tire +Manufacturer: string +Size: string +MaxPressure: int +MinPressure: int +Type: string Your Name - Week 1 Composition Performance Assessment Automobile 1 - Using ToString() Make: BMN Model: 325i Color: Black Body Style: Luxury Sedan Engine Cylinders: 6 Gas Type: Premium Unleaded Only Fuel Injected? True Tire 1 Mfg: Pirelli Size: 205/55R16 Max Pressure: 35 Min Pressure: 30 Type: All Season Plus Tire 2 Mfg: Pirelli Size: 205/55R16 Max Pressure: 35 Min Pressure: 30 Type: All Season Plus Tire 3 Mfg: Falken Size: 205/55R16 Max Pressure: 35 Min Pressure: 30 Type: All Season Tire 4 Mfg: Falken Size: 205/55R16 Max Pressure: 35 Min Pressure: 30 Type: All Season Tire 5 Mfg: Dorman Size: 135/80R17 Max Pressure: 65 Min Pressure: 55 Type: Spare Automobile 2 - Using GetBasicInfo() Make: Toyota Model: 4-Runner Color: Red Engine: Cylinder Count: 6 Fuel Injected? True Number of Tires: 5 Automobile 2 - Using Properties Directly Make: Toyota Model: 4-Runner Color: Red Body Style: suv Cylinders: 6 Gas Type: Unleaded Fuel Injected? True Tire \#1 Manufacturer: Bridgestone Size: 265/70R17 Min Pressure: 40 Max Pressure: 44 Type: All Terrain Tire \#2 Manufacturer: Bridgestone Size: 265/70R17 Min Pressure: 40 Max Pressure: 44 Type: All Terrain Tire \#3 Manufacturer: Bridgestone Size: 265/70R17 Min Pressure: 40 Max Pressure: 44 Type: All Terrain Tire \#4 Manufacturer: Bridgestone Size: 265/70R17 Min Pressure: 40 Max Pressure: 44 Type: All Terrain Tire \#5 Manufacturer: Cooper Size: 265/70R17 Min Pressure: 40 Max Pressure: 44 Type: Full-Size Spare

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Transactions On Large Scale Data And Knowledge Centered Systems Xxviii Special Issue On Database And Expert Systems Applications Lncs 9940

Authors: Abdelkader Hameurlain ,Josef Kung ,Roland Wagner ,Qimin Chen

1st Edition

3662534541, 978-3662534540

More Books

Students also viewed these Databases questions