Solved

ARRAYS

Posted on 2000-05-08
7
320 Views
Last Modified: 2010-04-02
Hi

I have to write a program involving arrays and am having trouble figuring out where to start.  Here it is, if you could please give me your opinion on how to write it, that would be great, thanks:

Cars have been tested with A-E(good through bad) for how the preformed.  The are in a file called inData.
INPUT:
read the input data from file inData.  The first data line contains the key to the standards.  For example, if a certain character position contains an "A", then every vehicle must receive an "A" rating for the corresponding test, or be rejected.

The test letters are the first 30 characters, and the are followed by an integer number that indicated how many vehicles were tested(n).
The next n lines contain test results for various vehicles in the first 20 character positions, followed by the vehicles registration/license ID in the next (up to) 8 character positions.

OUTPUT:
for each vehicle, output the reg/lic ID, followed by PASSED if the vehicle satisfies all tests, or FAILED if any of the test results dont meet standards.  For failed ones, shoe the number of each failed test, the required result and the actual result should also be printed.

EXAMPLE INPUT FILE

cccdacccddbacbbcaccccccaadbbcc CAR1
abddacccddbacbbcaccccccaadbbcc CAR2
aaadacccddbacbbcaccccccaadbbcc CAR3
adadccccddbacbbcaccccccaadbbcc CAR4

EXAMPLE OUTPUT

CAR2   FAILED
      Test 3 required C Actual D
CAR3 PASSED
CAR4 FAILED
      Test 2 Required C Actual D
      Test 5 Required A Actual C

IT ISNT HOMEWORK!!!!!!!!!
0
Comment
Question by:the_dude
7 Comments
 
LVL 1

Expert Comment

by:ntdragon
Comment Utility
we don't answer to homework questions
ask a direct QUESTION and send us your code or your ideas and we will try to help we can't do it for you
0
 
LVL 2

Accepted Solution

by:
alcindor earned 50 total points
Comment Utility
This problem can be solved by first providing an analysis in structured english and then coding in the language of your choice. eg :-
( allowing for your typing errors !)

1 - read in the first line and set up an array representing the pass level for each test.(pass level array)

2 - for each car perform the following operations

a) read the test results into an array (test results array) and the car registration into a temporary variable ( eg car_reg)

b) compare each element of the pass level array with the test results array and count the number of "failures"

c) if there are no failures then display the PASS message, otherwise display the FAIL message and repeat step b) above, this time displaying the test results that failed.

If this is a school assignment then you should not post the question on experts exchange.

Roger
0
 
LVL 6

Expert Comment

by:Talmash
Comment Utility
good luck with your home-work .

what about the exam ?

can you send questions trough e.e.
durring an exam ?!
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:the_dude
Comment Utility
it isnt homework!!!!!
0
 

Author Comment

by:the_dude
Comment Utility
Edited text of question.
0
 

Author Comment

by:the_dude
Comment Utility
Edited text of question.
0
 

Author Comment

by:the_dude
Comment Utility
thanks for almost beliving me, it really wasnt homework, everyone, including u thought it was, thanks for helping though
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Want to delete all my personal data 13 126
C++ assignment question 7 127
I could not build boost code, 10 50
c++ syntax question 9 34
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now