Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

make a new class with the following public properties and methods: Car class Properties of Car class: Brand, Model, Year, Color, Price (Use appropriate

make a new class with the following public properties and methods:

 

Car class

Properties of Car class:

Brand, Model, Year, Color, Price (Use appropriate data types)

Methods of Car class:

Honk method that will print "Tuut tuut" when called and displays the brand, model, year, color and price of the car.

Constructor that takes in all properties.

In your program class, create the following instances of the Car class.

  1. Brand: Honda, Model: CR-V, Year: 2023, Color: Red, Price: 50,000
  2. Brand: Ford, Model: F-150, Year: 2020, Color: Black, Price: 25,000
  3. Brand: BMW, Model: X5, Year: 2022, Color: Green, Price: 60,000
  4. Brand: Mazda, Model: CX-5, Year: 2019, Color: White, Price: 15,000
  5. Brand: Audi, Model: Q7, Year: 2018, Color: Silver, Price: 52,000
  6. Brand: Kia, Model: Forte, Year: 2020, Color: Blue, Price: 21,000

Invoke the honk method for each instance of the car.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

using System public class Car public string Brand get set public ... 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

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

Recommended Textbook for

Introduction To Programming With Java A Problem Solving Approach

Authors: John Dean

3rd International Edition

1260575241, 9781260575248

More Books

Students also viewed these Programming questions

Question

How does an ERP system differ from MRP II software?

Answered: 1 week ago