Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Homework 2 4 : ( VBA code ) Vehicle Class Obiects Create a new class module called Vehicle. Each Vehicle object has the following attributes:

Homework 24:(VBA code) Vehicle Class Obiects
Create a new class module called Vehicle. Each Vehicle object has the following attributes: num_wheels (integer), top_speed (double), seating capacity (integer), mpg (double), horsepower (double), and license_plate (string).
Write a method that assigns the attributes of a sedan: 4 wheels, 120 mph top speed, 5 seating capacity, 25mpg,150hp, and 123 CAR license plate.
Write a method that assigns the attributes of a pickup truck: 4 wheels, 100 mph top speed, 2 seating capacity, 16mpg,250hp, and 456 TRK license plate.
Write a method that assigns the attributes of a super car: 4 wheels, 200 mph top speed, 2 seating capacity, 20mpg,1100hp, and GO FAST license plate.
Write a method that assigns the attributes of a semi truck: 18 wheels, 85 mph top speed, 2 seating capacity, 7mpg,500hp, and LG HAUL license plate.
Write a method that assigns the attributes of a school bus: 6 wheels, 65 mph top speed, 50 seating capacity, 12 mpg .200 hp , and KUL BUS license plate.
Write a method that assigns the attributes of a motorcycle: 2 wheels, 150 mph top speed, 1 seating capacity, 32mpg,100hp, and VRO OOM license plate
Next, we are going to create a drop down menu for cells AO24, AO25, and AO26 that allows the user to select the vehicle type for 3 Vehicle objects. Go to Data Data Tools Data Validation Settings Allow List. Select the cells AR24:AR29 for the source of the drop down list.
Now, write a sub that creates 3 vehicle objects and calls the methods written above based off when the user selected from the drop down lists. Then, using the properties of the 3 objects output the following to the spreadsheet
License plate of the fastest vehicle
The average mpg of the vehicles
The total seats across all vehicles
The total horsepower per wheel (total horsepower / total wheels)
See the instructor example on the screen.
\table[[Vehicle Class Object,],[Vehicle 1,],[Vehicle 2,],[Vehicle 3,],[Fast License Plate,],[Average MPG,],[Total Seating,],[HP per Wheel,]]
Assign Vehicles
Drop-down list input
Sedan
Pickup Truck
Super Car
Semi Truck
School Bus
Motorcycle
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

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

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

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

Get Started

Students also viewed these Databases questions