• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 330
  • Last Modified:

ARRAYS

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
the_dude
Asked:
the_dude
1 Solution
 
ntdragonCommented:
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
 
alcindorCommented:
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
 
TalmashCommented:
good luck with your home-work .

what about the exam ?

can you send questions trough e.e.
durring an exam ?!
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
the_dudeAuthor Commented:
it isnt homework!!!!!
0
 
the_dudeAuthor Commented:
Edited text of question.
0
 
the_dudeAuthor Commented:
Edited text of question.
0
 
the_dudeAuthor Commented:
thanks for almost beliving me, it really wasnt homework, everyone, including u thought it was, thanks for helping though
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now