Write a C# application AutomobileDemo that prompts a user for data for eight Automobile objects. The Automobile class includes the following auto-implemented properties: IdNumber - The ID number (an int) Make - The make (a string) Year - The year (an int) Price - The price (a double) Override the ToString() method to return all the details for an Automobile. During data entry, re-prompt the user if any ID number is a duplicate. Sort the objects in ID number order, and display all their data as well as a total of all their prices. For example if, the output should be in the following format (only two automobiles shown): Automobile 1 2017 honda Price is $30,000.00 Automobile 45 2016 Toyota Price is $20,000.00 Total for all Automobiles is $50,000.00. using System; using static System.Console; using System.Globalization; class AutomobileDemo { static void Main() { // Your code here }
OOPs
In today's technology-driven world, computer programming skills are in high demand. The object-oriented programming (OOP) approach is very much useful while designing and maintaining software programs. Object-oriented programming (OOP) is a basic programming paradigm that almost every developer has used at some stage in their career.
Constructor
The easiest way to think of a constructor in object-oriented programming (OOP) languages is:
Write a C# application AutomobileDemo that prompts a user for data for eight Automobile objects.
The Automobile class includes the following auto-implemented properties:
- IdNumber - The ID number (an int)
- Make - The make (a string)
- Year - The year (an int)
- Price - The price (a double)
Override the ToString() method to return all the details for an Automobile.
During data entry, re-prompt the user if any ID number is a duplicate. Sort the objects in ID number order, and display all their data as well as a total of all their prices. For example if, the output should be in the following format (only two automobiles shown):
Automobile 1 2017 honda Price is $30,000.00 Automobile 45 2016 Toyota Price is $20,000.00 Total for all Automobiles is $50,000.00.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images