Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Programming Language Expert

Assignment

Write a program for a car dealership that has a database of information for different automobiles. Each automobile has one or more attributes associated with it (color, Looks sporty, etc.). The number of attributes that each automobile has is not known at this time (and can be different for each). The program needs to accept commands with the goal of providing a list of automobiles that fit your criteria.

Input:

1. The list of automobiles and attributes should be stored in a file called autodata.txt. This file is to be read at the beginning each time your program is run (if it exists). Your program will create this file. The format for this file shall be:

NameCar1,Attribute1,Attribute2,... NameCar2,Attribute1,Attribute2,...

This is just a comma separated list with the car name first followed by all of its attributes. I will also check your programs with a data file that I generate so the file MUST be in this format.

2. The input formats as well as the commands are in the table below. Also, the entire program shall not be case sensitive.
Output:

1. The responses to the user's commands.

2. Each time you execute the SHOW command, also place the results in a file called results.txt. This file can be any format, however, make sure it is labeled clearly. Also, this file should append these results to previous runs.

3. When new cars along with their attributes are added using the ADD command, this data must be persisted to the autodata.txt.

Commands:

Command How it is processed

ADD Adds a new automobile. Prompt user for car name and the list of attributes. Shall not work if in search mode

Search Puts program in search mode. Prompt for name of this search (should probably be a heading in the results.txt file).

hasFeature Prompt user to enter an attribute to look for. Then process your list of current cars that match this criterion. If there is only one car left, print out the name of this car and that you have found it (this case would terminate search mode). (Search Mode Only)

CheckAuto Input the name of an automobile and print out the attributes about it if it exists in our search list. (Search Mode Only)

Show Shows the current list of automobiles that match all of the features you have listed as criteria thus far. (Search Mode Only).

Exit Exits Search mode and resets all attributes that were entered.

Quit Save the autodata.txt file if automobiles have been added and exits the program.

Notes:

• This program must be written in C++ using classes with header files. Every function also needs to be properly documented.

• Main should only contain menu code. All other processing must be done in other classes.

• The number of attributes is not known, an array will not work here.

• The CheckAuto feature needs to be fast (a linked list will not work here). Use a binary search tree. This tree should be a copy of the original since it should only contain the vehicles that currently match all of the features that have been added for this search.

• The HasFeature does not have to be as efficient and can traverse the entire data structure to find matches and eliminate ones that don't (again, this should use the copy, why look at data that you have already eliminated).

Sample input (obviously a menu should be initially shown with the choices as well as again if an invalid input is entered. All the menu items typed are italicized):

Add

Name: Mazda 6 Attributes: AWD
V6
Looks Good Great gas mileage

Add
Name: Honda Pilot Attributes: Large
V6 AWD
Looks Like a Box

Add
Name: Corvette Attributes: Fast
Great sound system Looks Good

Add
Name: DeLorean Attributes: V6
Looks Good Stainless Steel body Has Flux Capacitor
Search
Name: Good Looking Car

hasFeature
feature: Looks Good

hasFeature
feature: V6

CheckAuto
Name: Corvette
Not Found

CheckAuto Name: DeLorean Attributes:
V6
Looks Good Stainless Steel body Has Flux Capacitor

Show Mazda 6 DeLorean

hasFeature
AWD

Car Found!!!!!
Mazda 6 is your car!

Quit.

Programming Language, Programming

  • Category:- Programming Language
  • Reference No.:- M92796908

Have any Question?


Related Questions in Programming Language

Assignment - horse race meetingthe assignment will assess

Assignment - Horse Race Meeting The Assignment will assess competencies for ICTPRG524 Develop high level object-oriented class specifications. Summary The assignment is to design the classes that are necessary for the ad ...

Question 1 what is a computer program what is structured

Question: 1. What is a Computer program? What is structured programming? 2. What is modular programming? Why we use it? 3. Please evaluate Sin (x) by infinite series. Then write an algorithm to implement it with up to th ...

Assignment - proposal literature review research method1

Assignment - Proposal, Literature Review, Research Method 1. Abstract - Summary of the knowledge gap: problems of the existing research - Aim of the research, summary of what this project is to achieve - Summary of the a ...

Assignmentquestion onegiving the following code snippet

Assignment Question One Giving the following code snippet. What kind of errors you will get and how can you correct it. A. public class HelloJava { public static void main(String args[]) { int x=10; int y=2; System.out.p ...

Task arrays and structsoverviewin this task you will

Task: Arrays and Structs Overview In this task you will continue to work on the knight database to help Camelot keep track of all of their knights. We can now add a kingdom struct to help work with and manage all of the ...

Task silly name testeroverviewcontrol flow allows us to

Task: Silly Name Tester Overview Control flow allows us to alter the order in which our programs execute. Building on our knowledge of variables, we can now use control flow to create programs that perform more than just ...

Assignment task -q1 a the fibonacci numbers are the numbers

Assignment Task - Q1. (a) The Fibonacci numbers are the numbers in the following integer sequence, called the Fibonacci sequence, and are characterised by the fact that every number after the first two is the sum of the ...

Question - create a microsoft word macro using vba visual

Question - Create a Microsoft Word macro using VBA (Visual Basic for Applications). Name the macro "highlight." The macro should highlight every third line of text in a document. (Imagine creating highlighting that will ...

Task working with arraysoverviewin this task you will

Task: Working with Arrays Overview In this task you will create a simple program which will create and work with an array of strings. This array will then be populated with values, printed out to the console, and then, w ...

Structs and enumsoverviewin this task you will create a

Structs and Enums Overview In this task you will create a knight database to help Camelot keep track of all of their knights. Instructions Lets get started. 1. What the topic 5 videos, these will guide you through buildi ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As