Solved

ARRAYS

Posted on 2000-05-08
7
321 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
ID: 2789990
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
ID: 2789996
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
ID: 2791348
good luck with your home-work .

what about the exam ?

can you send questions trough e.e.
durring an exam ?!
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:the_dude
ID: 2793365
it isnt homework!!!!!
0
 

Author Comment

by:the_dude
ID: 2793405
Edited text of question.
0
 

Author Comment

by:the_dude
ID: 2793408
Edited text of question.
0
 

Author Comment

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

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
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 pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

911 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

20 Experts available now in Live!

Get 1:1 Help Now