Solved

ARRAYS

Posted on 2000-05-08
7
322 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
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

809 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